diff options
| author | Per Larsson <[email protected]> | 2021-12-16 10:48:56 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-12-16 10:48:56 +0100 |
| commit | 611c103549e726bdbebe66b0d9a449adc50a642c (patch) | |
| tree | 05a091634301ede8e9fd847af031bc5d642c5ab2 /xmake.lua | |
| parent | Added trace scopes. (diff) | |
| download | zen-611c103549e726bdbebe66b0d9a449adc50a642c.tar.xz zen-611c103549e726bdbebe66b0d9a449adc50a642c.zip | |
A little better bundle task with trace support.
Diffstat (limited to 'xmake.lua')
| -rw-r--r-- | xmake.lua | 114 |
1 files changed, 75 insertions, 39 deletions
@@ -140,54 +140,90 @@ includes("zenserver", "zenserver-test") includes("zen") task("bundle") - on_run(function() - import("detect.tools.find_zip") - import("detect.tools.find_7z") - - -- copy files - local dirs = { - binaries = "./build/windows/x64/release", - bundles = "./build/bundles", - bundle = "./build/bundles/zenzerver-win64" + set_menu { + usage = "xmake bundle", + description = "Create Zip bundle from binaries (Windows Only)", + options = { + {nil, "withtrace", "k", nil, "Compiles with trace support"}, + } } + on_run(function() + import("core.base.option") + import("detect.tools.find_zip") + import("detect.tools.find_7z") + import("detect.sdks.find_vcpkgdir") - local files = { - dirs.binaries .. "/zenserver.exe", - dirs.binaries .. "/zenserver.pdb", - "./vcpkg_installed/x64-windows-static/tools/sentry-native/crashpad_handler.exe" - } + local zip_cmd = find_7z() + if not zip_cmd then + raise("unable to find zip tool") + end - os.mkdir(dirs.bundles) - os.mkdir(dirs.bundle) + local dirs = { + vcpkg = { + root = find_vcpkgdir(), + tools = "" + }, + sentry = { + root = "" + }, + package = { + root = "" + } + } - for _,file in ipairs(files) do - printf("copy '%s' -> '%s'\n", file, dirs.bundle) - os.cp(file, dirs.bundle) - end + if dirs.vcpkg.root == nil or dirs.vcpkg.root == "" then + raise("unable to find vcpkg root directory" ); + end - -- create archive - local bundle_name = "zenserver-win64.zip" + dirs.vcpkg.tools = dirs.vcpkg.root.."/installed/x64-windows-static/tools" + dirs.sentry.root = dirs.vcpkg.tools.."/sentry-native" - local zip_cmd = find_7z() - assert(zip_cmd) + dirs.package_root = "./build/packages/z" - local zip_args = {} - table.insert(zip_args, "a") - table.insert(zip_args, dirs.bundles .. "/" .. bundle_name) - table.insert(zip_args, dirs.bundle .. "/*.*") + local external_files = { + dirs.sentry.root.."/crashpad_handler.exe" + } - printf("creating bundle '%s'...", dirs.bundles .. "/" .. bundle_name) - os.runv(zip_cmd, zip_args) - os.rm(dirs.bundle) - - printf(" Ok!") - end) + dirs.package.root = "./build/packages/z" - set_menu { - usage = "xmake bundle", - description = "Create zip bundle from binaries", - options = {} - } + 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) task("runtest") set_menu { |