-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
101 lines (90 loc) · 2.41 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
# adapted from https://github.com/mesonbuild/lua/tree/5.3.6
project(
'lua-5.0', 'c',
license: 'MIT',
meson_version: '>=0.49.2',
version: '5.0.2',
default_options: [
'default_library=static'
]
)
# Override the c_std and warning_level of any superproject.
project_options = ['c_std=c99', 'warning_level=2']
cc = meson.get_compiler('c')
# Skip bogus warning.
if cc.get_id() == 'clang'
add_project_arguments('-Wno-string-plus-int', language: 'c')
elif cc.get_id() == 'gcc'
add_project_arguments('-Wno-stringop-overflow', language: 'c')
endif
# Platform-specific defines.
is_posix = host_machine.system() not in ['windows', 'emscripten', 'android']
if is_posix
add_project_arguments('-DLUA_USE_POSIX', language: 'c')
endif
# add_project_arguments('-DLUA_USER_H="../etc/luser_number.h"', language: 'c')
add_project_arguments('-DUSE_INT', language: 'c')
add_project_arguments('-DLUA_OPNAMES', language: 'c')
# Library dependencies.
dep_lua = [cc.find_library('m', required: false)]
inc_inc = include_directories('include')
# Targets.
inc_src = include_directories('src')
lua = library(
'lua',
'src/lgc.c',
'src/lmem.c',
'src/ltests.c',
'src/ldump.c',
'src/ltm.c',
'src/ldo.c',
'src/ldebug.c',
'src/lobject.c',
'src/lstring.c',
'src/lzio.c',
'src/lopcodes.c',
'src/lcode.c',
'src/lstate.c',
'src/lparser.c',
'src/lundump.c',
'src/llex.c',
'src/lfunc.c',
'src/lvm.c',
'src/lapi.c',
'src/ltable.c',
dependencies: dep_lua,
override_options: project_options,
implicit_include_directories: false,
include_directories: [inc_inc, inc_src],
)
inc_lib = include_directories('src/lib')
lua_lib = library(
'lualib',
'src/lib/lstrlib.c',
'src/lib/lmathlib.c',
'src/lib/liolib.c',
'src/lib/ltablib.c',
'src/lib/lbaselib.c',
'src/lib/lauxlib.c',
'src/lib/ldblib.c',
'src/lib/loadlib.c',
dependencies: dep_lua,
override_options: project_options,
implicit_include_directories: false,
include_directories: [inc_inc, inc_lib],
cpp_args : '-DLUA_USER_H="../../etc/luser_number.h"',
)
executable('luac',
'src/luac/luac.c',
'src/luac/print.c',
link_with: [lua, lua_lib],
override_options: project_options,
implicit_include_directories: false,
include_directories: [inc_inc, inc_src],
)
# Make this library usable as a Meson subproject.
lua_dep = declare_dependency(
include_directories: inc_inc,
link_with : [lua, lua_lib],
dependencies: [dep_lua],
)