aboutsummaryrefslogtreecommitdiff
path: root/zenserver/xmake.lua
blob: bba9b6ba59e2564f5294c015cb7fd309ff0f61e5 (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
target("zenserver")
    set_kind("binary")
    add_files("**.cpp")
    add_deps("zencore", "zenhttp", "zenstore", "zenutil")
    add_includedirs(".")
    set_symbols("debug")

    if is_mode("release") then
        set_optimize("fastest")
    end

    if is_plat("windows") then
        add_ldflags("/subsystem:console,5.02")
        add_ldflags("/MANIFEST:EMBED")
        add_ldflags("/MANIFESTUAC:level='requireAdministrator'")
        add_ldflags("/LTCG")
    else
        del_files("windows/**")
    end

    add_options("vfs")
    
    add_packages(
        "vcpkg::sentry-native",             
        "vcpkg::sol2", 
        "vcpkg::lua",
        "vcpkg::asio",
        "vcpkg::json11",
        "vcpkg::http-parser"
    )

    add_packages(
        "vcpkg::cxxopts",
        "vcpkg::mimalloc")

    on_load(function(target) 
        local commit, err = os.iorun("git log -1 --format=\"%h-%cI\"")
        if commit ~= nil then
            commit = commit:gsub("%s+", "")
            commit = commit:gsub("\n", "")
            if is_mode("release") then
                commit = "rel-" .. commit
            else
                commit = "dbg-" .. commit
            end
            target:add("defines","BUILD_VERSION=\"" .. commit .. "\"")
            print("build version " .. commit)
        end
    end)