aboutsummaryrefslogtreecommitdiff
path: root/zencore/xmake.lua
blob: 63e874ac5b60825a9c6c858217520def9983c87c (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
-- Copyright Epic Games, Inc. All Rights Reserved.

target('zencore')
    set_kind("static")
    add_headerfiles("**.h")
    add_configfiles("include/zencore/config.h.in")
    set_configdir("include/zencore")
    add_files("**.cpp")
    add_includedirs("include", {public=true})
    add_includedirs("$(projectdir)/thirdparty/utfcpp/source")
    add_includedirs("$(projectdir)/thirdparty/trace", {public=true})
    if is_os("windows") then
        add_linkdirs("$(projectdir)/thirdparty/BLAKE3/lib/Win64")
        add_linkdirs("$(projectdir)/thirdparty/Oodle/lib/Win64")
    elseif is_os("linux") then
        add_linkdirs("$(projectdir)/thirdparty/BLAKE3/lib/Linux_x64")
        add_linkdirs("$(projectdir)/thirdparty/Oodle/lib/Linux_x64")
        add_links("blake3")
        add_links("oo2corelinux64")
        add_syslinks("pthread")
    elseif is_os("macosx") then
        if is_arch("arm64") then
            add_linkdirs("$(projectdir)/thirdparty/BLAKE3/lib/Mac_arm64")
        else
            add_linkdirs("$(projectdir)/thirdparty/BLAKE3/lib/Mac_x64")
        end
        add_linkdirs("$(projectdir)/thirdparty/Oodle/lib/Mac_x64")
        add_links("blake3")
        add_links("oo2coremac64")
    end
    add_options("zentrace")
    add_packages(
        "vcpkg::spdlog", 
        "vcpkg::fmt",
        "vcpkg::doctest", 
        "vcpkg::catch2",
        "vcpkg::json11",
        "vcpkg::lz4",
        "vcpkg::mimalloc",
        "vcpkg::cpr",
        "vcpkg::curl",  -- required by cpr
        "vcpkg::zlib",  -- required by curl
        "vcpkg::openssl", -- required by curl
        "vcpkg::xxhash", 
        "vcpkg::gsl-lite")

    if is_plat("linux") then
        -- The 'vcpkg::openssl' package is two libraries; ssl and crypto, with
        -- ssl being dependent on symbols in crypto. When GCC-like linkers read
        -- object files from their command line, those object files only resolve
        -- symbols of objects previously encountered. Thus crypto must appear
        -- after ssl so it can fill out ssl's unresolved symbol table. Xmake's
        -- vcpkg support is basic and works by parsing .list files. Openssl's
        -- archives are listed alphabetically causing crypto to be _before_ ssl
        -- and resulting in link errors. The links are restated here to force
        -- xmake to use the correct order, and "syslinks" is used to force the
        -- arguments to the end of the line (otherwise they can appear before
        -- curl and cause more errors).
        add_syslinks("crypto")
        add_syslinks("dl")
    end

    if is_plat("linux") then
        add_syslinks("rt")
    end