Repository navigation
Expand file tree
/
Copy pathxmake.lua
More file actions
123 lines (111 loc) · 4.71 KB
/
Copy pathxmake.lua
File metadata and controls
123 lines (111 loc) · 4.71 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
add_rules("mode.debug", "mode.release")
add_repositories("levimc-repo https://github.com/LiteLDev/xmake-repo.git")
option("target_type")
set_default("server")
set_showmenu(true)
set_values("server", "client")
option_end()
option("tests")
set_default(false)
set_showmenu(true)
set_description("Enable tests")
option_end()
-- 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
add_requires("levilamina 26.60.*", {configs = {target_type = get_config("target_type")}})
add_requires("levibuildscript")
if has_config("tests") then
add_requires("gtest")
end
-- ImGui HUD overlay (client only): Dear ImGui + minhook for the DXGI
-- Present hook that renders the info panel with a CJK-capable font. The
-- vanilla UI text pipeline cannot render Chinese names reliably on this GDK
-- build, so the client overlay draws through ImGui instead.
if (get_config("target_type") or "server") == "client" then
add_requires("imgui v1.91.9", {configs = {shared = false, win32 = true, dx11 = true, no_demo_windows = true}})
add_requires("minhook", {configs = {shared = false}})
end
if not has_config("vs_runtime") then
set_runtimes("MD")
end
target("Insight")
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_includedirs("src")
-- Platform selection. Common code lives in src/, platform code in
-- src-server/ (BDS) or src-client/ (GDK client / LeviLamina client).
local target_type = get_config("target_type") or "server"
if target_type == "client" then
add_defines("INSIGHT_TARGET_CLIENT")
add_includedirs("src-client")
add_packages("imgui", "minhook")
add_syslinks("user32", "d3d11", "d3d12", "dxgi", "imm32")
add_headerfiles("src/**.h", "src-client/**.h")
add_files("src/**.cpp", "src-client/**.cpp")
else
add_defines("INSIGHT_TARGET_SERVER")
add_includedirs("src-server")
add_headerfiles("src/**.h", "src-server/**.h")
add_files("src/**.cpp", "src-server/**.cpp")
end
-- Messages: lang/<locale>.json is loaded at runtime through
-- ll::i18n::getInstance().load(getSelf().getLangDir()). The modpacker rule
-- only copies the dll + manifest, so the folder is copied next to it here.
after_build(function (target)
local langdir = path.join(os.projectdir(), "lang")
if os.isdir(langdir) then
local outdir = path.join(os.projectdir(), "bin", target:name(), "lang")
os.mkdir(outdir)
os.cp(path.join(langdir, "*.json"), outdir)
cprint("${bright green}[Mod Packer]: ${reset}language files -> " .. outdir)
end
end)
-- Tests (LeviLamina's layout: src-test/common plus src-test/<side>, gtest, --tests=y):
-- xmake f -m debug --tests=y -y && xmake build test && xmake run test
-- Kept out of the mod target: gtest supplies its own main(), and a test run should not need a game.
target("test")
set_kind("binary")
set_default(false)
set_languages("c++20")
set_symbols("debug")
add_packages("gtest")
add_includedirs("src")
add_includedirs("src-test/common")
add_files("src-test/common/**.cpp")
-- The side's own tests are optional: src-test/<side> may be empty until the first one is written,
-- and an empty glob would only produce a warning.
local target_type = get_config("target_type") or "server"
local side_dir = path.join("src-test", target_type)
if os.isdir(side_dir) and #os.files(path.join(side_dir, "**.cpp")) > 0 then
add_includedirs(side_dir)
add_files(path.join(side_dir, "**.cpp"))
end
if is_plat("windows") then
add_defines("NOMINMAX", "UNICODE")
add_cxflags("/utf-8", "/W4", {tools = {"clang_cl"}})
set_toolchains("clang-cl")
end