aboutsummaryrefslogtreecommitdiff
path: root/meson.build
blob: e4d1c5b310abfeaebffd8df50efc131fccc36768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
project('sok', 'c', default_options: ['c_std=c11'])

# MSI settings
MSI_SDL_LIB_DIR = '/usr/local/x86_64-w64-mingw32/bin'

# find libm (used for SDL version)
cc = meson.get_compiler('c')
libm = cc.find_library('m', required: false)

# find wixl (used for windows version)
wixl = find_program('wixl', native: true, disabler: true)

# core source (shared across all applications)
sources = [
  'src/core/sok-level-parser.c',
  'src/core/sok-ctx.c',
  'src/core/sok-ctx-hash.c',
  'src/core/sok-cache.c',
  'src/core/sok-solve.c',
]

# text UI
executable('text', sources + [
  'src/levels/levels.c',
  'src/text/main.c', 'src/text/action.c',
  'src/text/draw.c',
], dependencies: [])

# sdl (main) exe
sok_exe = executable('sok', sources + [
  'src/levels/levels.c',
  'src/sdl/warp-buf.c',
  'src/sdl/color.c',
  'src/sdl/action.c',
  'src/sdl/sprites.c',
  'src/sdl/draw-text.c',
  'src/sdl/bg-style.c',
  'src/sdl/draw.c',
  'src/sdl/assets.c',
  'src/sdl/main.c',
  'src/sdl/theme.c',
  'src/sdl/log-renderer-info.c',
  'src/sdl/solve.c',
  'src/sdl/sounds.c',
  'src/sdl/font.c',
], dependencies: [
  dependency('SDL2'),
  dependency('SDL2_ttf'),
  dependency('SDL2_mixer'),
  libm,
])

# sok.msi
custom_target('msi',
  input: 'src/msi/sok.wxs',
  output: 'sok.msi',
  command: [
    wixl,
    '-o', '@OUTPUT@',
    '-D', 'BUILD_DIR=.',
    '-D', 'SRC_ROOT_DIR=' + meson.source_root(),
    '-D', 'SDL_LIB_DIR=' + MSI_SDL_LIB_DIR,
    '@INPUT@',
  ]
)

# sprite-packer exe
executable('sprite-packer', [
  'src/sprite-packer/main.c',
], dependencies: [
  dependency('SDL2'),
  libm,
])

# solver
solve = executable('solve', sources + [
  'src/levels/levels.c',
  'src/solve/main.c',
], dependencies: [])

# generate solve tests
foreach i: [0, 3, 4, 11, 18, 23] # long tests: 14, 17, 22, 26
  test('level @0@'.format(i), solve, args: [
    '@0@'.format(i),
  ])
endforeach