-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
xmake.lua
93 lines (70 loc) · 2 KB
/
xmake.lua
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
-- version
set_version("1.0.3")
set_xmakever("2.2.5")
-- set warning all as error
set_warnings("all", "error")
-- set language: c99, c++11
set_languages("c99", "cxx11")
-- disable some compiler errors
add_cxflags("-Wno-error=deprecated-declarations")
add_mxflags("-Wno-error=deprecated-declarations")
add_cxflags("-Wno-error=nullability-completeness")
add_mxflags("-Wno-error=nullability-completeness")
-- the debug mode
if is_arch("debug") then
-- enable the debug symbols
set_symbols("debug")
-- disable optimization
set_optimize("none")
-- add defines for debug
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
if is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
-- the release is_arch
elseif is_arch("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
-- strip all symbols
set_strip("all")
-- fomit the frame pointer
add_cxflags("-fomit-frame-pointer")
add_mxflags("-fomit-frame-pointer")
-- for pc
if is_arch("i386", "x86_64") then
-- enable fastest optimization
set_optimize("fastest")
-- for embed
else
-- enable smallest optimization
set_optimize("smallest")
end
end
-- for embed
if not is_arch("i386", "x86_64") then
-- add defines for small
add_defines("__tb_small__")
end
-- add links
if is_plat("windows") then
add_syslinks("ws2_32")
elseif is_plat("android") then
add_syslinks("m", "c")
elseif is_plat("macosx", "iphoneos") then
add_frameworks("Foundation")
else
add_syslinks("pthread", "dl", "m", "c")
end
-- add requires
add_requires("tbox", {configs = {xml = true}})
-- add option: demo
option("demo")
set_default(true)
set_showmenu(true)
set_category("option")
set_description("Enable or disable the demo module")
-- add projects
includes("src/itrace", "src/demo")