summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-02-17 20:35:16 +0800
committerruki <[email protected]>2016-02-17 20:35:16 +0800
commitd316be4334127336822e8daeb8a45d2ffe0bdde7 (patch)
treecb517e6a91d64073d67d1870edf72356299da84c
parent1015eb5af840daeb67af07ba359a18ee5d5215c6 (diff)
modify interfaces for xmake.lua
-rwxr-xr-xcore/project.mak2
-rwxr-xr-xtests/c++_console/xmake.lua6
-rwxr-xr-xtests/c++_shared_library/xmake.lua8
-rwxr-xr-xtests/c++_static_library/xmake.lua8
-rwxr-xr-xtests/c_console/xmake.lua7
-rwxr-xr-xtests/c_shared_library/xmake.lua8
-rwxr-xr-xtests/c_static_library/xmake.lua8
-rw-r--r--tests/console/src/demo/xmake.lua24
-rw-r--r--tests/console/xmake.lua28
-rw-r--r--tests/interpreter/scope.lua4
-rw-r--r--tests/interpreter/tests.lua4
-rwxr-xr-xtests/objc++_console/xmake.lua6
-rwxr-xr-xtests/objc_console/xmake.lua6
-rwxr-xr-xtests/swift_console/xmake.lua6
-rw-r--r--xmake/core/base/interpreter.lua22
-rw-r--r--xmake/core/base/package.lua2
-rw-r--r--xmake/core/base/project.lua183
-rw-r--r--xmake/templates/c++/console/project/xmake.lua6
-rw-r--r--xmake/templates/c++/console_tbox/project/src/xmake.lua2
-rw-r--r--xmake/templates/c++/console_tbox/project/xmake.lua18
-rw-r--r--xmake/templates/c++/shared_library/project/xmake.lua8
-rw-r--r--xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua2
-rw-r--r--xmake/templates/c++/shared_library_tbox/project/xmake.lua20
-rw-r--r--xmake/templates/c++/static_library/project/xmake.lua8
-rw-r--r--xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua2
-rw-r--r--xmake/templates/c++/static_library_tbox/project/xmake.lua20
-rw-r--r--xmake/templates/c/console/project/xmake.lua6
-rw-r--r--xmake/templates/c/console_tbox/project/src/xmake.lua2
-rw-r--r--xmake/templates/c/console_tbox/project/xmake.lua18
-rw-r--r--xmake/templates/c/shared_library/project/xmake.lua8
-rw-r--r--xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua2
-rw-r--r--xmake/templates/c/shared_library_tbox/project/xmake.lua20
-rw-r--r--xmake/templates/c/static_library/project/xmake.lua8
-rw-r--r--xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua2
-rw-r--r--xmake/templates/c/static_library_tbox/project/xmake.lua20
-rw-r--r--xmake/templates/objc++/console/project/xmake.lua6
-rw-r--r--xmake/templates/objc/console/project/xmake.lua6
-rw-r--r--xmake/templates/swift/console/project/xmake.lua6
42 files changed, 337 insertions, 193 deletions
diff --git a/core/project.mak b/core/project.mak
index e037f5b5c..cda67c6ff 100755
--- a/core/project.mak
+++ b/core/project.mak
@@ -10,7 +10,7 @@ PRO_VERSION_MAJOR = 1
PRO_VERSION_MINOR = 1
# the project alter version
-PRO_VERSION_ALTER = 0
+PRO_VERSION_ALTER = 1
# the project prefix
PRO_PREFIX = XM_
diff --git a/tests/c++_console/xmake.lua b/tests/c++_console/xmake.lua
index 99f567115..aaa5d9bb5 100755
--- a/tests/c++_console/xmake.lua
+++ b/tests/c++_console/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("cpp_console")
+target("cpp_console")
-- set kind
set_kind("binary")
diff --git a/tests/c++_shared_library/xmake.lua b/tests/c++_shared_library/xmake.lua
index d7e81fd40..02b5c7509 100755
--- a/tests/c++_shared_library/xmake.lua
+++ b/tests/c++_shared_library/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("cpp_shared_library")
+target("cpp_shared_library")
-- set kind
set_kind("shared")
@@ -31,7 +31,7 @@ def_target("cpp_shared_library")
add_files("src/interface.cpp")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/tests/c++_static_library/xmake.lua b/tests/c++_static_library/xmake.lua
index 9fc5b6026..c57927a5d 100755
--- a/tests/c++_static_library/xmake.lua
+++ b/tests/c++_static_library/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("cpp_static_library")
+target("cpp_static_library")
-- set kind
set_kind("static")
@@ -31,7 +31,7 @@ def_target("cpp_static_library")
add_files("src/interface.cpp")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/tests/c_console/xmake.lua b/tests/c_console/xmake.lua
index 254b2823d..889055a4d 100755
--- a/tests/c_console/xmake.lua
+++ b/tests/c_console/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("c_console")
+target("c_console")
-- set kind
set_kind("binary")
@@ -30,3 +30,4 @@ def_target("c_console")
-- add files
add_files("src/*.c")
+
diff --git a/tests/c_shared_library/xmake.lua b/tests/c_shared_library/xmake.lua
index b1e6eafac..d357b72f3 100755
--- a/tests/c_shared_library/xmake.lua
+++ b/tests/c_shared_library/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("c_shared_library")
+target("c_shared_library")
-- set kind
set_kind("shared")
@@ -31,7 +31,7 @@ def_target("c_shared_library")
add_files("src/interface.cpp")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/tests/c_static_library/xmake.lua b/tests/c_static_library/xmake.lua
index 93d69eb12..72fd8c4a0 100755
--- a/tests/c_static_library/xmake.lua
+++ b/tests/c_static_library/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("c_static_library")
+target("c_static_library")
-- set kind
set_kind("static")
@@ -31,7 +31,7 @@ def_target("c_static_library")
add_files("src/interface.c")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/tests/console/src/demo/xmake.lua b/tests/console/src/demo/xmake.lua
index 6585054be..912a24a69 100644
--- a/tests/console/src/demo/xmake.lua
+++ b/tests/console/src/demo/xmake.lua
@@ -1,5 +1,5 @@
-def_target("demo_c")
+target("demo_c")
set_kind("binary")
add_deps("hello1")
add_files("*.c")
@@ -8,13 +8,13 @@ def_target("demo_c")
add_includedirs("$(buildir)")
add_cflags("-DHELLO1")
- if modes("release") then add_defines("NDEBUG") end
- if options("option1") then add_defines("OPTION1") end
- if options("option2") then add_defines("OPTION2") end
- if options("option3") then add_defines("OPTION3") end
- if options("option4") then add_defines("OPTION4") end
+ if is_mode("release") then add_defines("NDEBUG") end
+ if is_option("option1") then add_defines("OPTION1") end
+ if is_option("option2") then add_defines("OPTION2") end
+ if is_option("option3") then add_defines("OPTION3") end
+ if is_option("option4") then add_defines("OPTION4") end
-def_target("demo_cpp")
+target("demo_cpp")
set_kind("binary")
add_deps("hello2")
add_files("*.cpp")
@@ -29,9 +29,9 @@ def_target("demo_cpp")
return 1
end)
- if plats("macosx", "ios") then
+ if is_plat("macosx", "ios") then
- def_target("demo_objc")
+ target("demo_objc")
set_kind("binary")
add_deps("hello3")
add_files("*.m")
@@ -40,18 +40,18 @@ def_target("demo_cpp")
add_includedirs("$(buildir)/inc")
add_mflags("-DHELLO3", "-DPLAT=\"macosx\"", "-DARCH='armv7, arm64'")
- def_target("demo_objcpp")
+ target("demo_objcpp")
set_kind("binary")
add_deps("hello3")
add_files("*.mm")
add_mxflags("-DHELLO3")
add_ldflags("-L$(buildir)/lib", "-lhello3", "-lhello3")
- if plats("ios") then
+ if is_plat("ios") then
add_ldflags("-framework Cocoa", "-framework IOKit", "-framework CoreFoundation")
end
end
-def_target("demo_swift")
+target("demo_swift")
set_kind("binary")
add_files("*.swift")
diff --git a/tests/console/xmake.lua b/tests/console/xmake.lua
index b4cf57d58..74ebb7574 100644
--- a/tests/console/xmake.lua
+++ b/tests/console/xmake.lua
@@ -1,14 +1,14 @@
set_version("1.0.1")
set_config_h("$(buildir)/demo.h")
-if modes("debug") then
+if is_mode("debug") then
set_symbols("debug")
set_warnings("all")
set_optimize("none")
add_cxflags("-fsanitize=address", "-ftrapv")
end
-if modes("release") then
+if is_mode("release") then
set_strip("all")
set_symbols("hidden")
add_cflags("-Wno-error=deprecated-declarations")
@@ -17,23 +17,23 @@ if modes("release") then
add_vectorexts("sse2", "ssse3", "mmx")
end
-if modes("profile") then
+if is_mode("profile") then
set_symbols("debug")
set_warnings("none")
set_optimize("fastest")
end
-if archs("x86", "x64") then
+if is_arch("x86", "x64") then
add_defines("ARCH=\"$(arch)\"", "PLAT=$(plat)", "MODE=$(mode)", "HOST=$(host)")
end
-def_option("option1")
+option("option1")
set_option_enable(true)
set_option_showmenu(true)
add_option_defines_h_if_ok("OPTION1_ENABLE")
set_option_description("The option for definition and need not check.")
-def_option("option2")
+option("option2")
set_option_enable(false)
set_option_showmenu(true)
add_option_defines_h_if_ok("OPTION2_ENABLE")
@@ -41,7 +41,7 @@ def_option("option2")
add_option_includedirs("src/hello1")
set_option_description("The option for finding includes.")
-def_option("option3")
+option("option3")
set_option_enable(false)
set_option_showmenu(true)
add_option_defines_h_if_ok("OPTION3_ENABLE")
@@ -49,26 +49,26 @@ def_option("option3")
add_option_linkdirs("$(buildir)")
set_option_description("The option for finding links.")
-def_option("option4")
+option("option4")
set_option_enable(false)
set_option_showmenu(true)
add_option_defines_h_if_ok("OPTION4_ENABLE")
set_option_description("The option for finding interfaces.")
- if not plats("windows") then
+ if not is_plat("windows") then
add_option_links("z", "sqlite3")
add_option_cfuncs("sqlite3_open")
add_option_cincludes("stdio.h", "sqlite3.h")
end
-def_target("hello1")
+target("hello1")
set_kind("static")
add_files("src/hello1/*.c")
-def_target("hello2")
+target("hello2")
set_kind("shared")
add_files("$(projectdir)/src/hello2/*.c")
-def_target("hello3")
+target("hello3")
set_kind("static")
add_files("src/hello3/*.c")
add_headers("src/(hello3/*.h)")
@@ -76,13 +76,13 @@ def_target("hello3")
set_targetdir("$(buildir)/lib")
set_objectdir("$(buildir)/obj")
-def_target("hello4")
+target("hello4")
set_kind("static")
add_deps("hello1", "hello2")
add_files("$(buildir)/.objs/hello1/**.o")
add_files("$(buildir)/.objs/hello2/**.obj")
-def_target("hello5")
+target("hello5")
set_kind("static")
add_deps("hello4", "hello1")
add_files("$(buildir)/hello1.lib")
diff --git a/tests/interpreter/scope.lua b/tests/interpreter/scope.lua
index dbc532587..ae64c2370 100644
--- a/tests/interpreter/scope.lua
+++ b/tests/interpreter/scope.lua
@@ -2,12 +2,12 @@
set_kind("static")
add_files("root.c")
-def_target("target1")
+target("target1")
set_kind("static")
add_files("*.c", "hello.c")
add_files("$(projectdir)/test.c")
-def_option("option1")
+option("option1")
add_option_links("pthread", "z")
diff --git a/tests/interpreter/tests.lua b/tests/interpreter/tests.lua
index 893feecff..8f6be802b 100644
--- a/tests/interpreter/tests.lua
+++ b/tests/interpreter/tests.lua
@@ -49,7 +49,7 @@ function tests.main(self, file)
, "config_h_prefix"
, "version"
, "strip"
- , "options"
+ , "is_option"
, "symbols"
, "warnings"
, "optimize"
@@ -67,7 +67,7 @@ function tests.main(self, file)
, "mxxflags"
, "ldflags"
, "shflags"
- , "options"
+ , "is_option"
, "defines"
, "undefines"
, "defines_h"
diff --git a/tests/objc++_console/xmake.lua b/tests/objc++_console/xmake.lua
index c277fe8af..ab706d51a 100755
--- a/tests/objc++_console/xmake.lua
+++ b/tests/objc++_console/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -33,7 +33,7 @@ if os("macosx", "ios") then
end
-- add target
-def_target("objcpp_console")
+target("objcpp_console")
-- set kind
set_kind("binary")
diff --git a/tests/objc_console/xmake.lua b/tests/objc_console/xmake.lua
index 478936407..ca5310578 100755
--- a/tests/objc_console/xmake.lua
+++ b/tests/objc_console/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -33,7 +33,7 @@ if os("macosx", "ios") then
end
-- add target
-def_target("objc_console")
+target("objc_console")
-- set kind
set_kind("binary")
diff --git a/tests/swift_console/xmake.lua b/tests/swift_console/xmake.lua
index b27a2efc4..68f822d8f 100755
--- a/tests/swift_console/xmake.lua
+++ b/tests/swift_console/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("swift_console")
+target("swift_console")
-- set kind
set_kind("binary")
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index db1d95d2e..f5d454dc2 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -78,7 +78,7 @@ function interpreter._api_register_xxx_scope(self, action, apifunc, ...)
-- check
assert(self and self._PUBLIC and self._PRIVATE)
- assert(action and apifunc)
+ assert(apifunc)
-- done
for _, apiname in ipairs({...}) do
@@ -86,8 +86,14 @@ function interpreter._api_register_xxx_scope(self, action, apifunc, ...)
-- check
assert(apiname)
+ -- the full name
+ local fullname = apiname
+ if action ~= nil then
+ fullname = action .. "_" .. apiname
+ end
+
-- register scope api
- self:api_register(action .. "_" .. apiname, function (self, ...)
+ self:api_register(fullname, function (self, ...)
-- check
assert(self and self._PRIVATE and apiname)
@@ -533,9 +539,9 @@ function interpreter.api_register_builtin(self, name, func)
self._PUBLIC[name] = func
end
--- register api for def_scope()
+-- register api for scope()
--
--- interp:api_register_def_scope("scope_kind1", "scope_kind2")
+-- interp:api_register_scope("scope_kind1", "scope_kind2")
--
-- api:
-- set_$(scope_kind1)("scope_name1")
@@ -573,7 +579,7 @@ end
-- }
-- }
--
-function interpreter.api_register_def_scope(self, ...)
+function interpreter.api_register_scope(self, ...)
-- check
assert(self)
@@ -597,7 +603,7 @@ function interpreter.api_register_def_scope(self, ...)
end
-- register implementation
- self:_api_register_xxx_scope("def", implementation, ...)
+ self:_api_register_xxx_scope(nil, implementation, ...)
end
-- TODO: deprecated
@@ -616,7 +622,7 @@ function interpreter.api_register_set_scope(self, ...)
-- warning
if not scope_name:startswith("__") then
- utils.warning("please uses def_%s(\"%s\"), \"set_%s\" has been deprecated!", scope_kind, scope_name, scope_kind)
+ utils.warning("please uses %s(\"%s\"), \"set_%s\" has been deprecated!", scope_kind, scope_name, scope_kind)
end
-- check
@@ -657,7 +663,7 @@ function interpreter.api_register_add_scope(self, ...)
-- warning
if not scope_name:startswith("__") then
- utils.warning("please uses def_%s(\"%s\"), \"add_%s\" has been deprecated!", scope_kind, scope_name, scope_kind)
+ utils.warning("please uses %s(\"%s\"), \"add_%s\" has been deprecated!", scope_kind, scope_name, scope_kind)
end
-- check
diff --git a/xmake/core/base/package.lua b/xmake/core/base/package.lua
index 5290ea47f..143546299 100644
--- a/xmake/core/base/package.lua
+++ b/xmake/core/base/package.lua
@@ -97,7 +97,7 @@ function package._done_library(target)
-- the xmake.lua template content
local template = [[
-- add [targetname] package
-def_option("[targetname]")
+option("[targetname]")
-- show menu
set_option_showmenu(true)
diff --git a/xmake/core/base/project.lua b/xmake/core/base/project.lua
index 3aeefd244..d50afe4cc 100644
--- a/xmake/core/base/project.lua
+++ b/xmake/core/base/project.lua
@@ -38,7 +38,7 @@ local platform = require("base/platform")
local interpreter = require("base/interpreter")
-- the current os is belong to the given os?
-function project._api_os(interp, ...)
+function project._api_is_os(interp, ...)
-- get the current os
local os = platform.os()
@@ -53,7 +53,7 @@ function project._api_os(interp, ...)
end
-- the current mode is belong to the given modes?
-function project._api_modes(interp, ...)
+function project._api_is_mode(interp, ...)
-- get the current mode
local mode = config.get("mode")
@@ -68,7 +68,7 @@ function project._api_modes(interp, ...)
end
-- the current platform is belong to the given platforms?
-function project._api_plats(interp, ...)
+function project._api_is_plat(interp, ...)
-- get the current platform
local plat = config.get("plat")
@@ -83,7 +83,7 @@ function project._api_plats(interp, ...)
end
-- the current platform is belong to the given architectures?
-function project._api_archs(interp, ...)
+function project._api_is_arch(interp, ...)
-- get the current architecture
local arch = config.get("arch")
@@ -98,7 +98,7 @@ function project._api_archs(interp, ...)
end
-- the current kind is belong to the given kinds?
-function project._api_kinds(interp, ...)
+function project._api_is_kind(interp, ...)
-- get the current kind
local kind = config.get("kind")
@@ -113,7 +113,7 @@ function project._api_kinds(interp, ...)
end
-- enable options?
-function project._api_options(interp, ...)
+function project._api_is_option(interp, ...)
-- some options are enabled?
for _, o in ipairs(table.join(...)) do
@@ -123,6 +123,144 @@ function project._api_options(interp, ...)
end
end
+-- TODO: deprecated
+-- the current os is belong to the given os?
+function project._api_os(interp, ...)
+
+ -- make values
+ local values = ""
+ for _, v in ipairs(table.join(...)) do
+ if v and type(v) == "string" then
+ if #values == 0 then
+ values = v
+ else
+ values = values .. ", " .. v
+ end
+ end
+ end
+
+ -- warning
+ utils.warning("please uses is_os(\"%s\"), \"os()\" has been deprecated!", values)
+
+ -- done
+ return project._api_is_os(interp, ...)
+end
+
+-- TODO: deprecated
+-- the current mode is belong to the given modes?
+function project._api_modes(interp, ...)
+
+ -- make values
+ local values = ""
+ for _, v in ipairs(table.join(...)) do
+ if v and type(v) == "string" then
+ if #values == 0 then
+ values = v
+ else
+ values = values .. ", " .. v
+ end
+ end
+ end
+
+ -- warning
+ utils.warning("please uses is_mode(\"%s\"), \"modes()\" has been deprecated!", values)
+
+ -- done
+ return project._api_is_mode(interp, ...)
+end
+
+-- TODO: deprecated
+-- the current platform is belong to the given platforms?
+function project._api_plats(interp, ...)
+
+ -- make values
+ local values = ""
+ for _, v in ipairs(table.join(...)) do
+ if v and type(v) == "string" then
+ if #values == 0 then
+ values = v
+ else
+ values = values .. ", " .. v
+ end
+ end
+ end
+
+ -- warning
+ utils.warning("please uses is_plat(\"%s\"), \"plats()\" has been deprecated!", values)
+
+ -- done
+ return project._api_is_plat(interp, ...)
+end
+
+-- TODO: deprecated
+-- the current platform is belong to the given architectures?
+function project._api_archs(interp, ...)
+
+ -- make values
+ local values = ""
+ for _, v in ipairs(table.join(...)) do
+ if v and type(v) == "string" then
+ if #values == 0 then
+ values = v
+ else
+ values = values .. ", " .. v
+ end
+ end
+ end
+
+ -- warning
+ utils.warning("please uses is_arch(\"%s\"), \"archs()\" has been deprecated!", values)
+
+ -- done
+ return project._api_is_arch(interp, ...)
+end
+
+-- TODO: deprecated
+-- the current kind is belong to the given kinds?
+function project._api_kinds(interp, ...)
+
+ -- make values
+ local values = ""
+ for _, v in ipairs(table.join(...)) do
+ if v and type(v) == "string" then
+ if #values == 0 then
+ values = v
+ else
+ values = values .. ", " .. v
+ end
+ end
+ end
+
+ -- warning
+ utils.warning("please uses is_kind(\"%s\"), \"kinds()\" has been deprecated!", values)
+
+ -- done
+ return project._api_is_kind(interp, ...)
+end
+
+-- TODO: deprecated
+-- enable options?
+function project._api_options(interp, ...)
+
+ -- make values
+ local values = ""
+ for _, v in ipairs(table.join(...)) do
+ if v and type(v) == "string" then
+ if #values == 0 then
+ values = v
+ else
+ values = values .. ", " .. v
+ end
+ end
+ end
+
+ -- warning
+ utils.warning("please uses is_option(\"%s\"), \"options()\" has been deprecated!", values)
+
+ -- done
+ return project._api_is_option(interp, ...)
+end
+
-- add c function
function project._api_add_cfunc(interp, module, alias, links, includes, cfunc)
@@ -149,7 +287,7 @@ function project._api_add_cfunc(interp, module, alias, links, includes, cfunc)
local scope = interp:scope_save()
-- make option
- interp:api_call("def_option", name)
+ interp:api_call("option", name)
interp:api_call("set_option_category", "cfuncs")
interp:api_call("add_option_cfuncs", cfunc)
if links then interp:api_call("add_option_links", links) end
@@ -195,7 +333,7 @@ function project._api_add_cfuncs(interp, module, links, includes, ...)
local scope = interp:scope_save()
-- make option
- interp:api_call("def_option", name)
+ interp:api_call("option", name)
interp:api_call("set_option_category", "cfuncs")
interp:api_call("add_option_cfuncs", cfunc)
if links then interp:api_call("add_option_links", links) end
@@ -236,7 +374,7 @@ function project._api_add_cxxfunc(interp, module, alias, links, includes, cxxfun
local scope = interp:scope_save()
-- make option
- interp:api_call("def_option", name)
+ interp:api_call("option", name)
interp:api_call("set_option_category", "cxxfuncs")
interp:api_call("add_option_cxxfuncs", cxxfunc)
if links then interp:api_call("add_option_links", links) end
@@ -282,7 +420,7 @@ function project._api_add_cxxfuncs(interp, module, links, includes, ...)
local scope = interp:scope_save()
-- make option
- interp:api_call("def_option", name)
+ interp:api_call("option", name)
interp:api_call("set_option_category", "cxxfuncs")
interp:api_call("add_option_cxxfuncs", cxxfunc)
if links then interp:api_call("add_option_links", links) end
@@ -331,8 +469,8 @@ function project._interpreter()
interp:api_register_set_scope("target", "option")
interp:api_register_add_scope("target", "option")
- -- register api: def_target() and def_option()
- interp:api_register_def_scope("target", "option")
+ -- register api: target() and option()
+ interp:api_register_scope("target", "option")
-- register api: set_script() for target
interp:api_register_set_script("target", nil, "runscript"
@@ -416,24 +554,23 @@ function project._interpreter()
, "includedirs")
- -- register api: os()
+ -- TODO: deprecated
+ -- register api: os(), kinds(), modes(), plats(), archs(), options()
interp:api_register("os", project._api_os)
-
- -- register api: kinds()
interp:api_register("kinds", project._api_kinds)
-
- -- register api: modes()
interp:api_register("modes", project._api_modes)
-
- -- register api: plats()
interp:api_register("plats", project._api_plats)
-
- -- register api: archs()
interp:api_register("archs", project._api_archs)
-
- -- register api: options()
interp:api_register("options", project._api_options)
+ -- register api: is_os(), is_kind(), is_mode(), is_plat(), is_arch(), is_option()
+ interp:api_register("is_os", project._api_is_os)
+ interp:api_register("is_kind", project._api_is_kind)
+ interp:api_register("is_mode", project._api_is_mode)
+ interp:api_register("is_plat", project._api_is_plat)
+ interp:api_register("is_arch", project._api_is_arch)
+ interp:api_register("is_option", project._api_is_option)
+
-- register api: add_cfunc()
interp:api_register("add_cfunc", project._api_add_cfunc)
diff --git a/xmake/templates/c++/console/project/xmake.lua b/xmake/templates/c++/console/project/xmake.lua
index 3491b4fd7..bc427742c 100644
--- a/xmake/templates/c++/console/project/xmake.lua
+++ b/xmake/templates/c++/console/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c++/console_tbox/project/src/xmake.lua b/xmake/templates/c++/console_tbox/project/src/xmake.lua
index eb49c4706..0a6bf6034 100644
--- a/xmake/templates/c++/console_tbox/project/src/xmake.lua
+++ b/xmake/templates/c++/console_tbox/project/src/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c++/console_tbox/project/xmake.lua b/xmake/templates/c++/console_tbox/project/xmake.lua
index 9a7c001e5..aab73814f 100644
--- a/xmake/templates/c++/console_tbox/project/xmake.lua
+++ b/xmake/templates/c++/console_tbox/project/xmake.lua
@@ -12,7 +12,7 @@ add_cxflags("-Wno-error=deprecated-declarations")
add_mxflags("-Wno-error=deprecated-declarations")
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -24,18 +24,18 @@ if modes("debug") then
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
end
--- the release or profile modes
-if modes("release", "profile") then
+-- the release or profile is_mode
+if is_mode("release", "profile") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -56,7 +56,7 @@ if modes("release", "profile") then
end
-- for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
-- enable fastest optimization
set_optimize("fastest")
@@ -72,7 +72,7 @@ if modes("release", "profile") then
end
-- for embed
-if not archs("i386", "x86_64") then
+if not is_arch("i386", "x86_64") then
-- add defines for small
add_defines("__tb_small__")
@@ -85,13 +85,13 @@ end
if plats("windows") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- link libcmt.lib
add_cxflags("-MT")
-- the debug mode
- elseif modes("debug") then
+ elseif is_mode("debug") then
-- enable some checkers
add_cxflags("-Gs", "-RTC1")
diff --git a/xmake/templates/c++/shared_library/project/xmake.lua b/xmake/templates/c++/shared_library/project/xmake.lua
index a8f13b901..ee3579a6c 100644
--- a/xmake/templates/c++/shared_library/project/xmake.lua
+++ b/xmake/templates/c++/shared_library/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("shared")
@@ -31,7 +31,7 @@ def_target("[targetname]")
add_files("src/interface.cpp")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua
index d2b9ae2e9..354b01a3c 100644
--- a/xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua
+++ b/xmake/templates/c++/shared_library_tbox/project/src/_demo/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("demo")
+target("demo")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua
index 608fb2455..7b38208d5 100644
--- a/xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua
+++ b/xmake/templates/c++/shared_library_tbox/project/src/_library/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("shared")
diff --git a/xmake/templates/c++/shared_library_tbox/project/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/xmake.lua
index 61e135480..20ab67394 100644
--- a/xmake/templates/c++/shared_library_tbox/project/xmake.lua
+++ b/xmake/templates/c++/shared_library_tbox/project/xmake.lua
@@ -12,7 +12,7 @@ add_cxflags("-Wno-error=deprecated-declarations")
add_mxflags("-Wno-error=deprecated-declarations")
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -24,18 +24,18 @@ if modes("debug") then
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
end
--- the release or profile modes
-if modes("release", "profile") then
+-- the release or profile is_mode
+if is_mode("release", "profile") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -56,7 +56,7 @@ if modes("release", "profile") then
end
-- for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
-- enable fastest optimization
set_optimize("fastest")
@@ -72,7 +72,7 @@ if modes("release", "profile") then
end
-- for embed
-if not archs("i386", "x86_64") then
+if not is_arch("i386", "x86_64") then
-- add defines for small
add_defines("__tb_small__")
@@ -85,13 +85,13 @@ end
if plats("windows") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- link libcmt.lib
add_cxflags("-MT")
-- the debug mode
- elseif modes("debug") then
+ elseif is_mode("debug") then
-- enable some checkers
add_cxflags("-Gs", "-RTC1")
@@ -105,7 +105,7 @@ if plats("windows") then
end
-- add option: demo
-def_option("demo")
+option("demo")
set_option_enable(true)
set_option_showmenu(true)
set_option_category("option")
diff --git a/xmake/templates/c++/static_library/project/xmake.lua b/xmake/templates/c++/static_library/project/xmake.lua
index 4f088bf9e..7c7a96cb0 100644
--- a/xmake/templates/c++/static_library/project/xmake.lua
+++ b/xmake/templates/c++/static_library/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("static")
@@ -31,7 +31,7 @@ def_target("[targetname]")
add_files("src/interface.cpp")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua
index d2b9ae2e9..354b01a3c 100644
--- a/xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua
+++ b/xmake/templates/c++/static_library_tbox/project/src/_demo/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("demo")
+target("demo")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua
index 4a975ad66..b1b357397 100644
--- a/xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua
+++ b/xmake/templates/c++/static_library_tbox/project/src/_library/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("static")
diff --git a/xmake/templates/c++/static_library_tbox/project/xmake.lua b/xmake/templates/c++/static_library_tbox/project/xmake.lua
index 61e135480..20ab67394 100644
--- a/xmake/templates/c++/static_library_tbox/project/xmake.lua
+++ b/xmake/templates/c++/static_library_tbox/project/xmake.lua
@@ -12,7 +12,7 @@ add_cxflags("-Wno-error=deprecated-declarations")
add_mxflags("-Wno-error=deprecated-declarations")
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -24,18 +24,18 @@ if modes("debug") then
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
end
--- the release or profile modes
-if modes("release", "profile") then
+-- the release or profile is_mode
+if is_mode("release", "profile") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -56,7 +56,7 @@ if modes("release", "profile") then
end
-- for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
-- enable fastest optimization
set_optimize("fastest")
@@ -72,7 +72,7 @@ if modes("release", "profile") then
end
-- for embed
-if not archs("i386", "x86_64") then
+if not is_arch("i386", "x86_64") then
-- add defines for small
add_defines("__tb_small__")
@@ -85,13 +85,13 @@ end
if plats("windows") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- link libcmt.lib
add_cxflags("-MT")
-- the debug mode
- elseif modes("debug") then
+ elseif is_mode("debug") then
-- enable some checkers
add_cxflags("-Gs", "-RTC1")
@@ -105,7 +105,7 @@ if plats("windows") then
end
-- add option: demo
-def_option("demo")
+option("demo")
set_option_enable(true)
set_option_showmenu(true)
set_option_category("option")
diff --git a/xmake/templates/c/console/project/xmake.lua b/xmake/templates/c/console/project/xmake.lua
index c858ef1e5..d29179e0f 100644
--- a/xmake/templates/c/console/project/xmake.lua
+++ b/xmake/templates/c/console/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c/console_tbox/project/src/xmake.lua b/xmake/templates/c/console_tbox/project/src/xmake.lua
index 5270285f8..08f5e89d1 100644
--- a/xmake/templates/c/console_tbox/project/src/xmake.lua
+++ b/xmake/templates/c/console_tbox/project/src/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c/console_tbox/project/xmake.lua b/xmake/templates/c/console_tbox/project/xmake.lua
index 9a7c001e5..aab73814f 100644
--- a/xmake/templates/c/console_tbox/project/xmake.lua
+++ b/xmake/templates/c/console_tbox/project/xmake.lua
@@ -12,7 +12,7 @@ add_cxflags("-Wno-error=deprecated-declarations")
add_mxflags("-Wno-error=deprecated-declarations")
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -24,18 +24,18 @@ if modes("debug") then
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
end
--- the release or profile modes
-if modes("release", "profile") then
+-- the release or profile is_mode
+if is_mode("release", "profile") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -56,7 +56,7 @@ if modes("release", "profile") then
end
-- for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
-- enable fastest optimization
set_optimize("fastest")
@@ -72,7 +72,7 @@ if modes("release", "profile") then
end
-- for embed
-if not archs("i386", "x86_64") then
+if not is_arch("i386", "x86_64") then
-- add defines for small
add_defines("__tb_small__")
@@ -85,13 +85,13 @@ end
if plats("windows") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- link libcmt.lib
add_cxflags("-MT")
-- the debug mode
- elseif modes("debug") then
+ elseif is_mode("debug") then
-- enable some checkers
add_cxflags("-Gs", "-RTC1")
diff --git a/xmake/templates/c/shared_library/project/xmake.lua b/xmake/templates/c/shared_library/project/xmake.lua
index 20684126f..06a9a6ec8 100644
--- a/xmake/templates/c/shared_library/project/xmake.lua
+++ b/xmake/templates/c/shared_library/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("shared")
@@ -31,7 +31,7 @@ def_target("[targetname]")
add_files("src/interface.c")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua
index 8de43bb2b..c3bafab3c 100644
--- a/xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua
+++ b/xmake/templates/c/shared_library_tbox/project/src/_demo/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("demo")
+target("demo")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua
index 6fcedbf29..cb02e1815 100644
--- a/xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua
+++ b/xmake/templates/c/shared_library_tbox/project/src/_library/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("shared")
diff --git a/xmake/templates/c/shared_library_tbox/project/xmake.lua b/xmake/templates/c/shared_library_tbox/project/xmake.lua
index 61e135480..20ab67394 100644
--- a/xmake/templates/c/shared_library_tbox/project/xmake.lua
+++ b/xmake/templates/c/shared_library_tbox/project/xmake.lua
@@ -12,7 +12,7 @@ add_cxflags("-Wno-error=deprecated-declarations")
add_mxflags("-Wno-error=deprecated-declarations")
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -24,18 +24,18 @@ if modes("debug") then
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
end
--- the release or profile modes
-if modes("release", "profile") then
+-- the release or profile is_mode
+if is_mode("release", "profile") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -56,7 +56,7 @@ if modes("release", "profile") then
end
-- for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
-- enable fastest optimization
set_optimize("fastest")
@@ -72,7 +72,7 @@ if modes("release", "profile") then
end
-- for embed
-if not archs("i386", "x86_64") then
+if not is_arch("i386", "x86_64") then
-- add defines for small
add_defines("__tb_small__")
@@ -85,13 +85,13 @@ end
if plats("windows") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- link libcmt.lib
add_cxflags("-MT")
-- the debug mode
- elseif modes("debug") then
+ elseif is_mode("debug") then
-- enable some checkers
add_cxflags("-Gs", "-RTC1")
@@ -105,7 +105,7 @@ if plats("windows") then
end
-- add option: demo
-def_option("demo")
+option("demo")
set_option_enable(true)
set_option_showmenu(true)
set_option_category("option")
diff --git a/xmake/templates/c/static_library/project/xmake.lua b/xmake/templates/c/static_library/project/xmake.lua
index 26dd4e68c..5eac70e20 100644
--- a/xmake/templates/c/static_library/project/xmake.lua
+++ b/xmake/templates/c/static_library/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("static")
@@ -31,7 +31,7 @@ def_target("[targetname]")
add_files("src/interface.c")
-- add target
-def_target("test")
+target("test")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua b/xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua
index 8de43bb2b..c3bafab3c 100644
--- a/xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua
+++ b/xmake/templates/c/static_library_tbox/project/src/_demo/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("demo")
+target("demo")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua b/xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua
index 851328464..cec28c3d4 100644
--- a/xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua
+++ b/xmake/templates/c/static_library_tbox/project/src/_library/xmake.lua
@@ -1,5 +1,5 @@
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("static")
diff --git a/xmake/templates/c/static_library_tbox/project/xmake.lua b/xmake/templates/c/static_library_tbox/project/xmake.lua
index 61e135480..20ab67394 100644
--- a/xmake/templates/c/static_library_tbox/project/xmake.lua
+++ b/xmake/templates/c/static_library_tbox/project/xmake.lua
@@ -12,7 +12,7 @@ add_cxflags("-Wno-error=deprecated-declarations")
add_mxflags("-Wno-error=deprecated-declarations")
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -24,18 +24,18 @@ if modes("debug") then
add_defines("__tb_debug__")
-- attempt to enable some checkers for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
add_cxflags("-fsanitize=address", "-ftrapv")
add_mxflags("-fsanitize=address", "-ftrapv")
add_ldflags("-fsanitize=address")
end
end
--- the release or profile modes
-if modes("release", "profile") then
+-- the release or profile is_mode
+if is_mode("release", "profile") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -56,7 +56,7 @@ if modes("release", "profile") then
end
-- for pc
- if archs("i386", "x86_64") then
+ if is_arch("i386", "x86_64") then
-- enable fastest optimization
set_optimize("fastest")
@@ -72,7 +72,7 @@ if modes("release", "profile") then
end
-- for embed
-if not archs("i386", "x86_64") then
+if not is_arch("i386", "x86_64") then
-- add defines for small
add_defines("__tb_small__")
@@ -85,13 +85,13 @@ end
if plats("windows") then
-- the release mode
- if modes("release") then
+ if is_mode("release") then
-- link libcmt.lib
add_cxflags("-MT")
-- the debug mode
- elseif modes("debug") then
+ elseif is_mode("debug") then
-- enable some checkers
add_cxflags("-Gs", "-RTC1")
@@ -105,7 +105,7 @@ if plats("windows") then
end
-- add option: demo
-def_option("demo")
+option("demo")
set_option_enable(true)
set_option_showmenu(true)
set_option_category("option")
diff --git a/xmake/templates/objc++/console/project/xmake.lua b/xmake/templates/objc++/console/project/xmake.lua
index 6f8ce1bf6..d9d4a4ed0 100644
--- a/xmake/templates/objc++/console/project/xmake.lua
+++ b/xmake/templates/objc++/console/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -33,7 +33,7 @@ if os("macosx", "ios") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/objc/console/project/xmake.lua b/xmake/templates/objc/console/project/xmake.lua
index eb59e833f..d2f3d710b 100644
--- a/xmake/templates/objc/console/project/xmake.lua
+++ b/xmake/templates/objc/console/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -33,7 +33,7 @@ if os("macosx", "ios") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("binary")
diff --git a/xmake/templates/swift/console/project/xmake.lua b/xmake/templates/swift/console/project/xmake.lua
index b4ac31e27..45fe404a0 100644
--- a/xmake/templates/swift/console/project/xmake.lua
+++ b/xmake/templates/swift/console/project/xmake.lua
@@ -1,5 +1,5 @@
-- the debug mode
-if modes("debug") then
+if is_mode("debug") then
-- enable the debug symbols
set_symbols("debug")
@@ -9,7 +9,7 @@ if modes("debug") then
end
-- the release mode
-if modes("release") then
+if is_mode("release") then
-- set the symbols visibility: hidden
set_symbols("hidden")
@@ -22,7 +22,7 @@ if modes("release") then
end
-- add target
-def_target("[targetname]")
+target("[targetname]")
-- set kind
set_kind("binary")