Repository navigation
Expand file tree
/
Copy pathxmake.lua
More file actions
executable file
·137 lines (119 loc) · 3.54 KB
/
Copy pathxmake.lua
File metadata and controls
executable file
·137 lines (119 loc) · 3.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
set_project("ModelExtras")
add_rules("mode.debug", "mode.release")
set_defaultmode("release")
local PLUGIN_SDK_DIR = os.getenv("PLUGIN_SDK_DIR")
if not (PLUGIN_SDK_DIR and os.isdir(PLUGIN_SDK_DIR)) then
for _, dir in ipairs({"plugin-sdk", "../plugin-sdk", "../../plugin-sdk"}) do
if os.isdir(dir) then
PLUGIN_SDK_DIR = path.absolute(dir)
break
end
end
end
local GAME_DIR = os.getenv("GTASA_DIR") or "D:/Games/GTA San Andreas"
target("ModelExtras")
set_kind("shared")
set_filename("ModelExtras.asi")
set_languages("c++latest")
set_arch("x86")
set_plat("windows")
set_pcxxheader("src/pch.h")
add_defines(
"PLUGIN_SGV_10US",
"MODELEXTRAS_DEV",
"GTASA",
"RW",
"NOMINMAX",
"WIN32_LEAN_AND_MEAN",
"_USE_MATH_DEFINES"
)
add_includedirs(
PLUGIN_SDK_DIR,
path.join(PLUGIN_SDK_DIR, "plugin_sa"),
path.join(PLUGIN_SDK_DIR, "plugin_sa", "game_sa"),
path.join(PLUGIN_SDK_DIR, "plugin_sa", "game_sa", "enums"),
path.join(PLUGIN_SDK_DIR, "plugin_sa", "game_sa", "rw"),
path.join(PLUGIN_SDK_DIR, "shared"),
path.join(PLUGIN_SDK_DIR, "shared", "game"),
"include",
"src",
"src/features"
)
add_linkdirs(
path.join(PLUGIN_SDK_DIR, "output", "lib")
)
add_files(
"src/**.cpp"
)
add_syslinks(
"user32"
)
set_warnings("all")
add_cxflags(
"/options:strict",
"/Zc:__cplusplus",
"/Zc:preprocessor",
"/utf-8",
"/EHsc",
"/Gw",
"/Zc:threadSafeInit-",
"/Zc:inline",
"/Zc:throwingNew",
"/Zc:templateScope",
"/volatile:iso",
"/Qfast_transcendentals",
"/fp:contract",
"/fpcvt:IA",
"/Zc:enumTypes",
"/Zc:enumEncoding",
"/Zc:checkGwOdr"
)
add_shflags(
"/SAFESEH:NO",
"/LARGEADDRESSAWARE",
"/DYNAMICBASE:NO",
"/NXCOMPAT:NO",
"/MANIFEST:NO"
)
if is_mode("debug") then
add_links("plugin_d")
set_runtimes("MTd")
else
add_links("plugin")
set_runtimes("MT")
set_optimize("fastest")
set_symbols("hidden")
add_defines("_ITERATOR_DEBUG_LEVEL=0")
add_cxflags("/GL", "/Zo", "/Ob3", "/Oy-")
add_shflags("/INCREMENTAL:NO", "/LTCG", "/OPT:REF,ICF", "/RELEASE")
end
after_build(function (target)
if GAME_DIR and os.isdir(GAME_DIR) then
os.cp(target:targetfile(), GAME_DIR)
print(">> Deployed .asi to " .. GAME_DIR)
local symbolfile = target:symbolfile()
if symbolfile and os.isfile(symbolfile) then
os.cp(symbolfile, GAME_DIR)
print(">> Deployed .pdb to " .. GAME_DIR)
end
if os.isdir("resource/dist") then
os.cp("resource/dist/*", GAME_DIR)
print(">> Deployed resources to " .. GAME_DIR)
end
end
end)
task("dev")
set_menu {
usage = "xmake dev [options]",
description = "Configure and build ModelExtras",
options = {
{'m', "mode", "kv", "debug", "Set build mode: debug, release"}
}
}
on_run(function ()
import("core.base.option")
local mode = option.get("mode") or "debug"
os.execv("xmake", {"f", "-p", "windows", "-a", "x86", "-m", mode, "-y"})
os.execv("xmake", {})
os.execv("xmake", {"project", "-k", "compile_commands"})
end)