-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxmake.lua
115 lines (95 loc) · 3.94 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
set_project("New Game+")
set_version("1.1.10", {build="%y%m%d%H"})
set_plat("windows")
set_arch("x64")
set_languages("c++latest")
set_symbols("debug")
set_strip("all")
set_optimize("fastest")
set_runtimes("MD")
add_cxxflags("/GR-")
add_requires("lz4", "hopscotch-map", "semver", "wil")
local cp2077_path = os.getenv("CP2077_PATH")
target("New Game+")
includes("deps/sharedpunk")
set_default(true)
set_kind("shared")
set_filename("NewGamePlus.dll")
set_warnings("more")
add_files("src/**.cpp", "src/**.rc")
add_headerfiles("src/**.hpp")
add_includedirs("src/")
add_deps("cp2077-shared-data", "red4ext.sdk", "redlib", "archivexl", "tweakxl")
add_packages("lz4", "hopscotch-map", "semver", "wil")
add_syslinks("Version", "User32")
add_defines("WINVER=0x0601", "WIN32_LEAN_AND_MEAN", "NOMINMAX")
set_configdir("src")
add_configfiles("config/ProjectTemplate.hpp.in", {prefixdir="Config"})
add_configfiles("config/ProjectMetadata.rc.in", {prefixdir="Config"})
set_configvar("NAME", "New Game+")
set_configvar("DESC", "New Game+ for Cyberpunk 2077")
set_configvar("AUTHOR_NAME", "not_alphanine")
set_rundir(path.join(cp2077_path, "bin", "x64"))
on_package(function(target)
os.rm("packaging/*")
os.rm("packaging_pdb/*")
os.mkdir("packaging/red4ext/plugins/NewGamePlus")
os.mkdir("packaging/red4ext/plugins/NewGamePlus/redscript")
os.mkdir("packaging/red4ext/plugins/NewGamePlus/tweaks")
os.cp("LICENSE", "packaging/red4ext/plugins/NewGamePlus")
os.cp("THIRDPARTY_LICENSES", "packaging/red4ext/plugins/NewGamePlus")
os.cp("wolvenkit/packed/archive/pc/mod/*", "packaging/red4ext/plugins/NewGamePlus")
os.cp("scripting/*", "packaging/red4ext/plugins/NewGamePlus/redscript")
os.cp("tweaks/*", "packaging/red4ext/plugins/NewGamePlus/tweaks")
local target_file = target:targetfile()
os.cp(target_file, "packaging/red4ext/plugins/NewGamePlus")
os.mkdir("packaging_pdb/red4ext/plugins/NewGamePlus")
os.cp(path.join(
path.directory(target_file),
path.basename(target_file)..".pdb" -- Evil hack
), "packaging_pdb/red4ext/plugins/NewGamePlus")
end)
on_install(function(target)
local target_file = target:targetfile()
local plugin_folder = path.join(cp2077_path, "red4ext/plugins/NewGamePlus/")
os.mkdir(plugin_folder)
os.cp(target_file, plugin_folder)
os.cp(path.join(
path.directory(target_file),
path.basename(target_file)..".pdb" -- Evil hack #2
), plugin_folder)
cprint("${bright green}Installed plugin to "..plugin_folder)
end)
on_run(function(target)
os.run(path.join(cp2077_path, "bin", "x64", "Cyberpunk2077.exe"))
end)
target("red4ext.sdk")
set_default(false)
set_kind("headeronly")
set_group("deps")
add_headerfiles("deps/red4ext.sdk/vendor/**.h")
add_headerfiles("deps/red4ext.sdk/include/**.hpp")
add_includedirs("deps/red4ext.sdk/vendor/", { public = true })
add_includedirs("deps/red4ext.sdk/include/", { public = true })
target("redlib")
set_default(false)
set_kind("headeronly")
set_group("deps")
add_defines("NOMINMAX")
add_headerfiles("deps/redlib/vendor/**.hpp")
add_headerfiles("deps/redlib/include/**.hpp")
add_includedirs("deps/redlib/vendor/", { public = true })
add_includedirs("deps/redlib/include/", { public = true })
target("archivexl")
set_default(false)
set_kind("headeronly")
set_group("deps")
add_headerfiles("deps/archivexl/support/red4ext/**.hpp")
add_includedirs("deps/archivexl/support/red4ext/", { public = true })
target("tweakxl")
set_default(false)
set_kind("headeronly")
set_group("deps")
add_headerfiles("deps/tweakxl/support/red4ext/**.hpp")
add_includedirs("deps/tweakxl/support/red4ext/", { public = true })
add_rules("plugin.vsxmake.autoupdate")