-
Notifications
You must be signed in to change notification settings - Fork 9
/
meson.build
142 lines (116 loc) · 2.89 KB
/
meson.build
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
project('flecs-lua', 'c',
version : '3.2.0',
license : 'MIT',
default_options : 'c_std=c99'
)
tests = get_option('tests')
if tests.enabled()
add_global_arguments('-DLUA_USE_APICHECK', language : 'c')
endif
if get_option('lua54') == true
subproject('lua-54')
endif
flecs_lua_deps = [
dependency('lua'),
dependency('flecs')
]
flecs_lua_src = []
flecs_lua_args = []
if get_option('default_library') == 'static'
flecs_lua_args += '-Dflecs_lua_STATIC'
endif
flecs_lua_inc = include_directories('include')
flecs_lua_src += files(
'src/bulk.c',
'src/ecs.c',
'src/emmy.c',
'src/entity.c',
'src/hierarchy.c',
'src/iter.c',
'src/log.c',
'src/meta.c',
'src/misc.c',
'src/module.c',
'src/pipeline.c',
'src/query.c',
'src/snapshot.c',
'src/system.c',
'src/time.c',
'src/timer.c',
'src/world.c'
)
flecs_lua_lib = library('flecs-lua',
flecs_lua_src,
install : true,
dependencies : flecs_lua_deps,
include_directories : flecs_lua_inc,
c_args : [ '-Dflecs_lua_EXPORTS', flecs_lua_args ],
)
flecs_lua_dep = declare_dependency(
link_with : flecs_lua_lib,
dependencies : flecs_lua_deps,
compile_args : flecs_lua_args,
include_directories : flecs_lua_inc
)
if meson.version().version_compare('>= 0.54.0')
meson.override_dependency('flecs-lua', flecs_lua_dep)
endif
emmy_src = files('ecs.lua')
if tests.disabled()
subdir_done()
endif
test_lib = library('test-lua',
files('test/test.c'),
dependencies : flecs_lua_dep,
c_args : [ '-Dflecs_lua_EXPORTS', flecs_lua_args ],
)
test_dep = declare_dependency(
link_with : test_lib,
dependencies : flecs_lua_dep,
compile_args : flecs_lua_args,
)
test_exe = executable('e', files('test/main.c'), dependencies : test_dep)
const_exe = executable('print_const', 'test/const.c', dependencies : flecs_lua_dep)
tests = [
'misc',
'entity',
'meta_limits',
'meta',
'snapshot',
'iter',
'system',
'module',
'pipeline',
'query',
'pair',
'prefab',
'timer'
]
#Note: Running tests from interpreter requires --layout=flat
env = environment()
lua_path = meson.current_source_dir() / 'test\?.lua'
lua_cpath = test_lib.full_path()
env.set('LUA_PATH', lua_path)
env.set('LUA_CPATH', lua_cpath)
lua_exe = find_program('lua')
foreach name : tests
script = files('test' / name + '.lua')
test(name, test_exe, args : script, env : env)
endforeach
run_target('const', command : const_exe)
luac = find_program('luac')
lua = find_program('lua')
run_target('dec',
command: [
luac,
'-l', '-l',
files('test/script.lua')
]
)
run_target('script',
command: [
lua,
files('test/script.lua')
]
)
run_target('repl', command: lua)