forked from LiteLDev/LeviLamina
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
192 lines (176 loc) · 4.95 KB
/
xmake.lua
File metadata and controls
192 lines (176 loc) · 4.95 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
add_rules("mode.debug", "mode.release")
includes("scripts/localbdslibrary.lua")
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
-- Dependencies from xmake-repo.
add_requires("entt 3.12.2")
add_requires("expected-lite v0.6.3")
add_requires("fmt 10.1.1")
add_requires("gsl 4.0.0")
add_requires("leveldb 1.23")
add_requires("magic_enum 0.9.0")
add_requires("nlohmann_json 3.11.2")
add_requires("rapidjson 1.1.0")
add_requires("mimalloc 2.1.2")
-- Dependencies from liteldev-repo.
add_requires("ctre 3.8.1")
add_requires("pcg_cpp 1.0.0")
add_requires("pfr 2.1.1")
add_requires("demangler v17.0.7")
add_requires("preloader 1.5.0")
add_requires("symbolprovider 1.1.0")
if has_config("tests") then
add_requires("gtest 1.12.1")
end
if has_config("localbdslibrary") then
add_requires("localbdslibrary")
else
add_requires("bdslibrary 1.20.61.01")
end
if not has_config("vs_runtime") then
set_runtimes("MD")
end
option("tests")
set_default(false)
set_showmenu(true)
set_description("Enable tests")
option("localbdslibrary")
set_default(false)
set_showmenu(true)
set_description("Use local bdslibrary")
target("LeviLamina")
add_configfiles(
"src/(ll/core/Version.h.in)"
)
add_cxflags(
"/utf-8",
"/permissive-",
"/EHa",
"/W4",
"/w44265",
"/w44289",
"/w44296",
"/w45263",
"/w44738",
"/w45204"
)
add_cxflags(
"/EHs",
"-Wno-microsoft-cast",
"-Wno-invalid-offsetof",
"-Wno-c++2b-extensions",
"-Wno-microsoft-include",
"-Wno-overloaded-virtual",
"-Wno-ignored-qualifiers",
"-Wno-potentially-evaluated-expression",
"-Wno-pragma-system-header-outside-header",
{tools = {"clang_cl"}}
)
add_defines(
"_AMD64_",
"_CRT_SECURE_NO_WARNINGS",
"_ENABLE_CONSTEXPR_MUTEX_CONSTRUCTOR",
"NOMINMAX",
"UNICODE",
"WIN32_LEAN_AND_MEAN",
"ENTT_PACKED_PAGE=128",
{ public = true }
)
add_defines(
"LL_EXPORT",
"_HAS_CXX23=1" -- work around
)
add_files(
"src/ll/api/**.cpp",
"src/ll/core/**.cpp",
"src/ll/core/**.rc",
"src/mc/**.cpp"
)
add_headerfiles(
"src/(ll/api/**.h)",
"src/(mc/**.h)"
)
add_includedirs(
"src",
"$(buildir)/config"
)
add_packages(
"entt",
"expected-lite",
"fmt",
"gsl",
"leveldb",
"magic_enum",
"nlohmann_json",
"rapidjson",
"ctre",
"pcg_cpp",
"pfr",
"demangler",
"preloader",
"symbolprovider",
"mimalloc",
{ public = true }
)
add_shflags(
"/DELAYLOAD:bedrock_server.dll",
{ public = true }
)
set_configdir("$(buildir)/config")
set_configvar("LL_WORKSPACE_FOLDER", "$(projectdir)")
set_exceptions("none")
set_kind("shared")
set_languages("c++20")
set_pcxxheader("src/ll/api/Global.h")
set_symbols("debug")
if has_config("tests") then
add_packages("gtest")
add_defines("LL_DEBUG")
add_files("src/ll/test/**.cpp")
before_build(function (target)
headers = ""
for _,x in ipairs(os.files("src/**.h")) do
headers = headers.."#include \""..path.relative(x, "src/").."\"\n"
end
file = io.open("src/ll/test/include_all.cpp", "w")
file:write(headers)
file:close()
end)
after_build(function (target)
io.writefile("src/ll/test/include_all.cpp", "// auto gen when build test\n")
end)
end
if is_mode("debug") then
add_defines("LL_DEBUG")
end
if has_config("localbdslibrary") then
add_packages("localbdslibrary")
else
add_packages("bdslibrary")
end
on_config(function (target)
-- vs_runtime can not be set to MDd or MTd.
if has_config("vs_runtime") and (get_config("vs_runtime"):endswith("d")) then
raise("LeviLamina: vs_runtime can not be set to MDd or MTd")
end
end)
on_load(function (target)
local tag = os.iorun("git describe --tags --abbrev=0 --always")
local major, minor, patch, suffix = tag:match("v(%d+)%.(%d+)%.(%d+)(.*)")
if not major then
print("Failed to parse version tag, using 0.0.0")
major, minor, patch = 0, 0, 0
end
if suffix then
prerelease = suffix:match("-(.*)")
if prerelease then
prerelease = prerelease:gsub("\n", "")
end
if prerelease then
target:set("configvar", "LL_VERSION_PRERELEASE", prerelease)
end
end
target:set("configvar", "LL_VERSION_MAJOR", major)
target:set("configvar", "LL_VERSION_MINOR", minor)
target:set("configvar", "LL_VERSION_PATCH", patch)
end)
target_end()