diff options
| author | ruki <[email protected]> | 2017-08-15 11:07:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-15 11:07:53 +0800 |
| commit | ed80709acfcf740f48375512b1f6cf6a0b009d5c (patch) | |
| tree | 474f726b285e6e3f31df9d16273902661e62ce8f /core/src/tbox/xmake.lua | |
| parent | 19cc317957ebc1aa4654cff37118c74a0cfabe70 (diff) | |
remove tbox.pkg and add tbox files
Diffstat (limited to 'core/src/tbox/xmake.lua')
| -rw-r--r-- | core/src/tbox/xmake.lua | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/core/src/tbox/xmake.lua b/core/src/tbox/xmake.lua new file mode 100644 index 000000000..7c447968a --- /dev/null +++ b/core/src/tbox/xmake.lua @@ -0,0 +1,131 @@ +-- project +set_project("tbox") + +-- version +set_version("2.1.6") + +-- set warning all as error +set_warnings("all", "error") + +-- set language: c99, c++11 +set_languages("c99", "cxx11") + +-- add defines to config.h +add_defines_h("$(prefix)_OS_$(os:upper)") +add_defines_h("_GNU_SOURCE=1", "_REENTRANT") + +-- 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 + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") + + -- add defines for debug + add_defines("__tb_debug__") + + -- attempt to enable some checkers for pc + if is_mode("check") and is_arch("i386", "x86_64") then + add_cxflags("-fsanitize=address", "-ftrapv") + add_mxflags("-fsanitize=address", "-ftrapv") + add_ldflags("-fsanitize=address") + end + + -- enable coverage + if is_mode("coverage") then + add_cxflags("--coverage") + add_mxflags("--coverage") + add_ldflags("--coverage") + end +end + +-- the release or profile mode +if is_mode("release", "profile") then + + -- the release mode + if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- strip all symbols + set_strip("all") + + -- fomit the frame pointer + add_cxflags("-fomit-frame-pointer") + add_mxflags("-fomit-frame-pointer") + + -- the profile mode + else + + -- enable the debug symbols + set_symbols("debug") + + -- enable gprof + add_cxflags("-pg") + add_ldflags("-pg") + + end + + -- small or micro? + if is_option("small", "micro") then + + -- enable smallest optimization + set_optimize("smallest") + else + -- enable fastest optimization + set_optimize("fastest") + end + + -- attempt to add vector extensions + add_vectorexts("sse2", "sse3", "ssse3", "mmx") +end + +-- small or micro? +if is_option("small", "micro") then + + -- add defines for small + add_defines("__tb_small__") + + -- add defines to config.h + add_defines_h("$(prefix)_SMALL") +end + +-- for the windows platform (msvc) +if is_plat("windows") then + + -- add some defines only for windows + add_defines("NOCRYPT", "NOGDI") + + -- the release mode + if is_mode("release") then + + -- link libcmt.lib + add_cxflags("-MT") + + -- the debug mode + elseif is_mode("debug") then + + -- enable some checkers + add_cxflags("-Gs", "-RTC1") + + -- link libcmtd.lib + add_cxflags("-MTd") + end + + -- no msvcrt.lib + add_ldflags("-nodefaultlib:\"msvcrt.lib\"") +end + +-- include project sources +includes("src") |
