diff options
| author | ruki <[email protected]> | 2019-02-08 23:45:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-02-08 16:30:39 +0800 |
| commit | 9342904338fe355892decb82b8b9fc4d3273d9be (patch) | |
| tree | 5390b307c01374ea5722594dd1a0e682b45a8e4c /core/src/tbox/xmake.lua | |
| parent | 04f4888bf721d9d78b0feb56c392122966a36a4e (diff) | |
update tbox
Diffstat (limited to 'core/src/tbox/xmake.lua')
| -rw-r--r-- | core/src/tbox/xmake.lua | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/core/src/tbox/xmake.lua b/core/src/tbox/xmake.lua index 91730628c..a261cb80a 100644 --- a/core/src/tbox/xmake.lua +++ b/core/src/tbox/xmake.lua @@ -1,3 +1,6 @@ +-- set project version +set_version("1.6.3", {build = "%Y%m%d%H%M"}) + -- set warning all as error set_warnings("all", "error") @@ -5,19 +8,15 @@ set_warnings("all", "error") set_languages("c99", "cxx11") -- add defines to config.h -add_defines_h("$(prefix)_OS_$(os:upper)") -add_defines_h("_GNU_SOURCE=1", "_REENTRANT") +set_configvar("_GNU_SOURCE", 1) +set_configvar("_REENTRANT", 1) -- disable some compiler errors add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing") --- set the object files directory -set_objectdir("$(buildir)/$(mode)/$(arch)/.objs") -set_targetdir("$(buildir)/$(mode)/$(arch)") - --- the debug or check or coverage mode -if is_mode("debug", "check", "coverage") then +-- the debug, coverage, valgrind or sanitize-address/thread mode +if is_mode("debug", "coverage", "valgrind", "asan", "tsan") then -- enable the debug symbols set_symbols("debug") @@ -26,15 +25,29 @@ if is_mode("debug", "check", "coverage") then set_optimize("none") -- add defines for debug - if not is_mode("coverage") then + if is_mode("debug") then add_defines("__tb_debug__") end - -- attempt to enable some checkers for pc - if is_mode("check") and is_arch("i386", "x86_64") then + -- add defines for valgrind + if is_mode("valgrind") then + add_defines("__tb_valgrind__") + end + + -- attempt to enable sanitize-address + if is_mode("asan") then add_cxflags("-fsanitize=address", "-ftrapv") add_mxflags("-fsanitize=address", "-ftrapv") add_ldflags("-fsanitize=address") + add_defines("__tb_sanitize_address__") + end + + -- attempt to enable sanitize-thread + if is_mode("tsan") then + add_cxflags("-fsanitize=thread") + add_mxflags("-fsanitize=thread") + add_ldflags("-fsanitize=thread") + add_defines("__tb_sanitize_thread__") end -- enable coverage @@ -45,7 +58,7 @@ if is_mode("debug", "check", "coverage") then end end --- the release or profile mode +-- the release, profile mode if is_mode("release", "profile") then -- the release mode @@ -57,10 +70,6 @@ if is_mode("release", "profile") then -- strip all symbols set_strip("all") - -- fomit the frame pointer - add_cxflags("-fomit-frame-pointer") - add_mxflags("-fomit-frame-pointer") - -- the profile mode else @@ -70,18 +79,19 @@ if is_mode("release", "profile") then -- enable gprof add_cxflags("-pg") add_ldflags("-pg") - end -- small or micro? if has_config("small", "micro") then - - -- enable smallest optimization set_optimize("smallest") else - -- enable fastest optimization set_optimize("fastest") end + + -- disable stack protector for micro mode + if has_config("micro") then + add_cxflags("-fno-stack-protector") + end end -- small or micro? @@ -91,7 +101,7 @@ if has_config("small", "micro") then add_defines("__tb_small__") -- add defines to config.h - add_defines_h("$(prefix)_SMALL") + set_configvar("TB_CONFIG_SMALL", 1) end -- for the windows platform (msvc) @@ -118,6 +128,14 @@ if is_plat("windows") then -- no msvcrt.lib add_ldflags("-nodefaultlib:msvcrt.lib") + add_syslinks("ws2_32") + +elseif is_plat("android") then + add_syslinks("m", "c") +elseif is_plat("mingw") then + add_syslinks("ws2_32", "pthread", "m") +else + add_syslinks("pthread", "dl", "m", "c") end -- include project sources |
