-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathxmake.lua
162 lines (144 loc) · 5.2 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
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
add_rules("mode.debug", "mode.release")
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
if is_config("target_type", "server") then
add_requires("levilamina 1.0.0", {configs = {target_type = "server"}})
else
add_requires("levilamina 1.0.0", {configs = {target_type = "client"}})
end
add_requires("levibuildscript")
add_requires(
"demangler",
"dyncall",
"fmt",
"legacymoney 0.9.0-rc.1",
"legacyparticleapi 0.9.0-rc.1",
"legacyremotecall 0.9.0-rc.1",
"lightwebsocketclient",
"magic_enum",
"nlohmann_json",
"simpleini",
"sqlite3 3.43.0+200",
"toml++"
)
add_requires("cpp-httplib 0.14.3", {configs = {ssl = true, zlib = true}})
if is_config("backend", "lua") then
add_requires("mariadb-connector-c 3.3.9")
add_requires("scriptx main", {configs={backend="Lua"}})
elseif is_config("backend", "quickjs") then
add_requires("mariadb-connector-c 3.3.9")
add_requires("scriptx main", {configs={backend="QuickJs"}})
elseif is_config("backend", "python") then
add_requires("mariadb-connector-c 3.3.9")
add_requires("scriptx main", {configs={backend="Python"}})
elseif is_config("backend", "nodejs") then
add_requires("scriptx main", {configs={backend="V8"}})
end
if not has_config("vs_runtime") then
set_runtimes("MD")
end
option("target_type")
set_default("server")
set_showmenu(true)
set_values("server", "client")
option_end()
option("backend")
set_default("lua")
set_values("lua", "quickjs", "python", "nodejs")
target("legacy-script-engine")
add_rules("@levibuildscript/linkrule")
add_rules("@levibuildscript/modpacker")
add_cxflags("/EHa", "/utf-8", "/W4", "/w44265", "/w44289", "/w44296", "/w45263", "/w44738", "/w45204","/Zm2000", {force = true})
add_defines(
"NOMINMAX",
"UNICODE",
"_AMD64_"
)
add_packages(
"cpp-httplib",
"demangler",
"dyncall",
"fmt",
"legacymoney",
"legacyparticleapi",
"legacyremotecall",
"levilamina",
"lightwebsocketclient",
"magic_enum",
"nlohmann_json",
"scriptx",
"simpleini",
"sqlite3",
"toml++",
"mariadb-connector-c"
)
set_exceptions("none")
set_kind("shared")
set_languages("cxx20")
set_symbols("debug")
add_files(
"src/**.cpp"
)
add_includedirs(
"src",
"src/legacy"
)
if is_config("backend", "lua") then
add_defines(
"LEGACY_SCRIPT_ENGINE_BACKEND_LUA"
)
remove_files("src/legacy/main/NodeJsHelper.cpp")
remove_files("src/legacy/main/PythonHelper.cpp")
set_basename("legacy-script-engine-lua")
after_build(function(target)
local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.lua")
local langPath = path.join(os.projectdir(), "src/lang")
local outputPath = path.join(os.projectdir(), "bin/" .. target:name())
local baselibOutputPath = path.join(outputPath, "baselib")
os.mkdir(baselibOutputPath)
os.cp(baselibPath, baselibOutputPath)
os.cp(langPath, outputPath)
end)
elseif is_config("backend", "quickjs") then
add_defines(
"LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS"
)
remove_files("src/legacy/main/NodeJsHelper.cpp")
remove_files("src/legacy/main/PythonHelper.cpp")
set_basename("legacy-script-engine-quickjs")
after_build(function(target)
local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.js")
local langPath = path.join(os.projectdir(), "src/lang")
local outputPath = path.join(os.projectdir(), "bin/" .. target:name())
local baselibOutputPath = path.join(outputPath, "baselib")
os.mkdir(baselibOutputPath)
os.cp(baselibPath, baselibOutputPath)
os.cp(langPath, outputPath)
end)
elseif is_config("backend", "python") then
add_defines(
"LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON"
)
remove_files("src/legacy/main/NodeJsHelper.cpp")
set_basename("legacy-script-engine-python")
after_build(function(target)
local baselibPath = path.join(os.projectdir(), "src/baselib/BaseLib.py")
local langPath = path.join(os.projectdir(), "src/lang")
local outputPath = path.join(os.projectdir(), "bin/" .. target:name())
local baselibOutputPath = path.join(outputPath, "baselib")
os.mkdir(baselibOutputPath)
os.cp(baselibPath, baselibOutputPath)
os.cp(langPath, outputPath)
end)
elseif is_config("backend", "nodejs") then
add_defines(
"LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS"
)
remove_files("src/legacy/main/PythonHelper.cpp")
remove_files("src/legacy/legacyapi/db/impl/mysql/*.cpp")
set_basename("legacy-script-engine-nodejs")
after_build(function(target)
local langPath = path.join(os.projectdir(), "src/lang")
local outputPath = path.join(os.projectdir(), "bin/" .. target:name() .. "/lang")
os.cp(langPath, outputPath)
end)
end