summaryrefslogtreecommitdiff
path: root/xmake/templates/c++/tbox.shared/project/xmake.lua
blob: f2dec7a8356c928a1941298911a9bbe1c1619398 (plain)
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
-- version
set_xmakever("2.2.5")

-- set warning all as error
set_warnings("all", "error")

-- set language: c99, c++11
set_languages("c99", "cxx11")

-- disable some compiler errors
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")

-- the debug mode
if is_mode("debug") then
    
    -- enable the debug symbols
    set_symbols("debug")

    -- disable optimization
    set_optimize("none")

    -- add defines for debug
    add_defines("__tb_debug__")
end

-- the release mode
if is_mode("release") then

    -- set the symbols visibility: hidden
    set_symbols("hidden")

    -- strip all symbols
    set_strip("all")

    -- enable fastest optimization
    set_optimize("fastest")
end

-- for the windows platform (msvc)
if is_plat("windows") then 

    -- the release mode
    if is_mode("release") then

        -- link libcmt.lib
        add_cxflags("-MT")

    -- the debug mode
    elseif is_mode("debug") then

        -- link libcmtd.lib
        add_cxflags("-MTd")
    end

    -- no msvcrt.lib
    add_ldflags("-nodefaultlib:msvcrt.lib")
end

-- add syslinks
if is_plat("windows") then add_syslinks("ws2_32")
elseif is_plat("android") then add_syslinks("m", "c")
else add_syslinks("pthread", "dl", "m", "c") end

-- add requires
add_requires("tbox", {debug = is_mode("debug")})

-- include project sources
includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")

${FAQ}