forked from p-ranav/argparse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
89 lines (69 loc) · 2.24 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
set_xmakever("2.8.2")
set_project("argparse")
set_version("3.0.0", { build = "%Y%m%d%H%M" })
option("enable_module")
option("enable_std_import", { defines = "ARGPARSE_MODULE_USE_STD_MODULE" })
option("enable_tests")
option("enable_samples")
add_cxxflags(
"-Wall",
"-Wno-long-long",
"-pedantic",
"-Wsign-conversion",
"-Wshadow",
"-Wconversion",
{ toolsets = { "clang", "gcc" } }
)
add_cxxflags("cl::/W4")
if is_plat("windows") then
add_defines("_CRT_SECURE_NO_WARNINGS")
end
target("argparse", function()
set_languages("c++17")
set_kind("headeronly")
if get_config("enable_module") then
set_languages("c++20")
set_kind("static") -- static atm because of a XMake bug, headeronly doesn't generate package module metadata
end
add_options("enable_std_import")
add_includedirs("include", { public = true })
add_headerfiles("include/argparse/argparse.hpp")
if get_config("enable_module") then
add_files("module/argparse.cppm", { install = true })
end
end)
if get_config("enable_tests") then
target("argparse_tests", function()
set_kind("binary")
set_languages("c++17")
set_basename("tests")
add_includedirs("test")
add_files("test/main.cpp", { defines = { "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN" } })
add_files("test/**.cpp")
add_deps("argparse")
end)
if get_config("enable_module") then
target("argparse_module_tests", function()
set_kind("binary")
set_languages("c++20")
set_basename("module_tests")
add_defines("WITH_MODULE")
add_includedirs("test")
add_files("test/main.cpp", { defines = { "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN" } })
add_files("test/**.cpp")
add_files("test/argparse_details.cppm")
add_deps("argparse")
end)
end
end
if get_config("enable_samples") then
for _, sample_file in ipairs(os.files("samples/*.cpp")) do
target(path.basename(sample_file), function()
set_kind("binary")
set_languages("c++17")
add_files(sample_file)
set_policy("build.c++.modules", false)
add_deps("argparse")
end)
end
end