-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
136 lines (113 loc) · 3.45 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
set_xmakever("2.8.7")
set_allowedmodes("releasedbg", "release", "debug")
add_rules("mode.debug")
set_project("moebius")
MOEBIUS_VERSION= "0.1"
local moe_files = {
"Data/History/**.cpp",
"Data/String/**.cpp",
"Data/Tree/**.cpp",
"Kernel/Types/**.cpp",
"Kernel/Abstractions/**.cpp",
"Scheme/**.cpp",
"moebius/**.cpp",
}
local moe_includedirs = {
"Data/History",
"Data/String",
"Data/Tree",
"Kernel/Types",
"Kernel/Abstractions",
"Scheme",
"Scheme/L1",
"Scheme/L2",
"Scheme/L3",
"Scheme/S7",
"Scheme/Scheme",
"$(projectdir)",
}
add_repositories("moe-repo xmake")
local DOCTEST_VERSION = "2.4.11"
add_requires("lolly")
local tbox_configs = {hash=true, ["force-utf8"]=true, charset=true}
add_requireconfs("lolly.tbox", {configs=tbox_configs, system = false, override=true})
add_requires("doctest " .. DOCTEST_VERSION, {system=false})
add_requires("nanobench", {system=false})
add_requires("s7")
target("libmoebius") do
set_kind ("static")
set_languages("c++17")
set_encodings("utf-8")
set_basename("moebius")
add_includedirs(moe_includedirs)
add_files(moe_files)
add_packages("lolly")
add_packages("s7")
add_headerfiles("Data/History/(*.hpp)")
add_headerfiles("Data/String/(*.hpp)")
add_headerfiles("Data/Tree/(*.hpp)")
add_headerfiles("Kernel/Types/(*.hpp)")
add_headerfiles("Kernel/Abstractions/(*.hpp)")
add_headerfiles("Scheme/(*.hpp)")
add_headerfiles("Scheme/L1/(*.hpp)")
add_headerfiles("Scheme/L2/(*.hpp)")
add_headerfiles("Scheme/L3/(*.hpp)")
add_headerfiles("Scheme/S7/(*.hpp)")
add_headerfiles("Scheme/Scheme/(*.hpp)")
add_headerfiles("moebius/(data/*.hpp)", {prefixdir="moebius"})
add_headerfiles("moebius/(drd/*.hpp)", {prefixdir="moebius"})
add_headerfiles("moebius/(*.hpp)", {prefixdir="moebius"})
end
target("tests") do
set_kind ("binary")
set_languages("c++17")
set_default (false)
add_deps("libmoebius")
add_includedirs(moe_includedirs)
add_includedirs("tests")
add_packages("lolly")
cpp_tests_on_all_plat = os.files("tests/**_test.cpp")
for _, testfile in ipairs(cpp_tests_on_all_plat) do
add_tests(path.basename(testfile), {
kind = "binary",
files = testfile,
packages = "doctest",
defines = "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN"})
end
end
target("bench_base")do
set_kind("object")
set_languages("c++17")
set_default (false)
set_policy("check.auto_ignore_flags", false)
add_packages("nanobench")
if is_plat("windows") then
set_encodings("utf-8")
end
add_files("bench/nanobench.cpp")
end
function add_bench_target(filepath)
local benchname = path.basename(filepath)
target(benchname) do
set_group("bench")
set_languages("c++17")
set_default(false)
set_policy("check.auto_ignore_flags", false)
set_rundir("$(projectdir)")
add_deps({"libmoebius", "bench_base"})
add_packages({"nanobench", "lolly"})
if is_plat("linux") then
add_syslinks("stdc++", "m")
end
if is_plat("windows") then
set_encodings("utf-8")
add_syslinks("secur32", "shell32")
end
add_includedirs(moe_includedirs)
add_files(filepath)
end
end
cpp_bench_on_all_plat = os.files("bench/**_bench.cpp")
for _, filepath in ipairs(cpp_bench_on_all_plat) do
add_bench_target (filepath)
end