-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
148 lines (124 loc) · 4.49 KB
/
Copy pathxmake.lua
File metadata and controls
148 lines (124 loc) · 4.49 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
add_rules("mode.debug", "mode.release")
add_repositories("levimc-repo https://github.com/LiteLDev/xmake-repo.git")
-- add_requires("levilamina x.x.x") for a specific version
-- add_requires("levilamina develop") to use develop version
-- please note that you should add bdslibrary yourself if using dev version
if is_config("target_type", "server") then
add_requires("levilamina 26.20.0", {configs = {target_type = "server"}})
else
add_requires("levilamina 26.20.0", {configs = {target_type = "client"}})
end
add_requires("levibuildscript")
if has_config("addon") then
add_requires("jspp main")
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("test")
set_default(false)
set_showmenu(true)
option_end()
option("addon")
set_default(false)
set_showmenu(true)
option_end()
target("DebugShape") -- Change this to your mod name.
add_rules("@levibuildscript/linkrule")
add_rules("@levibuildscript/modpacker")
if is_plat("windows") then
add_defines("NOMINMAX", "UNICODE")
set_exceptions("none") -- To avoid conflicts with /EHa.
add_cxflags( "/EHa", "/utf-8", "/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-missing-field-initializers",
"-Wno-potentially-evaluated-expression",
"-Wno-pragma-system-header-outside-header",
{tools = {"clang_cl"}}
)
set_toolchains("clang-cl")
end
add_packages("levilamina")
set_kind("shared")
set_languages("c++20")
set_symbols("debug")
add_headerfiles("src/(debug_shape/api/**.h)")
add_files("src/**.cpp", "src/**.cc")
add_includedirs("src")
if has_config("test") then
add_defines("DS_TEST")
add_includedirs("tests")
add_files("tests/**.cc")
end
if is_plat("windows") then
add_cxxflags("/wd4250", {force = true}) -- ignore warning C4250
end
if has_config("addon") then
add_packages("jspp")
add_defines("DS_ADDON")
add_files("src-addon/**.cc")
after_build(function (target)
local src_addon = os.projectdir().. "/src-addon"
local bin_dir = os.projectdir().. "/bin"
local bin_out_dir = bin_dir.. "/" .. target:name()
local dts_file = src_addon.."/*.d.ts";
os.cp(dts_file, bin_out_dir)
end)
end
if is_config("target_type", "server") then
add_defines("LL_PLAT_S")
else
add_defines("LL_PLAT_C")
end
package("jspp")
set_urls("https://github.com/engsr6982/jspp.git")
add_versions("2.0.0", "7ed577a4b7e0aa37cbf1bd23c86f148577082bae")
add_deps("cmake")
add_deps("quickjs-ng 0.13.0", { configs = { libc = true }, public = true })
on_install(function (package)
local configs = { "-DJSPP_BACKEND=quickjs" }
local quickjs = package:dep("quickjs-ng")
if quickjs then
local installdir = quickjs:installdir()
local incdir = path.join(installdir, "include")
local libdir = path.join(installdir, "lib")
table.insert(configs, "-DJSPP_EXTERNAL_INC=" .. incdir)
table.insert(configs, "-DJSPP_EXTERNAL_LIB=" .. libdir)
end
import("package.tools.cmake").build(package, configs)
local function install_headers(srcdir)
for _, f in ipairs(os.files(path.join(srcdir, "**.h"))) do
local rel = path.relative(f, srcdir)
os.cp(f, path.join(package:installdir("include"), rel))
end
for _, f in ipairs(os.files(path.join(srcdir, "**.inl"))) do
local rel = path.relative(f, srcdir)
os.cp(f, path.join(package:installdir("include"), rel))
end
end
install_headers("src")
install_headers("src-quickjs")
-- 安装库文件
local libfiles
if is_plat("windows") then
libfiles = os.files("bin/**.lib")
else
libfiles = os.files("bin/**.a")
end
for _, libfile in ipairs(libfiles) do
os.cp(libfile, package:installdir("lib"))
end
end)
package_end()