Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathxmake.lua
More file actions
Latest commit
123 lines (112 loc) · 4.54 KB
/
Copy pathxmake.lua
File metadata and controls
123 lines (112 loc) · 4.54 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
includes("rules/*.lua")
add_rules("mode.debug", "mode.release")
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
add_repositories("groupmountain-repo https://github.com/GroupMountain/xmake-repo.git")
set_toolchains("clang-cl")
option("gmlib_dir")
set_default("")
set_showmenu(true)
set_description("Local GMLIB SDK directory (shared/ + static/); empty uses the remote package")
option_end()
localgmlib_dir=get_config("gmlib_dir")
iftype(gmlib_dir) ~="string" orgmlib_dir=="" then
gmlib_dir=nil
else
gmlib_dir=path.absolute(gmlib_dir)
end
add_requires("levilamina 161f166da9aa59272b4ea54d2c73b4bf33ec7d70", {configs= {target_type="server"}})
add_requires("zstr 1.0.8", "minizip-ng 4.0.9")
ifgmlib_dirthen
target("static")
set_kind("phony")
add_linkdirs(path.join(gmlib_dir, "static", "lib"), {public=true})
add_includedirs(path.join(gmlib_dir, "static", "include"), {public=true})
add_links("GMLIB", {public=true})
add_packages("zstr", "minizip-ng", {public=true})
target("shared")
set_kind("phony")
add_linkdirs(path.join(gmlib_dir, "shared", "lib"), {public=true})
add_includedirs(path.join(gmlib_dir, "shared", "include"), {public=true})
add_links("GMLIB", {public=true})
else
add_requires("gmlib 26.20.0")
end
ifnothas_config("vs_runtime") then
set_runtimes("MD")
end
target("ModAPI")
add_rules("linkrule")
add_cxflags(
"/EHsc",
"/utf-8",
"/W4",
"/w44265",
"/w44289",
"/w44296",
"/w45263",
"/w44738",
"/w45204",
"/we4297",
"/O2",
"/Ob3",
"/GR-",
"/Zo-"
)
add_defines(
"NOMINMAX",
"UNICODE",
"_HAS_CXX23=1",
"MODAPI_EXPORTS"
)
add_defines("LL_PLAT_S") --TODO: check client compatibility
add_packages("levilamina")
ifgmlib_dirthen
add_deps("static", "shared")
else
add_packages("gmlib")
end
set_optimize("aggressive")
set_exceptions("none")
set_kind("shared")
set_languages("c++20")
set_symbols("debug")
add_files("src/**.cpp", "src/**.rc")
add_includedirs("src", "include", "$(builddir)/config")
add_headerfiles("src/**.h", "include/**.h", "$(builddir)/config/**.h")
add_configfiles("$(projectdir)/include/(**.*.in)")
set_configdir("$(builddir)/config")
after_load(function (target)
localversion_info=import("scripts.get-version-info").get_version_info()
target:set("configvar", "MODAPI_VERSION_MAJOR", version_info.major)
target:set("configvar", "MODAPI_VERSION_MINOR", version_info.minor)
target:set("configvar", "MODAPI_VERSION_PATCH", version_info.patch)
ifversion_info.prereleasethen
target:set("configvar", "MODAPI_VERSION_PRERELEASE", version_info.prerelease)
end
os.exec("python ./scripts/header_file_patch.py \"" ..os.projectdir() .."\"\"" ..path.join(target:pkgs()["levilamina"]:get("installdir"), "include") .."\"")
end)
before_build(function (target)
os.exec("python ./scripts/include_correction.py ./ --internal include src build/config --silent")
os.exec("python ./scripts/format_all.py --silent")
end)
after_build(function (target)
localtarget_dir=path.join(os.projectdir(), "bin")
ifos.exists(target_dir) thenos.rmdir(target_dir) end
os.cp(target:targetfile(), path.join(target_dir, "dll", "ModAPI", "ModAPI.dll"))
os.cp(target:symbolfile(), path.join(target_dir, "pdb", "ModAPI.pdb"))
os.cp(path.join(target:targetdir(), path.basename(target:targetfile()) ..".lib"), path.join(target_dir, "lib", "ModAPI.lib"))
import("scripts.generate-manifest", { rootdir=os.projectdir() }).generate_manifest(
path.join(target_dir, "dll", "ModAPI", "manifest.json"),
{
name="ModAPI",
entry="ModAPI.dll",
version=import("scripts.get-version-info").get_version_info().version_str,
author="GroupMountain",
description="Group Mountain Mod API",
passive=is_mode("release")
}
)
os.mkdir(path.join(target_dir, "include"))
os.cp(path.join(os.projectdir(), "include", "**.h"), path.join(target_dir, "include"), { rootdir=path.join(os.projectdir(), "include") })
os.cp(path.join(os.projectdir(), "build", "config", "**.h"), path.join(target_dir, "include"), { rootdir=path.join(os.projectdir(), "build", "config") })
end)