-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
256 lines (196 loc) · 8.88 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
set_xmakever("2.8.1")
set_allowedplats("windows", "linux")
set_arch("x64")
set_languages("cxx20", "c17")
add_rules("plugin.vsxmake.autoupdate")
if is_plat("windows") then
add_defines("UNICODE=1", "_UNICODE=1")
add_cxflags("/bigobj", "/utf-8", {tools = {"clang_cl", "cl"}})
add_cxflags("/MP", {tools = {"cl"}})
add_defines("_CRT_SECURE_NO_WARNINGS=1", "WIN32_LEAN_AND_MEAN=1", "NOMINMAX=1", "WINVER=_WIN32_WINNT_WIN10", "_WIN32_WINNT=_WIN32_WINNT_WIN10", "NTDDI=NTDDI_WIN10_19H1")
end
if is_plat("linux") then
add_cxflags("-stdlib=libc++", {tools = {"clang"}})
end
local vsRuntime = "MD"
set_policy("check.auto_ignore_flags", true)
set_policy("build.across_targets_in_parallel", true)
set_policy("build.ccache", true)
set_policy("build.warning", true)
if is_mode("debug") then
add_defines("_DEBUG")
set_symbols("debug")
set_optimize("none")
set_warnings("all")
set_policy("build.optimization.lto", false)
--add_cxflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_mxflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_ldflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_shflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_cxflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
--add_mxflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
--add_ldflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
--add_shflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
vsRuntime = vsRuntime.."d"
elseif is_mode("releasedbg") then
add_defines("_DEBUG")
set_symbols("debug")
set_optimize("fastest")
set_warnings("all")
set_policy("build.optimization.lto", true)
--add_cxflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_mxflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_ldflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_shflags("-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", {tools = {"clang", "gnu"}})
--add_cxflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
--add_mxflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
--add_ldflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
--add_shflags("/fsanitize=address", {tools = {"clang_cl", "cl"}})
vsRuntime = vsRuntime.."d"
elseif is_mode("release") then
add_defines("NDEBUG")
set_symbols("hidden")
set_strip("all")
set_optimize("fastest")
set_warnings("all", "error")
set_policy("build.optimization.lto", true)
end
add_cxflags("-Wno-microsoft-include", "-Wno-unused-command-line-argument", "-Wno-pragma-system-header-outside-header", {tools = {"clang_cl", "clang"}})
add_requireconfs("**", { configs = { debug = is_mode("debug"), shared = false } })
if is_plat("windows") then
set_runtimes(vsRuntime);
--add_requireconfs("**", { configs = { cxflags = "/fsanitize=address", mxflags = "/fsanitize=address", ldflags = "/fsanitize=address", shflags = "/fsanitize=address" } })
end
if is_plat("linux") then
--add_requireconfs("**", { configs = { cxflags = "-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", mxflags = "-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", ldflags = "-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak", shflags = "-fsanitize=address -fsanitize=hwaddress -fsanitize=thread -fsanitize=undefined -fsanitize=memory -fsanitize=leak" } })
end
add_requires("libsndfile 1.2.2", { configs = { shared = true } })
add_requires("xxhash v0.8.2")
add_requires("icu4c 73.2", { configs = { shared = true } })
--add_requires("catch2 v3.4.0")
--add_requires("tracy v0.9.1")
add_requires("toml++ v3.4.0", { configs = { header_only = true } })
add_requires("libsamplerate 22bd06eb114850ebe31981eb794d150a95439fef") -- 0.2.2 with extra patches
option("fbl-vendor-use-std-ranges")
set_default(true)
set_showmenu(true)
set_description("Use std::ranges")
set_category("Feldarian Base Library/Vendor")
option_end()
option("fbl-vendor-use-range-v3")
set_default(false)
set_showmenu(true)
set_description("Use range-v3")
set_category("Feldarian Base Library/Vendor")
option_end()
if has_config("fbl-use-utf-range-v3") then
add_requires("range-v3 0.12.0")
end
option("fbl-vendor-use-std-format")
set_default(true)
set_showmenu(true)
set_description("Use std::format")
set_category("Feldarian Base Library/Vendor")
option_end()
option("fbl-vendor-use-fmt")
set_default(false)
set_showmenu(true)
set_description("Use fmt")
set_category("Feldarian Base Library/Vendor")
option_end()
if has_config("fbl-use-utf-fmt") then
add_requires("fmt 10.1.1", { configs = { header_only = false } })
end
option("fbl-use-pcms16")
set_default(true)
set_showmenu(true)
set_description("Compile PCMS16 module into Feldarian Base Library.")
set_category("Feldarian Base Library/PCMS16")
option_end()
option("fbl-use-utf")
set_default(true)
set_showmenu(true)
set_description("Compile UTF module into Feldarian Base Library.")
set_category("Feldarian Base Library/UTF")
option_end()
add_requires("spdlog v1.12.0", { configs = { header_only = false, std_format = not has_config("fbl-use-utf-fmt"), fmt_external = has_config("fbl-use-utf-fmt"), noexcept = true } })
option("fbl-pcms16-use-adpcmxq")
add_deps("fbl-use-pcms16")
set_default(true)
set_showmenu(true)
set_description("Use ADPCM-XQ library for IMA ADPCM instead of libsndfile.")
set_category("Feldarian Base Library/PCMS16")
option_end()
if has_config("fbl-pcms16-use-adpcmxq") then
target("adpcm-xq")
set_version("0.4.0")
set_kind("static")
set_warnings("none")
add_includedirs("vendor/adpcm-xq", {public = true})
add_headerfiles("vendor/adpcm-xq/**.h")
add_files("vendor/adpcm-xq/**.c")
target_end()
end
if has_config("fbl-use-pcms16") then
target("BaseLibrary_PCMS16")
set_version("0.1.0")
set_kind("static")
set_options("fbl-use-pcms16", "fbl-pcms16-use-adpcmxq")
if has_config("fbl-pcms16-use-adpcmxq") then
add_defines("FBL_PCMS16_USE_ADPCMXQ=1")
add_deps("adpcm-xq", {private = true})
end
add_defines("FBL_USE_PCMS16=1", { public = true })
add_defines("ENABLE_SNDFILE_WINDOWS_PROTOTYPES=1")
add_includedirs("include", {public = false})
add_headerfiles("include/Feldarian/PCMS16/**.hpp")
add_files("src/PCMS16/**.cpp")
add_packages("libsndfile", "libsamplerate", "xxhash")
if has_config("fbl-vendor-use-std-ranges") then
add_defines("FBL_VENDOR_USE_STD_RANGES=1", { public = true })
end
if has_config("fbl-vendor-use-range-v3") then
add_defines("FBL_VENDOR_USE_RANGE_V3=1", { public = true })
add_packages("range-v3", { public = true })
end
target_end()
end
if has_config("fbl-use-utf") then
target("BaseLibrary_UTF")
set_version("0.1.0")
set_kind("headeronly")
set_options("fbl-use-utf", "fbl-use-utf-std-format", "fbl-use-utf-fmt", "fbl-use-utf-std-ranges", "fbl-use-utf-range-v3")
add_defines("FBL_USE_UTF=1", { public = true })
add_defines("TOML_EXCEPTIONS=0", { public = true })
add_includedirs("include", {public = false})
add_headerfiles("include/Feldarian/UTF/**.hpp")
--add_files("src/UTF/**.cpp")
add_packages("xxhash", "toml++", "icu4c", { public = true })
if has_config("fbl-vendor-use-std-format") then
add_defines("FBL_VENDOR_USE_STD_FORMAT=1", { public = true })
end
if has_config("fbl-vendor-use-fmt") then
add_defines("FBL_VENDOR_USE_FMT=1", { public = true })
add_packages("fmt", { public = true })
end
if has_config("fbl-vendor-use-std-ranges") then
add_defines("FBL_VENDOR_USE_STD_RANGES=1", { public = true })
end
if has_config("fbl-vendor-use-range-v3") then
add_defines("FBL_VENDOR_USE_RANGE_V3=1", { public = true })
add_packages("range-v3", { public = true })
end
target_end()
end
target("BaseLibrary")
set_version("0.1.0")
set_kind("phony")
set_options("fbl-use-pcms16", "fbl-use-utf")
add_includedirs("include", {public = true})
if has_config("fbl-use-pcms16") then
add_deps("BaseLibrary_PCMS16")
end
if has_config("fbl-use-utf") then
add_deps("BaseLibrary_UTF")
end
target_end()