Skip to content

Commit ae92a79

Browse files
committed
Update xmake.lua
1 parent bbe466f commit ae92a79

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

xmake.lua

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,43 @@ set_project("frozen")
33

44
set_version("1.1.0", { build = "%Y%m%d%H%M" })
55

6-
option("enable_module", { defines = "EXAMPLES_USE_MODULE" })
7-
option("enable_std_import", { defines = "FROZEN_DONT_INCLUDE_STL" })
8-
option("enable_tests")
9-
option("enable_benchmark")
6+
option("modules", { defines = "EXAMPLES_USE_MODULE" })
7+
option("std_import", { defines = "FROZEN_DONT_INCLUDE_STL" })
8+
option("tests", {default = false})
9+
option("benchmark", {default = false})
10+
11+
local kind = "static"
12+
if xmake:version():ge("2.8.7") then
13+
kind = "moduleonly"
14+
end
1015

1116
target("frozen", function()
1217
set_languages("c++latest")
13-
set_kind("headeronly")
14-
if get_config("enable_module") then
15-
set_kind("static") -- static atm because headeronly doesn't generate package metadata, a fix is incoming
18+
if get_config("modules") then
19+
set_kind(kind)
20+
else
21+
set_kind("headeronly")
1622
end
1723

1824
add_includedirs("include", { public = true })
1925
add_headerfiles("include/(frozen/**.h)")
2026

21-
add_options("enable_std_import")
27+
add_options("std_import")
2228

23-
if get_config("enable_module") then
29+
if get_config("modules") then
2430
add_files("module/frozen.cppm", { public = true })
2531
end
2632
end)
2733

28-
if get_config("enable_benchmark") then
34+
if get_config("benchmark") then
2935
add_requires("benchmark")
3036
target("frozen.benchmark", function()
3137
set_kind("binary")
3238
set_languages("c++17")
3339

3440
add_files("benchmarks/**.cpp")
3541

36-
if not get_config("enable_benchmark_str_search") then
42+
if not get_config("benchmark_str_search") then
3743
remove_files("benchmarks/bench_str_search.cpp")
3844
end
3945

@@ -43,7 +49,7 @@ if get_config("enable_benchmark") then
4349
end)
4450
end
4551

46-
if get_config("enable_tests") then
52+
if get_config("tests") then
4753
target("frozen.tests", function()
4854
set_kind("binary")
4955
set_languages("c++latest")
@@ -92,7 +98,7 @@ if get_config("enable_tests") then
9298

9399
add_deps("frozen")
94100

95-
add_options("enable_module")
101+
add_options("modules")
96102

97103
if path.basename(example) == "html_entities_map" then
98104
add_cxxflags("-fconstexpr-steps=123456789", { tools = "clang" })

0 commit comments

Comments
 (0)