aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/xmake.lua
blob: 9a67175a0f4bf59229b5bccea7ca14972fd4e6af (plain) (blame)
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
-- Copyright Epic Games, Inc. All Rights Reserved.

target('zencore')
    set_kind("static")
    set_group("libs")
    add_options("zentrace", "zenmimalloc", "zenrpmalloc")
    add_headerfiles("**.h")
    add_includedirs("include", {public=true})
    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
        add_deps("rpmalloc")
    end

    if has_config("zenmimalloc") then
        add_packages("mimalloc")
    end

    add_deps("zenbase")
    add_deps("spdlog")
    add_deps("utfcpp")
    add_deps("oodle")
    add_deps("blake3")
    add_deps("ue-trace")
    add_deps("timesinceprocessstart")
    add_deps("doctest")
    add_deps("fmt")
    add_packages("json11")

    if is_plat("linux", "macosx") then
        add_packages("openssl3") -- required for crypto
    end
    
    add_packages(
        "gsl-lite",
        "eastl",
        "lz4",
        "xxhash",
        {public=true}
    )

    if has_config("zensentry") then
        add_packages("sentry-native")

        if is_os("windows") then
            add_cxxflags("/wd4996")
        else
            add_cxxflags("-Wno-deprecated-declarations")    -- temporary workaround for sentry-native deprecation warnings
        end

        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