-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
84 lines (73 loc) · 2.75 KB
/
Copy pathxmake.lua
File metadata and controls
84 lines (73 loc) · 2.75 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
set_project("xsl")
set_xmakever("3.0.0")
set_version("0.1.0", { build = "%Y%m%d%H%M" })
-- add release , debug and coverage modes
add_rules(
"mode.debug",
"mode.release",
"mode.coverage",
"mode.valgrind",
"plugin.compile_commands.autoupdate",
{ outputdir = "." }
)
set_warnings("everything")
-- set_warnings("all", "error", 'pedantic', 'extra')
set_languages("cxx26")
if is_mode("release") then
set_optimize("fastest")
set_policy("build.optimization.lto", true)
end
-- dependency
add_requires("thread-pool", "cli11", "openssl3")
add_requires("asio")
-- log level
option("log_level")
do
set_default("trace")
set_description("Set the log level for the project.")
set_values("none", "trace", "debug", "info", "warning", "error", "critical")
after_check(function(option)
local log_level = option:value()
local log_levels = { "none", "trace", "debug", "info", "warning", "error", "critical" }
local log_level_map = {}
log_level_map[log_levels[1]] = "8"
log_level_map[log_levels[2]] = "QUILL_COMPILE_ACTIVE_LOG_LEVEL_TRACE_L1"
log_level_map[log_levels[3]] = "QUILL_COMPILE_ACTIVE_LOG_LEVEL_DEBUG"
log_level_map[log_levels[4]] = "QUILL_COMPILE_ACTIVE_LOG_LEVEL_INFO"
log_level_map[log_levels[5]] = "QUILL_COMPILE_ACTIVE_LOG_LEVEL_WARNING"
log_level_map[log_levels[6]] = "QUILL_COMPILE_ACTIVE_LOG_LEVEL_ERROR"
log_level_map[log_levels[7]] = "QUILL_COMPILE_ACTIVE_LOG_LEVEL_CRITICAL"
print("Setting log level to: " .. log_level)
option:add("defines", "QUILL_COMPILE_ACTIVE_LOG_LEVEL=" .. log_level_map[log_level], { public = true })
end)
end
includes("third_party")
target("prepare")
do
set_kind("static")
set_default(false)
add_files("src/log.cpp")
add_defines("XSL_UNDERLYING_EPOLL", { public = true })
add_includedirs("$(projectdir)/include", { public = true })
add_options("log_level", { public = true })
add_ldflags("-fuse-ld=mold", { force = true })
add_packages("openssl3", { public = true }, "quill", { public = true })
end
target("xsl")
do
set_kind("static")
add_deps("xsl_sys", "xsl_net", "xsl_coro", "xsl_wheel", "xsl_asio")
add_headerfiles("$(projectdir)/include/(xsl/**.h)")
add_includedirs("$(projectdir)/include", { public = true })
add_options("log_level", { public = true })
add_ldflags("-fuse-ld=mold", { force = true })
add_packages("openssl3", { public = true }, "quill", { public = true })
end
-- set_policy("build.sanitizer.thread", true)
-- set_policy("build.sanitizer.address", true)
-- set_policy("build.sanitizer.memory", true)
-- set_policy("build.sanitizer.leak", true)
-- set_policy("build.sanitizer.undefined", true)
includes("src")
includes("test")
includes("examples")