-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxmake.lua
More file actions
70 lines (60 loc) · 2.62 KB
/
xmake.lua
File metadata and controls
70 lines (60 loc) · 2.62 KB
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
set_project("CppUtils")
set_version("0.0.0", {build = "%Y%m%d%H%M"})
set_license("LGPL3")
set_languages("c++26")
set_warnings("allextra", "pedantic", "error")
add_cxflags("clang::-Wno-error=#warnings", "clang::-Wconversion", "clang::-Wfatal-errors", "clang::-Wno-deprecated-declarations -Wno-unknown-attributes")
add_cxflags("clang::-fcolor-diagnostics", "clang::-fansi-escape-codes", "gcc::-fdiagnostics-color=always")
-- add_cxflags("-Wno-gnu-statement-expression-from-macro-expansion -Wno-gnu-statement-expression", {tools = { "clang", "gcc" })
set_optimize("fastest")
add_cxxflags("clang::-fexperimental-library", {force = true}) -- Pour avoir std::jthread
add_cxxflags("cl::/EHsc", {force = true}) -- Pour avoir std::jthread
if is_plat("windows") and not is_plat("mingw") then
set_runtimes(is_mode("debug") and "MDd" or "MD")
add_defines("NOMINMAX", "VC_EXTRALEAN", "WIN32_LEAN_AND_MEAN", "_CRT_SECURE_NO_WARNINGS", { public = true })
add_cxflags("cl::/wd4251", {force = true}) -- ‘identifier’ : class ‘type’ needs to have dll-interface to be used by clients of class ‘type2’
add_syslinks("Ws2_32")
elseif is_plat("linux", "macosx") then
add_syslinks("pthread", "dl")
end
add_rules(
"mode.debug",
"mode.release",
"mode.releasedbg",
"mode.minsizerel",
"mode.check",
"mode.profile",
"mode.coverage",
"mode.valgrind")
option("compiler_verbose", {default = false, category = "Build CppUtils", description = "Verbose the compiler output"})
option("enable_moduleonly", {default = true, category = "Build CppUtils", description = "Module only"})
option("sanitize_memory", {default = false, category = "Build CppUtils/Sanitizer", description = "Enable ASan + LSan + UBSan"})
option("sanitize_thread", {default = false, category = "Build CppUtils/Sanitizer", description = "Enable TSan"})
option("enable_tests", {default = false, description = "Enable Unit Tests"})
target("CppUtils", function()
if get_config("enable_moduleonly") then
set_kind("moduleonly")
else
set_kind("$(kind)")
end
add_files("modules/**.mpp", { public = true })
add_includedirs("include", { public = true })
add_headerfiles("include/(CppUtils/**.hpp)")
add_headerfiles("include/(Stl/**.hpp)")
if get_config("compiler_verbose") then
add_cflags("-v")
add_cxxflags("-v")
add_ldflags("-v")
end
if get_config("sanitize_memory") then
set_policy("build.sanitizer.address", true) -- ASAN
set_policy("build.sanitizer.leak", true) -- LSan
set_policy("build.sanitizer.undefined", true) -- UBSan
end
if get_config("sanitize_thread") then
set_policy("build.sanitizer.thread", true) -- TSan
end
end)
if has_config("enable_tests") then
includes("tests")
end