-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
xmake.lua
111 lines (98 loc) · 3.5 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
set_languages("cxx20")
set_arch("x64")
add_rules("mode.debug", "mode.release")
add_requires("spdlog 1.10.*", "nlohmann_json 3.11.*", "fmt 9.1.*")
add_defines("RED4EXT_STATIC_LIB")
target("RED4ext.SDK")
set_default(false)
set_kind("static")
set_group("vendor")
add_files("vendor/RED4ext.SDK/src/**.cpp")
add_headerfiles("vendor/RED4ext.SDK/include/**.hpp")
add_includedirs("vendor/RED4ext.SDK/include/", { public = true })
add_syslinks("User32")
target("cet_mod_manager")
set_default(false)
set_kind("shared")
set_filename("cet_mod_manager.dll")
add_packages("spdlog", "nlohmann_json", "fmt")
add_defines("UNICODE", "WIN32_LEAN_AND_MEAN")
add_files("src/CETMM/**.cpp", "src/Common/**.cpp")
add_headerfiles("src/CETMM/**.h", "src/Common/**.h")
add_includedirs("src/CETMM/", "src/Common/")
add_syslinks("Dwrite", "Shell32")
add_deps("RED4ext.SDK")
before_build(function ()
import("build")
build.UpdateVersion()
end)
target("installer")
set_kind("shared")
set_filename("cet_mod_manager.asi")
add_packages("spdlog", "nlohmann_json", "fmt")
add_defines("UNICODE", "WIN32_LEAN_AND_MEAN")
add_files("src/Installer/**.cpp", "src/Common/**.cpp")
add_headerfiles("src/Installer/**.h", "src/Common/**.h")
add_includedirs("src/Installer/", "src/Installer/embeds/lua/", "src/Installer/embeds/red4ext/", "src/Common/")
add_syslinks("Shell32")
on_package(function (target)
import("build")
build.Package(target)
end)
on_install(function ()
import("build")
build.Install()
end)
after_clean(function ()
import("build")
build.Clean()
end)
option("installpath")
set_showmenu(true)
set_description("Set the path to Cyberpunk 2077 root directory.", "e.g.", format("\t-xmake f --installpath=%s", [["C:\Program Files (x86)\Steam\steamapps\common\Cyberpunk 2077"]]))
task("run")
on_run(function ()
import("core.project.config")
config.load()
local install_path = config.get("installpath")
print("Launching Cyberpunk 2077 ...")
os.cd(path.join(install_path, "bin", "x64"))
os.run("Cyberpunk2077.exe")
end)
set_menu { usage = "xmake run", description = "Launch Cyberpunk 2077"}
task("embed")
on_run(function ()
import("build")
build.GenerateEmbeds()
end)
set_menu { usage = "xmake embed", description = "Generate embed files"}
task("install-lua")
on_run(function ()
import("build")
build.InstallLua()
end)
set_menu { usage = "xmake install-lua", description = "Only Package and install CET Mod Manager Lua files"}
task("install-ext")
on_run(function ()
import("build")
build.InstallExt()
end)
set_menu { usage = "xmake install-ext", description = "Only Package and install CET Mod Manager Red4ext plugin file"}
task("build-all")
on_run(function ()
import("build")
build.BuildAll()
end)
set_menu { usage = "xmake build-all", description = "Build all targets."}
task("update-ext")
on_run(function ()
local rootDir = os.curdir()
print("Pull RED4ext.SDK")
os.cd("./vendor/RED4ext.SDK")
os.execv("git", {"pull", "origin", "master"})
print("Commit changes")
os.cd(rootDir)
os.execv("git", {"add", "vendor/RED4ext.SDK"})
os.execv("git", {"commit", "-m", "Update RED4ext.SDK"})
end)
set_menu { usage = "xmake update-ext", description = "Update RED4ext.SDK."}