-- Copyright Epic Games, Inc. All Rights Reserved. target("zen") set_kind("binary") add_headerfiles("**.h") add_files("**.cpp") add_files("zen.cpp", {unity_ignored = true }) add_rules("utils.bin2c", {extensions = {".zip"}}) add_files(path.join(os.projectdir(), get_config("builddir") or get_config("buildir") or "build", "zen-frontend/zen-html.zip")) add_deps("zencore", "zenhttp", "zenremotestore", "zenstore", "zenutil") add_deps("zencompute", "zennet", "zentelemetry") add_deps("cxxopts", "fmt", "raw_pdb", "tourist") add_packages("json11") add_includedirs(".") add_defines("ZEN_EMBED_ZEN_HTML_ZIP=1") set_symbols("debug") on_load(function(target) local html_dir = path.join(os.projectdir(), "src/zen/frontend/html") local zip_dir = path.join(os.projectdir(), get_config("builddir") or get_config("buildir") or "build", "zen-frontend") local zip_path = path.join(zip_dir, "zen-html.zip") -- Check if zip needs regeneration local need_update = not os.isfile(zip_path) if not need_update then local zip_mtime = os.mtime(zip_path) for _, file in ipairs(os.files(path.join(html_dir, "**"))) do if os.mtime(file) > zip_mtime then need_update = true break end end end if need_update then print("Regenerating zen trace viewer frontend zip...") os.tryrm(zip_path) os.mkdir(zip_dir) import("detect.tools.find_7z") local cmd_7z = find_7z() if cmd_7z then os.execv(cmd_7z, {"a", "-bso0", zip_path, path.join(html_dir, "*")}) else import("detect.tools.find_zip") local zip_cmd = find_zip() if zip_cmd then local oldir = os.cd(html_dir) os.execv(zip_cmd, {"-r", "-q", zip_path, "."}) os.cd(oldir) else raise("Unable to find a suitable zip tool (need 7z or zip)") end end end end) if is_plat("windows") then add_files("zen.rc") add_ldflags("/subsystem:console,5.02", {force = true}) if not (get_config("toolchain") or ""):find("clang") then add_ldflags("/LTCG") end end if is_plat("macosx") then add_ldflags("-framework CoreFoundation") add_ldflags("-framework Foundation") add_ldflags("-framework Security") add_ldflags("-framework SystemConfiguration") end