-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
109 lines (88 loc) · 3.19 KB
/
xmake.lua
File metadata and controls
109 lines (88 loc) · 3.19 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
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
set_project("cpp-toolbox")
set_version("0.1.0")
set_description("A tools box library for accelerating cpp programe developing.")
set_xmakever("2.7.0")
set_languages("c++17")
-- Set common compilation flags
add_rules("mode.debug", "mode.release", "mode.coverage", "mode.profile", "mode.asan", "mode.tsan", "mode.lsan",
"mode.ubsan")
set_policy("build.ccache", true)
includes("xmake/options.lua")
includes("xmake/flags.lua")
includes("xmake/common.lua")
-- Include and link directories
add_includedirs("src/include")
-- Dependencies: concurrentqueue and catch2
add_requires("concurrentqueue")
-- Define source files
local source_files = {"src/impl/cpp-toolbox/base/**.cpp",
"src/impl/cpp-toolbox/container/**.cpp",
"src/impl/cpp-toolbox/types/**.cpp",
-- "src/impl/cpp-toolbox/concurrent/**.cpp",
"src/impl/cpp-toolbox/utils/**.cpp",
"src/impl/cpp-toolbox/file/**.cpp",
"src/impl/cpp-toolbox/logger/**.cpp",
"src/impl/cpp-toolbox/io/**.cpp"}
-- Define the shared library target
target("cpp-toolbox")
add_rules("generate_export_header")
add_files(source_files)
add_headerfiles("src/include/(**.hpp)")
add_packages("concurrentqueue")
set_kind("shared")
if not is_plat("macosx") then
set_pcxxheader("src/impl/cpp-toolbox/pch.hpp")
end
add_defines("CPP_TOOLBOX_EXPORTS")
set_policy("build.optimization.lto", true)
-- Add thread library
add_syslinks(is_plat("windows") and "kernel32" or "pthread")
-- Set symbol visibility on non-Windows platforms
if not is_plat("windows") then
add_cxflags("-fvisibility=hidden")
else
add_cxflags("/utf-8")
end
-- Define the static library target
target("cpp-toolbox_static")
add_rules("generate_export_header")
add_files(source_files)
add_headerfiles("src/include/(**.hpp)")
add_packages("concurrentqueue")
set_kind("static")
if not is_plat("macosx") then
set_pcxxheader("src/impl/cpp-toolbox/pch.hpp")
end
add_defines("CPP_TOOLBOX_STATIC_DEFINE")
set_policy("build.optimization.lto", true)
-- Add thread library
add_syslinks(is_plat("windows") and "kernel32" or "pthread")
-- Set symbol visibility on non-Windows platforms
if not is_plat("windows") then
add_cxflags("-fvisibility=hidden")
else
add_cxflags("/utf-8")
end
-- Define tests if enabled
if has_config("tests") or has_config("developer") then
includes("test")
end
-- Build examples if enabled
if has_config("examples") or has_config("developer") then
includes("example")
end
-- Define tests if enabled
if has_config("benchmark") or has_config("developer") then
includes("benchmark")
end
-- Documentation with Doxygen
-- if has_config("docs") or has_config("developer") then
-- add_requires("doxygen", {
-- optional = true
-- })
-- target("docs")
-- set_kind("phony")
-- on_build(function(target)
-- os.exec("doxygen docs/Doxyfile")
-- end)
-- end