forked from tiltedphoques/TiltedEvolution
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmake.lua
141 lines (115 loc) · 4.4 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
set_xmakever("2.8.5")
-- If newer version of xmake, remove ccache until it actually works
if set_policy ~= nil then
set_policy("build.ccache", false)
end
-- c code will use c99,
set_languages("c99", "cxx20")
if is_plat("windows") then
add_cxflags("/bigobj")
add_syslinks("kernel32")
set_arch("x64")
end
if is_plat("linux") then
add_cxflags("-fPIC")
end
set_warnings("all")
add_vectorexts("sse", "sse2", "sse3", "ssse3")
add_vectorexts("neon")
-- build configurations
add_rules("mode.debug", "mode.releasedbg")
if has_config("unitybuild") then
add_rules("c.unity_build")
add_rules("c++.unity_build", {batchsize = 12})
end
add_requires(
"entt v3.10.0",
"recastnavigation v1.6.0",
"tiltedcore v0.2.7",
"cryptopp 8.9.0",
"spdlog v1.13.0",
"cpp-httplib 0.14.0",
"gtest v1.14.0",
"mem 1.0.0",
"glm 0.9.9+8",
"sentry-native 0.7.1",
"zlib v1.3.1")
add_requireconfs("cpp-httplib", {configs = {ssl = true}})
add_requireconfs("sentry-native", { configs = { backend = "crashpad" } })
--[[
add_requireconfs("magnum", { configs = { sdl2 = true }})
add_requireconfs("magnum-integration", { configs = { imgui = true }})
add_requireconfs("magnum-integration.magnum", { configs = { sdl2 = true }})
add_requireconfs("magnum-integration.imgui", { override = true })
--]]
if is_plat("windows") then
add_requires(
"discord 3.2.1",
"imgui v1.89.7"
)
end
before_build(function (target)
import("modules.version")
local branch, commitHash = version()
bool_to_number={ [true]=1, [false]=0 }
local contents = string.format([[
#pragma once
#define IS_MASTER %d
#define IS_BRANCH_BETA %d
#define IS_BRANCH_PREREL %d
]],
bool_to_number[branch == "master"],
bool_to_number[branch == "bluedove"],
bool_to_number[branch == "prerel"])
io.writefile("build/BranchInfo.h", contents)
end)
if is_mode("debug") then
add_defines("DEBUG")
end
if is_plat("windows") then
add_defines("NOMINMAX")
end
-- add projects
includes("Libraries")
includes("Code")
task("upload-symbols")
on_run(function ()
import("core.base.option")
local key = option.get('key')
local linux = option.get('linux')
if key ~= nil then
import("net.http")
import("core.project.config")
config.load()
local sentrybin = path.join(os.projectdir(), "build", "sentry-cli.exe")
if not os.exists(sentrybin) then
http.download("https://github.com/getsentry/sentry-cli/releases/download/2.0.2/sentry-cli-Windows-x86_64.exe", sentrybin)
end
if linux then
-- linux server bins
local file_path = path.join(os.projectdir(), "build", "linux", "x64", "SkyrimTogetherServer.debug")
os.execv(sentrybin, {"--auth-token", key, "upload-dif", "-o", "together-team", "-p", "st-server", file_path})
file_path = path.join(os.projectdir(), "build", "linux", "x64", "libSTServer.debug")
os.execv(sentrybin, {"--auth-token", key, "upload-dif", "-o", "together-team", "-p", "st-server", file_path})
end
-- windows bins
if not linux then
local file_path = path.join(os.projectdir(), "build", config.get("plat"), config.get("arch"), config.get("mode"), "SkyrimTogether.pdb")
os.execv(sentrybin, {"--auth-token", key, "upload-dif", "-o", "together-team", "-p", "st-reborn", file_path})
file_path = path.join(os.projectdir(), "build", config.get("plat"), config.get("arch"), config.get("mode"), "SkyrimTogetherServer.pdb")
os.execv(sentrybin, {"--auth-token", key, "upload-dif", "-o", "together-team", "-p", "st-server", file_path})
file_path = path.join(os.projectdir(), "build", config.get("plat"), config.get("arch"), config.get("mode"), "STServer.pdb")
os.execv(sentrybin, {"--auth-token", key, "upload-dif", "-o", "together-team", "-p", "st-server", file_path})
end
else
print("An API key is required to proceed!")
end
end)
set_menu {
usage = "xmake upload-symbols",
description = "Upload symbols to sentry",
options = {
{'k', "key", "kv", nil, "The API key to use." },
{'l', "linux", "v", false, "Upload linux symbols that were manually copied." },
}
}