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
|
-- Copyright Epic Games, Inc. All Rights Reserved.
local function bundle_windows()
import("core.base.option")
import("detect.tools.find_zip")
import("detect.tools.find_7z")
import("detect.sdks.find_vcpkgdir")
local zip_cmd = find_7z()
if not zip_cmd then
raise("unable to find zip tool")
end
local dirs = {
vcpkg = {
root = find_vcpkgdir(),
tools = ""
},
sentry = {
root = ""
},
package = {
root = ""
}
}
if dirs.vcpkg.root == nil or dirs.vcpkg.root == "" then
raise("unable to find vcpkg root directory" );
end
dirs.vcpkg.tools = dirs.vcpkg.root.."/installed/x64-windows-static/tools"
dirs.sentry.root = dirs.vcpkg.tools.."/sentry-native"
dirs.package_root = "./build/packages/z"
local external_files = {
dirs.sentry.root.."/crashpad_handler.exe"
}
dirs.package.root = "./build/packages/z"
dirs.package.zenserver = {
root = dirs.package.root.."/zenserver",
windows = dirs.package.root.."/zenserver/windows/x64/release/bin"
}
local config = "-c -m release -a x64"
if option.get("withtrace") then
config = config.." --zentrace=yes"
end
print(os.exec("xmake config "..config))
print(os.exec("xmake build zenserver"))
print(os.exec("xmake package -f local zenserver"))
-- copy extenral file(s)
for _,file in ipairs(external_files) do
printf("copy '%s' -> '%s'\n", file, dirs.package.zenserver.windows)
os.cp(file, dirs.package.zenserver.windows.."/")
end
-- create zip file
local bundle_name = "zenserver-win64.zip"
if option.get("withtrace") then
bundle_name = "zenserver-trace-win64.zip"
end
local bundle_path = dirs.package.zenserver.root.."/"..bundle_name
local zip_args = {}
table.insert(zip_args, "a")
table.insert(zip_args, bundle_path)
table.insert(zip_args, dirs.package.zenserver.windows.."/*.*")
print(string.format("creating bundle '%s' from '%s'\n",bundle_path, dirs.package.zenserver.windows.."/"))
os.runv(zip_cmd, zip_args)
print(string.format("bundle '%s' ok!", bundle_name))
end
function main()
if is_host("windows") then
return bundle_windows()
end
raise("'xmake bundle' not currently supported on this platform")
end
|