-- Copyright Epic Games, Inc. All Rights Reserved. target('zencore') set_kind("static") set_group("libs") add_options("zentrace", "zenmimalloc", "zenrpmalloc") add_headerfiles("**.h") add_configfiles("include/zencore/config.h.in") on_load(function (target) local version = io.readfile("VERSION.txt") version = string.gsub(version,"%-pre.*", "") target:set("version", version:trim(), {build = "%Y%m%d%H%M"}) end) set_configdir("include/zencore") add_files("**.cpp") add_files("trace.cpp", {unity_ignored = true }) if has_config("zenrpmalloc") then set_languages("c17", "cxx20") if is_os("windows") then add_cflags("/experimental:c11atomics") end add_defines("RPMALLOC_FIRST_CLASS_HEAPS=1", "ENABLE_STATISTICS=1", "ENABLE_OVERRIDE=0") add_files("$(projectdir)/thirdparty/rpmalloc/rpmalloc.c") end if has_config("zenmimalloc") then add_packages("vcpkg::mimalloc") end add_includedirs("include", {public=true}) add_includedirs("$(projectdir)/thirdparty/GetTimeSinceProcessStart") add_includedirs("$(projectdir)/thirdparty/utfcpp/source") add_includedirs("$(projectdir)/thirdparty/Oodle/include") add_includedirs("$(projectdir)/thirdparty/trace", {public=true}) add_includedirs("$(projectdir)/thirdparty/rpmalloc") if is_os("windows") then add_linkdirs("$(projectdir)/thirdparty/Oodle/lib/Win64") add_links("oo2core_win64") elseif is_os("linux") then add_linkdirs("$(projectdir)/thirdparty/Oodle/lib/Linux_x64") add_links("oo2corelinux64") add_syslinks("pthread") elseif is_os("macosx") then add_linkdirs("$(projectdir)/thirdparty/Oodle/lib/Mac_x64") add_links("oo2coremac64") end add_deps("zenbase") add_packages( "vcpkg::blake3", "vcpkg::json11", "vcpkg::ryml", "vcpkg::c4core", "vcpkg::openssl", -- required for crypto "vcpkg::spdlog") add_packages( "vcpkg::doctest", "vcpkg::eastl", "vcpkg::fmt", "vcpkg::gsl-lite", "vcpkg::lz4", "vcpkg::xxhash", {public=true} ) if has_config("zensentry") then add_packages("vcpkg::sentry-native") if is_plat("windows") then add_links("dbghelp", "winhttp", "version") -- for Sentry end if is_plat("linux") then -- As sentry_native uses symbols from breakpad_client, the latter must -- be specified after the former with GCC-like toolchains. xmake however -- is unaware of this and simply globs files from vcpkg's output. The -- line below forces breakpad_client to be to the right of sentry_native add_syslinks("breakpad_client") end if is_plat("macosx") then add_syslinks("bsm") end end if is_plat("linux") then add_syslinks("rt") end if is_plat("windows") then add_syslinks("Advapi32") add_syslinks("Dbghelp") add_syslinks("Shell32") add_syslinks("User32") add_syslinks("crypt32") add_syslinks("bcrypt") add_syslinks("ws2_32") end