This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
xmake.lua
121 lines (88 loc) · 2.5 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
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
-- project
set_project("gbox")
-- version
set_version("1.0.4")
set_xmakever("2.1.6")
-- 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")
-- the debug mode
if is_mode("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_mode("check") and is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
end
-- the release or profile is_mode
if is_mode("release", "profile") then
-- the release mode
if is_mode("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")
-- the profile mode
else
-- enable the debug symbols
set_symbols("debug")
end
-- smallest?
if is_option("smallest") then
-- enable smallest optimization
set_optimize("smallest")
else
-- enable fastest optimization
set_optimize("fastest")
end
-- attempt to add vector extensions
add_vectorexts("sse2", "sse3", "ssse3", "mmx")
end
-- smallest?
if is_option("smallest") then
-- add defines for small
add_defines("__tb_small__")
-- add defines to config.h
add_defines_h("$(prefix)_SMALL")
end
-- for the windows platform (msvc)
if is_plat("windows") then
-- the release mode
if is_mode("release") then
-- link libcmt.lib
add_cxflags("-MT")
-- the debug mode
elseif is_mode("debug") then
-- enable some checkers
add_cxflags("-Gs", "-RTC1")
-- link libcmtd.lib
add_cxflags("-MTd")
end
-- no msvcrt.lib
add_ldflags("-nodefaultlib:\"msvcrt.lib\"")
end
-- add option: demo
option("demo")
set_default(true)
set_showmenu(true)
set_category("option")
set_description("Enable or disable the demo module")
-- add packages
add_packagedirs("pkg")
-- add projects
add_subdirs("src/gbox")
if is_option("demo") then add_subdirs("src/demo") end