diff options
| author | ruki <[email protected]> | 2016-07-01 11:24:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-01 11:24:38 +0800 |
| commit | b72b984b4e3a2d434de4e590f2b1c053baa2d8ab (patch) | |
| tree | 7e214f2517f4dcc4ee22c398a91206dc43250206 | |
| parent | 65d6fd75bb258723b17df3bea466b63b97e229d8 (diff) | |
update template with tbox
6 files changed, 132 insertions, 150 deletions
diff --git a/xmake/templates/c++/console_tbox/project/xmake.lua b/xmake/templates/c++/console_tbox/project/xmake.lua index 9fc47c0ea..14559a49f 100644 --- a/xmake/templates/c++/console_tbox/project/xmake.lua +++ b/xmake/templates/c++/console_tbox/project/xmake.lua @@ -10,9 +10,12 @@ set_languages("c99", "cxx11") -- disable some compiler errors add_cxflags("-Wno-error=deprecated-declarations") add_mxflags("-Wno-error=deprecated-declarations") + +-- add defines for c files +add_defines("_GNU_SOURCE=1", "_REENTRANT") --- the debug mode -if is_mode("debug") then +-- the debug or check or coverage mode +if is_mode("debug", "check", "coverage") then -- enable the debug symbols set_symbols("debug") @@ -24,14 +27,21 @@ if is_mode("debug") then add_defines("__tb_debug__") -- attempt to enable some checkers for pc - if is_arch("i386", "x86_64") then + 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 is_mode +-- the release or profile mode if is_mode("release", "profile") then -- the release mode @@ -53,37 +63,24 @@ if is_mode("release", "profile") then -- enable the debug symbols set_symbols("debug") + -- enable gprof + add_cxflags("-pg") + add_ldflags("-pg") end - -- for pc - if is_arch("i386", "x86_64") then - - -- enable fastest optimization - set_optimize("fastest") - - -- for embed - else - -- enable smallest optimization - set_optimize("smallest") - end + -- enable fastest optimization + set_optimize("fastest") -- attempt to add vector extensions add_vectorexts("sse2", "sse3", "ssse3", "mmx") end --- for embed -if not is_arch("i386", "x86_64") 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 diff --git a/xmake/templates/c++/shared_library_tbox/project/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/xmake.lua index 84286fdfc..770ea866d 100644 --- a/xmake/templates/c++/shared_library_tbox/project/xmake.lua +++ b/xmake/templates/c++/shared_library_tbox/project/xmake.lua @@ -10,9 +10,12 @@ set_languages("c99", "cxx11") -- disable some compiler errors add_cxflags("-Wno-error=deprecated-declarations") add_mxflags("-Wno-error=deprecated-declarations") + +-- add defines for c files +add_defines("_GNU_SOURCE=1", "_REENTRANT") --- the debug mode -if is_mode("debug") then +-- the debug or check or coverage mode +if is_mode("debug", "check", "coverage") then -- enable the debug symbols set_symbols("debug") @@ -24,14 +27,21 @@ if is_mode("debug") then add_defines("__tb_debug__") -- attempt to enable some checkers for pc - if is_arch("i386", "x86_64") then + 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 is_mode +-- the release or profile mode if is_mode("release", "profile") then -- the release mode @@ -53,37 +63,24 @@ if is_mode("release", "profile") then -- enable the debug symbols set_symbols("debug") + -- enable gprof + add_cxflags("-pg") + add_ldflags("-pg") end - -- for pc - if is_arch("i386", "x86_64") then - - -- enable fastest optimization - set_optimize("fastest") - - -- for embed - else - -- enable smallest optimization - set_optimize("smallest") - end + -- enable fastest optimization + set_optimize("fastest") -- attempt to add vector extensions add_vectorexts("sse2", "sse3", "ssse3", "mmx") end --- for embed -if not is_arch("i386", "x86_64") 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 diff --git a/xmake/templates/c++/static_library_tbox/project/xmake.lua b/xmake/templates/c++/static_library_tbox/project/xmake.lua index 84286fdfc..770ea866d 100644 --- a/xmake/templates/c++/static_library_tbox/project/xmake.lua +++ b/xmake/templates/c++/static_library_tbox/project/xmake.lua @@ -10,9 +10,12 @@ set_languages("c99", "cxx11") -- disable some compiler errors add_cxflags("-Wno-error=deprecated-declarations") add_mxflags("-Wno-error=deprecated-declarations") + +-- add defines for c files +add_defines("_GNU_SOURCE=1", "_REENTRANT") --- the debug mode -if is_mode("debug") then +-- the debug or check or coverage mode +if is_mode("debug", "check", "coverage") then -- enable the debug symbols set_symbols("debug") @@ -24,14 +27,21 @@ if is_mode("debug") then add_defines("__tb_debug__") -- attempt to enable some checkers for pc - if is_arch("i386", "x86_64") then + 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 is_mode +-- the release or profile mode if is_mode("release", "profile") then -- the release mode @@ -53,37 +63,24 @@ if is_mode("release", "profile") then -- enable the debug symbols set_symbols("debug") + -- enable gprof + add_cxflags("-pg") + add_ldflags("-pg") end - -- for pc - if is_arch("i386", "x86_64") then - - -- enable fastest optimization - set_optimize("fastest") - - -- for embed - else - -- enable smallest optimization - set_optimize("smallest") - end + -- enable fastest optimization + set_optimize("fastest") -- attempt to add vector extensions add_vectorexts("sse2", "sse3", "ssse3", "mmx") end --- for embed -if not is_arch("i386", "x86_64") 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 diff --git a/xmake/templates/c/console_tbox/project/xmake.lua b/xmake/templates/c/console_tbox/project/xmake.lua index 9fc47c0ea..14559a49f 100644 --- a/xmake/templates/c/console_tbox/project/xmake.lua +++ b/xmake/templates/c/console_tbox/project/xmake.lua @@ -10,9 +10,12 @@ set_languages("c99", "cxx11") -- disable some compiler errors add_cxflags("-Wno-error=deprecated-declarations") add_mxflags("-Wno-error=deprecated-declarations") + +-- add defines for c files +add_defines("_GNU_SOURCE=1", "_REENTRANT") --- the debug mode -if is_mode("debug") then +-- the debug or check or coverage mode +if is_mode("debug", "check", "coverage") then -- enable the debug symbols set_symbols("debug") @@ -24,14 +27,21 @@ if is_mode("debug") then add_defines("__tb_debug__") -- attempt to enable some checkers for pc - if is_arch("i386", "x86_64") then + 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 is_mode +-- the release or profile mode if is_mode("release", "profile") then -- the release mode @@ -53,37 +63,24 @@ if is_mode("release", "profile") then -- enable the debug symbols set_symbols("debug") + -- enable gprof + add_cxflags("-pg") + add_ldflags("-pg") end - -- for pc - if is_arch("i386", "x86_64") then - - -- enable fastest optimization - set_optimize("fastest") - - -- for embed - else - -- enable smallest optimization - set_optimize("smallest") - end + -- enable fastest optimization + set_optimize("fastest") -- attempt to add vector extensions add_vectorexts("sse2", "sse3", "ssse3", "mmx") end --- for embed -if not is_arch("i386", "x86_64") 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 diff --git a/xmake/templates/c/shared_library_tbox/project/xmake.lua b/xmake/templates/c/shared_library_tbox/project/xmake.lua index 84286fdfc..770ea866d 100644 --- a/xmake/templates/c/shared_library_tbox/project/xmake.lua +++ b/xmake/templates/c/shared_library_tbox/project/xmake.lua @@ -10,9 +10,12 @@ set_languages("c99", "cxx11") -- disable some compiler errors add_cxflags("-Wno-error=deprecated-declarations") add_mxflags("-Wno-error=deprecated-declarations") + +-- add defines for c files +add_defines("_GNU_SOURCE=1", "_REENTRANT") --- the debug mode -if is_mode("debug") then +-- the debug or check or coverage mode +if is_mode("debug", "check", "coverage") then -- enable the debug symbols set_symbols("debug") @@ -24,14 +27,21 @@ if is_mode("debug") then add_defines("__tb_debug__") -- attempt to enable some checkers for pc - if is_arch("i386", "x86_64") then + 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 is_mode +-- the release or profile mode if is_mode("release", "profile") then -- the release mode @@ -53,37 +63,24 @@ if is_mode("release", "profile") then -- enable the debug symbols set_symbols("debug") + -- enable gprof + add_cxflags("-pg") + add_ldflags("-pg") end - -- for pc - if is_arch("i386", "x86_64") then - - -- enable fastest optimization - set_optimize("fastest") - - -- for embed - else - -- enable smallest optimization - set_optimize("smallest") - end + -- enable fastest optimization + set_optimize("fastest") -- attempt to add vector extensions add_vectorexts("sse2", "sse3", "ssse3", "mmx") end --- for embed -if not is_arch("i386", "x86_64") 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 diff --git a/xmake/templates/c/static_library_tbox/project/xmake.lua b/xmake/templates/c/static_library_tbox/project/xmake.lua index 84286fdfc..770ea866d 100644 --- a/xmake/templates/c/static_library_tbox/project/xmake.lua +++ b/xmake/templates/c/static_library_tbox/project/xmake.lua @@ -10,9 +10,12 @@ set_languages("c99", "cxx11") -- disable some compiler errors add_cxflags("-Wno-error=deprecated-declarations") add_mxflags("-Wno-error=deprecated-declarations") + +-- add defines for c files +add_defines("_GNU_SOURCE=1", "_REENTRANT") --- the debug mode -if is_mode("debug") then +-- the debug or check or coverage mode +if is_mode("debug", "check", "coverage") then -- enable the debug symbols set_symbols("debug") @@ -24,14 +27,21 @@ if is_mode("debug") then add_defines("__tb_debug__") -- attempt to enable some checkers for pc - if is_arch("i386", "x86_64") then + 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 is_mode +-- the release or profile mode if is_mode("release", "profile") then -- the release mode @@ -53,37 +63,24 @@ if is_mode("release", "profile") then -- enable the debug symbols set_symbols("debug") + -- enable gprof + add_cxflags("-pg") + add_ldflags("-pg") end - -- for pc - if is_arch("i386", "x86_64") then - - -- enable fastest optimization - set_optimize("fastest") - - -- for embed - else - -- enable smallest optimization - set_optimize("smallest") - end + -- enable fastest optimization + set_optimize("fastest") -- attempt to add vector extensions add_vectorexts("sse2", "sse3", "ssse3", "mmx") end --- for embed -if not is_arch("i386", "x86_64") 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 |
