summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-09-19 00:55:37 +0800
committerruki <[email protected]>2019-09-18 23:33:46 +0800
commit336029c68e4d0fc58bb55dca3ce5fb62bfdbf41b (patch)
tree68072128ac59708b7f56615e626d87e30ed951e2
parentbb3455b845e0b776937283b3ddae4ae557eea52e (diff)
rewrite templates
-rw-r--r--xmake/actions/create/main.lua9
-rw-r--r--xmake/core/project/template.lua4
-rw-r--r--xmake/templates/c++/console/project/xmake.lua3
-rw-r--r--xmake/templates/c++/console/template.lua16
-rw-r--r--xmake/templates/c++/qt.console/project/xmake.lua3
-rw-r--r--xmake/templates/c++/qt.console/template.lua16
-rw-r--r--xmake/templates/c++/qt.quickapp/project/xmake.lua6
-rw-r--r--xmake/templates/c++/qt.quickapp/template.lua16
-rw-r--r--xmake/templates/c++/qt.quickapp_static/project/xmake.lua5
-rw-r--r--xmake/templates/c++/qt.quickapp_static/template.lua16
-rw-r--r--xmake/templates/c++/qt.shared/project/xmake.lua6
-rw-r--r--xmake/templates/c++/qt.shared/template.lua16
-rw-r--r--xmake/templates/c++/qt.static/project/xmake.lua6
-rw-r--r--xmake/templates/c++/qt.static/template.lua16
-rw-r--r--xmake/templates/c++/qt.widgetapp/project/xmake.lua6
-rw-r--r--xmake/templates/c++/qt.widgetapp/template.lua16
-rw-r--r--xmake/templates/c++/qt.widgetapp_static/project/xmake.lua6
-rw-r--r--xmake/templates/c++/qt.widgetapp_static/template.lua16
-rw-r--r--xmake/templates/c++/shared/project/xmake.lua8
-rw-r--r--xmake/templates/c++/shared/template.lua16
-rw-r--r--xmake/templates/c++/static_library/project/xmake.lua8
-rw-r--r--xmake/templates/c++/static_library/template.lua16
-rw-r--r--xmake/templates/c++/tbox.console/project/src/xmake.lua4
-rw-r--r--xmake/templates/c++/tbox.console/project/xmake.lua2
-rw-r--r--xmake/templates/c++/tbox.console/template.lua16
-rw-r--r--xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp2
-rw-r--r--xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua6
-rw-r--r--xmake/templates/c++/tbox.shared/project/xmake.lua4
-rw-r--r--xmake/templates/c++/tbox.shared/template.lua34
-rw-r--r--xmake/templates/c++/tbox.static/project/src/_demo/main.cpp2
-rw-r--r--xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c++/tbox.static/project/src/_library/xmake.lua6
-rw-r--r--xmake/templates/c++/tbox.static/project/xmake.lua4
-rw-r--r--xmake/templates/c++/tbox.static/template.lua34
-rw-r--r--xmake/templates/c/console/project/xmake.lua3
-rw-r--r--xmake/templates/c/console/template.lua16
-rw-r--r--xmake/templates/c/shared/project/xmake.lua8
-rw-r--r--xmake/templates/c/shared/template.lua16
-rw-r--r--xmake/templates/c/static/project/xmake.lua9
-rw-r--r--xmake/templates/c/static/template.lua16
-rw-r--r--xmake/templates/c/tbox.console/project/src/xmake.lua4
-rw-r--r--xmake/templates/c/tbox.console/template.lua16
-rw-r--r--xmake/templates/c/tbox.shared/project/src/_demo/main.c2
-rw-r--r--xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c/tbox.shared/project/src/_library/xmake.lua6
-rw-r--r--xmake/templates/c/tbox.shared/project/xmake.lua4
-rw-r--r--xmake/templates/c/tbox.shared/template.lua34
-rw-r--r--xmake/templates/c/tbox.static/project/src/_demo/main.c2
-rw-r--r--xmake/templates/c/tbox.static/project/src/_demo/xmake.lua2
-rw-r--r--xmake/templates/c/tbox.static/project/src/_library/xmake.lua6
-rw-r--r--xmake/templates/c/tbox.static/project/xmake.lua4
-rw-r--r--xmake/templates/c/tbox.static/template.lua34
-rw-r--r--xmake/templates/cuda/console/project/xmake.lua4
-rw-r--r--xmake/templates/cuda/console/template.lua16
-rw-r--r--xmake/templates/cuda/shared/project/xmake.lua7
-rw-r--r--xmake/templates/cuda/shared/template.lua16
-rw-r--r--xmake/templates/cuda/static/project/xmake.lua7
-rw-r--r--xmake/templates/cuda/static/template.lua16
-rw-r--r--xmake/templates/dlang/console/project/xmake.lua4
-rw-r--r--xmake/templates/dlang/console/template.lua16
-rw-r--r--xmake/templates/dlang/shared/project/xmake.lua40
-rw-r--r--xmake/templates/dlang/shared/template.lua16
-rw-r--r--xmake/templates/dlang/static/project/xmake.lua40
-rw-r--r--xmake/templates/dlang/static/template.lua16
-rw-r--r--xmake/templates/go/console/project/xmake.lua4
-rw-r--r--xmake/templates/go/console/template.lua16
-rw-r--r--xmake/templates/go/static/project/xmake.lua26
-rw-r--r--xmake/templates/go/static/template.lua16
-rw-r--r--xmake/templates/objc++/console/project/xmake.lua45
-rw-r--r--xmake/templates/objc++/console/template.lua16
-rw-r--r--xmake/templates/objc/console/project/xmake.lua22
-rw-r--r--xmake/templates/objc/console/template.lua16
-rw-r--r--xmake/templates/rust/console/project/xmake.lua4
-rw-r--r--xmake/templates/rust/console/template.lua16
-rw-r--r--xmake/templates/rust/static/project/xmake.lua27
-rw-r--r--xmake/templates/rust/static/template.lua16
-rw-r--r--xmake/templates/swift/console/project/xmake.lua4
-rw-r--r--xmake/templates/swift/console/template.lua16
79 files changed, 239 insertions, 735 deletions
diff --git a/xmake/actions/create/main.lua b/xmake/actions/create/main.lua
index d2737c258..eeeb7ade4 100644
--- a/xmake/actions/create/main.lua
+++ b/xmake/actions/create/main.lua
@@ -43,6 +43,9 @@ function _create_project(tempinst, sourcedir, targetname)
-- copy the project files
os.cp(path.join(sourcedir, "*"), projectdir)
+ -- enter the project directory
+ os.cd(projectdir)
+
-- get the builtin variables
local builtinvars = _get_builtinvars(tempinst, targetname)
@@ -58,6 +61,12 @@ function _create_project(tempinst, sourcedir, targetname)
-- generate .gitignore
os.cp(path.join(os.programdir(), "scripts", "gitignore"), path.join(projectdir, ".gitignore"))
+
+ -- do after_create
+ local after_create = tempinst:get("create_after")
+ if after_create then
+ after_create(tempinst)
+ end
end
-- create project or files from template
diff --git a/xmake/core/project/template.lua b/xmake/core/project/template.lua
index 13cf1076e..8fd7fa6a5 100644
--- a/xmake/core/project/template.lua
+++ b/xmake/core/project/template.lua
@@ -82,8 +82,8 @@ function template._interpreter()
}
, script =
{
- -- on_xxx
- "template.on_create"
+ -- after_xxx
+ "template.after_create"
}
}
diff --git a/xmake/templates/c++/console/project/xmake.lua b/xmake/templates/c++/console/project/xmake.lua
index 86da6b2c0..5ea3f6136 100644
--- a/xmake/templates/c++/console/project/xmake.lua
+++ b/xmake/templates/c++/console/project/xmake.lua
@@ -3,7 +3,7 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -11,3 +11,4 @@ target("[targetname]")
-- add files
add_files("src/*.cpp")
+${FAQ}
diff --git a/xmake/templates/c++/console/template.lua b/xmake/templates/c++/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/c++/console/template.lua
+++ b/xmake/templates/c++/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/qt.console/project/xmake.lua b/xmake/templates/c++/qt.console/project/xmake.lua
index 5dba5a131..4025a7218 100644
--- a/xmake/templates/c++/qt.console/project/xmake.lua
+++ b/xmake/templates/c++/qt.console/project/xmake.lua
@@ -3,7 +3,7 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- add rules
add_rules("qt.console")
@@ -11,3 +11,4 @@ target("[targetname]")
-- add files
add_files("src/*.cpp")
+${FAQ}
diff --git a/xmake/templates/c++/qt.console/template.lua b/xmake/templates/c++/qt.console/template.lua
index 5ca8ed018..6b5c26b3a 100644
--- a/xmake/templates/c++/qt.console/template.lua
+++ b/xmake/templates/c++/qt.console/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("qt.console")
-
--- set description
-set_description("The Console Program (Qt)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("qt.console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/qt.quickapp/project/xmake.lua b/xmake/templates/c++/qt.quickapp/project/xmake.lua
index ed756850c..0a55677e8 100644
--- a/xmake/templates/c++/qt.quickapp/project/xmake.lua
+++ b/xmake/templates/c++/qt.quickapp/project/xmake.lua
@@ -3,16 +3,16 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- add rules
add_rules("qt.quickapp")
- -- add headers
+ -- add headerfiles
add_headerfiles("src/*.h")
-- add files
add_files("src/*.cpp")
add_files("src/qml.qrc")
-
+${FAQ}
diff --git a/xmake/templates/c++/qt.quickapp/template.lua b/xmake/templates/c++/qt.quickapp/template.lua
index 56e3adf6f..144deb174 100644
--- a/xmake/templates/c++/qt.quickapp/template.lua
+++ b/xmake/templates/c++/qt.quickapp/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("qt.quickapp")
-
--- set description
-set_description("The Quick Application (Qt)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("qt.quickapp")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/qt.quickapp_static/project/xmake.lua b/xmake/templates/c++/qt.quickapp_static/project/xmake.lua
index f341f724f..b606b5f20 100644
--- a/xmake/templates/c++/qt.quickapp_static/project/xmake.lua
+++ b/xmake/templates/c++/qt.quickapp_static/project/xmake.lua
@@ -6,12 +6,12 @@ add_rules("mode.debug", "mode.release")
includes("qt_add_static_plugins.lua")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- add rules
add_rules("qt.quickapp_static")
- -- add headers
+ -- add headerfiles
add_headerfiles("src/*.h")
-- add files
@@ -22,3 +22,4 @@ target("[targetname]")
qt_add_static_plugins("QtQuick2Plugin", {linkdirs = "qml/QtQuick.2", links = "qtquick2plugin"})
qt_add_static_plugins("QtQuick2WindowPlugin", {linkdirs = "qml/QtQuick/Window.2", links = "windowplugin"})
+${FAQ}
diff --git a/xmake/templates/c++/qt.quickapp_static/template.lua b/xmake/templates/c++/qt.quickapp_static/template.lua
index ab3239f58..ff528f69f 100644
--- a/xmake/templates/c++/qt.quickapp_static/template.lua
+++ b/xmake/templates/c++/qt.quickapp_static/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("qt.quickapp_static")
-
--- set description
-set_description("The Quick Application (Qt/Static)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("qt.quickapp_static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/qt.shared/project/xmake.lua b/xmake/templates/c++/qt.shared/project/xmake.lua
index 0f6894fe9..ac70b48de 100644
--- a/xmake/templates/c++/qt.shared/project/xmake.lua
+++ b/xmake/templates/c++/qt.shared/project/xmake.lua
@@ -3,12 +3,12 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- add rules
add_rules("qt.shared")
- -- add headers
+ -- add headerfiles
add_headerfiles("src/*.h")
-- add files
@@ -19,3 +19,5 @@ target("[targetname]")
-- add frameworks
add_frameworks("QtGui")
+
+${FAQ}
diff --git a/xmake/templates/c++/qt.shared/template.lua b/xmake/templates/c++/qt.shared/template.lua
index d98fae5c1..24960332a 100644
--- a/xmake/templates/c++/qt.shared/template.lua
+++ b/xmake/templates/c++/qt.shared/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("qt.shared")
-
--- set description
-set_description("The Share Library (Qt)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("qt.shared")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/qt.static/project/xmake.lua b/xmake/templates/c++/qt.static/project/xmake.lua
index e69a47e61..2bf4505c5 100644
--- a/xmake/templates/c++/qt.static/project/xmake.lua
+++ b/xmake/templates/c++/qt.static/project/xmake.lua
@@ -3,12 +3,12 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- add rules
add_rules("qt.static")
- -- add headers
+ -- add headerfiles
add_headerfiles("src/*.h")
-- add files
@@ -16,3 +16,5 @@ target("[targetname]")
-- add frameworks
add_frameworks("QtGui")
+
+${FAQ}
diff --git a/xmake/templates/c++/qt.static/template.lua b/xmake/templates/c++/qt.static/template.lua
index 60db73bcc..3a6f18019 100644
--- a/xmake/templates/c++/qt.static/template.lua
+++ b/xmake/templates/c++/qt.static/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("qt.static")
-
--- set description
-set_description("The Static Library (Qt)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("qt.static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/qt.widgetapp/project/xmake.lua b/xmake/templates/c++/qt.widgetapp/project/xmake.lua
index 8b7bd5ec8..e7407f1fd 100644
--- a/xmake/templates/c++/qt.widgetapp/project/xmake.lua
+++ b/xmake/templates/c++/qt.widgetapp/project/xmake.lua
@@ -3,12 +3,12 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- add rules
add_rules("qt.widgetapp")
- -- add headers
+ -- add headerfiles
add_headerfiles("src/*.h")
-- add files
@@ -18,4 +18,4 @@ target("[targetname]")
-- add files with Q_OBJECT meta (only for qt.moc)
add_files("src/mainwindow.h")
-
+${FAQ}
diff --git a/xmake/templates/c++/qt.widgetapp/template.lua b/xmake/templates/c++/qt.widgetapp/template.lua
index 94aeacb67..97a9fe3bb 100644
--- a/xmake/templates/c++/qt.widgetapp/template.lua
+++ b/xmake/templates/c++/qt.widgetapp/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("qt.widgetapp")
-
--- set description
-set_description("The Widget Application (Qt)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("qt.widgetapp")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua b/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua
index 3c8e46c85..fe4eb971c 100644
--- a/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua
+++ b/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua
@@ -6,12 +6,12 @@ add_rules("mode.debug", "mode.release")
includes("qt_add_static_plugins.lua")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- add rules
add_rules("qt.widgetapp_static")
- -- add headers
+ -- add headerfiles
add_headerfiles("src/*.h")
-- add files
@@ -23,3 +23,5 @@ target("[targetname]")
-- add plugin: QSvgPlugin (optional)
qt_add_static_plugins("QSvgPlugin", {linkdirs = "plugins/imageformats", links = {"qsvg", "Qt5Svg"}})
+
+${FAQ}
diff --git a/xmake/templates/c++/qt.widgetapp_static/template.lua b/xmake/templates/c++/qt.widgetapp_static/template.lua
index 8b3848e4d..6ccd9b178 100644
--- a/xmake/templates/c++/qt.widgetapp_static/template.lua
+++ b/xmake/templates/c++/qt.widgetapp_static/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("qt.widgetapp_static")
-
--- set description
-set_description("The Widget Application (Qt/Static)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("qt.widgetapp_static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/shared/project/xmake.lua b/xmake/templates/c++/shared/project/xmake.lua
index 59fe4dbe6..79ce52043 100644
--- a/xmake/templates/c++/shared/project/xmake.lua
+++ b/xmake/templates/c++/shared/project/xmake.lua
@@ -3,7 +3,7 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("shared")
@@ -12,15 +12,15 @@ target("[targetname]")
add_files("src/interface.cpp")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add files
add_files("src/test.cpp")
-
+${FAQ}
diff --git a/xmake/templates/c++/shared/template.lua b/xmake/templates/c++/shared/template.lua
index 666542844..d7ec5bae4 100644
--- a/xmake/templates/c++/shared/template.lua
+++ b/xmake/templates/c++/shared/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("shared")
-
--- set description
-set_description("The Shared Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("shared")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/static_library/project/xmake.lua b/xmake/templates/c++/static_library/project/xmake.lua
index 8375d78fe..c42aa839c 100644
--- a/xmake/templates/c++/static_library/project/xmake.lua
+++ b/xmake/templates/c++/static_library/project/xmake.lua
@@ -3,7 +3,7 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("static")
@@ -12,15 +12,15 @@ target("[targetname]")
add_files("src/interface.cpp")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add files
add_files("src/test.cpp")
-
+${FAQ}
diff --git a/xmake/templates/c++/static_library/template.lua b/xmake/templates/c++/static_library/template.lua
index f05045e07..abfe91a4b 100644
--- a/xmake/templates/c++/static_library/template.lua
+++ b/xmake/templates/c++/static_library/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("static")
-
--- set description
-set_description("The Static Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c++/tbox.console/project/src/xmake.lua b/xmake/templates/c++/tbox.console/project/src/xmake.lua
index 73adf9675..63056c764 100644
--- a/xmake/templates/c++/tbox.console/project/src/xmake.lua
+++ b/xmake/templates/c++/tbox.console/project/src/xmake.lua
@@ -1,11 +1,11 @@
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
-- add defines
- add_defines("__tb_prefix__=\"[targetname]\"")
+ add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-- add packages
add_packages("tbox")
diff --git a/xmake/templates/c++/tbox.console/project/xmake.lua b/xmake/templates/c++/tbox.console/project/xmake.lua
index 83a45434f..292b676c1 100644
--- a/xmake/templates/c++/tbox.console/project/xmake.lua
+++ b/xmake/templates/c++/tbox.console/project/xmake.lua
@@ -67,3 +67,5 @@ add_requires("tbox", {debug = is_mode("debug")})
-- include project sources
includes("src")
+
+${FAQ}
diff --git a/xmake/templates/c++/tbox.console/template.lua b/xmake/templates/c++/tbox.console/template.lua
index f1edee39b..850b65ee0 100644
--- a/xmake/templates/c++/tbox.console/template.lua
+++ b/xmake/templates/c++/tbox.console/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("tbox.console")
-
--- set description
-set_description("The Console Program (tbox)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("src/xmake.lua")
+template("tbox.console")
+ add_configfiles("src/xmake.lua")
diff --git a/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp b/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp
index 818ff6919..99a42f2a5 100644
--- a/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp
+++ b/xmake/templates/c++/tbox.shared/project/src/_demo/main.cpp
@@ -1,7 +1,7 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
-#include "[targetname]/interface.h"
+#include "${TARGETNAME}/interface.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* main
diff --git a/xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua b/xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua
index c6f24eed7..b17bd70b4 100644
--- a/xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua
+++ b/xmake/templates/c++/tbox.shared/project/src/_demo/xmake.lua
@@ -5,7 +5,7 @@ target("demo")
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add defines
add_defines("__tb_prefix__=\"demo\"")
diff --git a/xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua b/xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua
index 4f564356b..46559ec9d 100644
--- a/xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua
+++ b/xmake/templates/c++/tbox.shared/project/src/_library/xmake.lua
@@ -1,14 +1,14 @@
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("shared")
-- add defines
- add_defines("__tb_prefix__=\"[targetname]\"")
+ add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-- add the header files for installing
- add_headerfiles("../([targetname]/**.h)")
+ add_headerfiles("../(${TARGETNAME}/**.h)")
-- add includes directory
add_includedirs("..", {interface = true})
diff --git a/xmake/templates/c++/tbox.shared/project/xmake.lua b/xmake/templates/c++/tbox.shared/project/xmake.lua
index 1ebaa6e34..02a9271a3 100644
--- a/xmake/templates/c++/tbox.shared/project/xmake.lua
+++ b/xmake/templates/c++/tbox.shared/project/xmake.lua
@@ -66,4 +66,6 @@ else add_syslinks("pthread", "dl", "m", "c") end
add_requires("tbox", {debug = is_mode("debug")})
-- include project sources
-includes("src/[targetname]", "src/[targetname]_demo")
+includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
+
+${FAQ}
diff --git a/xmake/templates/c++/tbox.shared/template.lua b/xmake/templates/c++/tbox.shared/template.lua
index 31bd81e93..b89f57c26 100644
--- a/xmake/templates/c++/tbox.shared/template.lua
+++ b/xmake/templates/c++/tbox.shared/template.lua
@@ -1,25 +1,9 @@
--- set name
-set_name("tbox.shared")
-
--- set description
-set_description("The Shared Library (tbox)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
-add_macrofiles("src/_demo/main.cpp")
-add_macrofiles("src/_demo/xmake.lua")
-add_macrofiles("src/_library/xmake.lua")
-
--- set create script
-on_create(function ()
-
- -- rename target directory
- os.mv("src/_library", "src/$(targetname)")
- os.mv("src/_demo", "src/$(targetname)_demo")
-end)
+template("tbox.shared")
+ add_configfiles("xmake.lua")
+ add_configfiles("src/_demo/main.cpp")
+ add_configfiles("src/_demo/xmake.lua")
+ add_configfiles("src/_library/xmake.lua")
+ after_create(function (template)
+ os.mv("src/_library", "src/${TARGETNAME}")
+ os.mv("src/_demo", "src/${TARGETNAME}_demo")
+ end)
diff --git a/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp b/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp
index 818ff6919..99a42f2a5 100644
--- a/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp
+++ b/xmake/templates/c++/tbox.static/project/src/_demo/main.cpp
@@ -1,7 +1,7 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
-#include "[targetname]/interface.h"
+#include "${TARGETNAME}/interface.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* main
diff --git a/xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua b/xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua
index c6f24eed7..b17bd70b4 100644
--- a/xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua
+++ b/xmake/templates/c++/tbox.static/project/src/_demo/xmake.lua
@@ -5,7 +5,7 @@ target("demo")
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add defines
add_defines("__tb_prefix__=\"demo\"")
diff --git a/xmake/templates/c++/tbox.static/project/src/_library/xmake.lua b/xmake/templates/c++/tbox.static/project/src/_library/xmake.lua
index 71a5e698f..cb5f26ec6 100644
--- a/xmake/templates/c++/tbox.static/project/src/_library/xmake.lua
+++ b/xmake/templates/c++/tbox.static/project/src/_library/xmake.lua
@@ -1,14 +1,14 @@
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("static")
-- add defines
- add_defines("__tb_prefix__=\"[targetname]\"")
+ add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-- add the header files for installing
- add_headerfiles("../([targetname]/**.h)")
+ add_headerfiles("../(${TARGETNAME}/**.h)")
-- add includes directory
add_includedirs("..", {interface = true})
diff --git a/xmake/templates/c++/tbox.static/project/xmake.lua b/xmake/templates/c++/tbox.static/project/xmake.lua
index 1ebaa6e34..02a9271a3 100644
--- a/xmake/templates/c++/tbox.static/project/xmake.lua
+++ b/xmake/templates/c++/tbox.static/project/xmake.lua
@@ -66,4 +66,6 @@ else add_syslinks("pthread", "dl", "m", "c") end
add_requires("tbox", {debug = is_mode("debug")})
-- include project sources
-includes("src/[targetname]", "src/[targetname]_demo")
+includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
+
+${FAQ}
diff --git a/xmake/templates/c++/tbox.static/template.lua b/xmake/templates/c++/tbox.static/template.lua
index a9acb2caa..b49207e48 100644
--- a/xmake/templates/c++/tbox.static/template.lua
+++ b/xmake/templates/c++/tbox.static/template.lua
@@ -1,25 +1,9 @@
--- set name
-set_name("tbox.static")
-
--- set description
-set_description("The Static Library (tbox)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
-add_macrofiles("src/_demo/main.cpp")
-add_macrofiles("src/_demo/xmake.lua")
-add_macrofiles("src/_library/xmake.lua")
-
--- set create script
-on_create(function ()
-
- -- rename target directory
- os.mv("src/_library", "src/$(targetname)")
- os.mv("src/_demo", "src/$(targetname)_demo")
-end)
+template("tbox.static")
+ add_configfiles("xmake.lua")
+ add_configfiles("src/_demo/main.cpp")
+ add_configfiles("src/_demo/xmake.lua")
+ add_configfiles("src/_library/xmake.lua")
+ after_create(function (template)
+ os.mv("src/_library", "src/${TARGETNAME}")
+ os.mv("src/_demo", "src/${TARGETNAME}_demo")
+ end)
diff --git a/xmake/templates/c/console/project/xmake.lua b/xmake/templates/c/console/project/xmake.lua
index d0bffccc8..dedb01e53 100644
--- a/xmake/templates/c/console/project/xmake.lua
+++ b/xmake/templates/c/console/project/xmake.lua
@@ -3,7 +3,7 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -11,3 +11,4 @@ target("[targetname]")
-- add files
add_files("src/*.c")
+${FAQ}
diff --git a/xmake/templates/c/console/template.lua b/xmake/templates/c/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/c/console/template.lua
+++ b/xmake/templates/c/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c/shared/project/xmake.lua b/xmake/templates/c/shared/project/xmake.lua
index 4a52ee6d0..4aaddabc9 100644
--- a/xmake/templates/c/shared/project/xmake.lua
+++ b/xmake/templates/c/shared/project/xmake.lua
@@ -3,7 +3,7 @@
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("shared")
@@ -12,15 +12,15 @@ target("[targetname]")
add_files("src/interface.c")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add files
add_files("src/test.c")
-
+${FAQ}
diff --git a/xmake/templates/c/shared/template.lua b/xmake/templates/c/shared/template.lua
index 666542844..d7ec5bae4 100644
--- a/xmake/templates/c/shared/template.lua
+++ b/xmake/templates/c/shared/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("shared")
-
--- set description
-set_description("The Shared Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("shared")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c/static/project/xmake.lua b/xmake/templates/c/static/project/xmake.lua
index 04d422083..a01a4407d 100644
--- a/xmake/templates/c/static/project/xmake.lua
+++ b/xmake/templates/c/static/project/xmake.lua
@@ -1,9 +1,8 @@
-
-- add modes: debug and release
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("static")
@@ -12,15 +11,15 @@ target("[targetname]")
add_files("src/interface.c")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add files
add_files("src/test.c")
-
+${FAQ}
diff --git a/xmake/templates/c/static/template.lua b/xmake/templates/c/static/template.lua
index f05045e07..abfe91a4b 100644
--- a/xmake/templates/c/static/template.lua
+++ b/xmake/templates/c/static/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("static")
-
--- set description
-set_description("The Static Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/c/tbox.console/project/src/xmake.lua b/xmake/templates/c/tbox.console/project/src/xmake.lua
index 3f528a7ec..16287c25b 100644
--- a/xmake/templates/c/tbox.console/project/src/xmake.lua
+++ b/xmake/templates/c/tbox.console/project/src/xmake.lua
@@ -1,11 +1,11 @@
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
-- add defines
- add_defines("__tb_prefix__=\"[targetname]\"")
+ add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-- add packages
add_packages("tbox")
diff --git a/xmake/templates/c/tbox.console/template.lua b/xmake/templates/c/tbox.console/template.lua
index f1edee39b..850b65ee0 100644
--- a/xmake/templates/c/tbox.console/template.lua
+++ b/xmake/templates/c/tbox.console/template.lua
@@ -1,15 +1,3 @@
--- set name
-set_name("tbox.console")
-
--- set description
-set_description("The Console Program (tbox)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("src/xmake.lua")
+template("tbox.console")
+ add_configfiles("src/xmake.lua")
diff --git a/xmake/templates/c/tbox.shared/project/src/_demo/main.c b/xmake/templates/c/tbox.shared/project/src/_demo/main.c
index 818ff6919..99a42f2a5 100644
--- a/xmake/templates/c/tbox.shared/project/src/_demo/main.c
+++ b/xmake/templates/c/tbox.shared/project/src/_demo/main.c
@@ -1,7 +1,7 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
-#include "[targetname]/interface.h"
+#include "${TARGETNAME}/interface.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* main
diff --git a/xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua b/xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua
index c62ddcec5..145096668 100644
--- a/xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua
+++ b/xmake/templates/c/tbox.shared/project/src/_demo/xmake.lua
@@ -5,7 +5,7 @@ target("demo")
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add defines
add_defines("__tb_prefix__=\"demo\"")
diff --git a/xmake/templates/c/tbox.shared/project/src/_library/xmake.lua b/xmake/templates/c/tbox.shared/project/src/_library/xmake.lua
index cb36ba3b8..1941864d0 100644
--- a/xmake/templates/c/tbox.shared/project/src/_library/xmake.lua
+++ b/xmake/templates/c/tbox.shared/project/src/_library/xmake.lua
@@ -1,14 +1,14 @@
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("shared")
-- add defines
- add_defines("__tb_prefix__=\"[targetname]\"")
+ add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-- add the header files for installing
- add_headerfiles("../([targetname]/**.h)")
+ add_headerfiles("../(${TARGETNAME}/**.h)")
-- add includes directory
add_includedirs("..", {interface = true})
diff --git a/xmake/templates/c/tbox.shared/project/xmake.lua b/xmake/templates/c/tbox.shared/project/xmake.lua
index 1ebaa6e34..02a9271a3 100644
--- a/xmake/templates/c/tbox.shared/project/xmake.lua
+++ b/xmake/templates/c/tbox.shared/project/xmake.lua
@@ -66,4 +66,6 @@ else add_syslinks("pthread", "dl", "m", "c") end
add_requires("tbox", {debug = is_mode("debug")})
-- include project sources
-includes("src/[targetname]", "src/[targetname]_demo")
+includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
+
+${FAQ}
diff --git a/xmake/templates/c/tbox.shared/template.lua b/xmake/templates/c/tbox.shared/template.lua
index c64f17262..57f706e99 100644
--- a/xmake/templates/c/tbox.shared/template.lua
+++ b/xmake/templates/c/tbox.shared/template.lua
@@ -1,25 +1,9 @@
--- set name
-set_name("tbox.shared")
-
--- set description
-set_description("The Shared Library (tbox)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
-add_macrofiles("src/_demo/main.c")
-add_macrofiles("src/_demo/xmake.lua")
-add_macrofiles("src/_library/xmake.lua")
-
--- set create script
-on_create(function ()
-
- -- rename target directory
- os.mv("src/_library", "src/$(targetname)")
- os.mv("src/_demo", "src/$(targetname)_demo")
-end)
+template("tbox.shared")
+ add_configfiles("xmake.lua")
+ add_configfiles("src/_demo/main.c")
+ add_configfiles("src/_demo/xmake.lua")
+ add_configfiles("src/_library/xmake.lua")
+ after_create(function (template)
+ os.mv("src/_library", "src/${TARGETNAME}")
+ os.mv("src/_demo", "src/${TARGETNAME}_demo")
+ end)
diff --git a/xmake/templates/c/tbox.static/project/src/_demo/main.c b/xmake/templates/c/tbox.static/project/src/_demo/main.c
index 818ff6919..99a42f2a5 100644
--- a/xmake/templates/c/tbox.static/project/src/_demo/main.c
+++ b/xmake/templates/c/tbox.static/project/src/_demo/main.c
@@ -1,7 +1,7 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
-#include "[targetname]/interface.h"
+#include "${TARGETNAME}/interface.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* main
diff --git a/xmake/templates/c/tbox.static/project/src/_demo/xmake.lua b/xmake/templates/c/tbox.static/project/src/_demo/xmake.lua
index c62ddcec5..145096668 100644
--- a/xmake/templates/c/tbox.static/project/src/_demo/xmake.lua
+++ b/xmake/templates/c/tbox.static/project/src/_demo/xmake.lua
@@ -5,7 +5,7 @@ target("demo")
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add defines
add_defines("__tb_prefix__=\"demo\"")
diff --git a/xmake/templates/c/tbox.static/project/src/_library/xmake.lua b/xmake/templates/c/tbox.static/project/src/_library/xmake.lua
index 45967cabc..bfc40162e 100644
--- a/xmake/templates/c/tbox.static/project/src/_library/xmake.lua
+++ b/xmake/templates/c/tbox.static/project/src/_library/xmake.lua
@@ -1,14 +1,14 @@
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("static")
-- add defines
- add_defines("__tb_prefix__=\"[targetname]\"")
+ add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-- add the header files for installing
- add_headerfiles("../([targetname]/**.h)")
+ add_headerfiles("../(${TARGETNAME}/**.h)")
-- add includes directory
add_includedirs("..", {interface = true})
diff --git a/xmake/templates/c/tbox.static/project/xmake.lua b/xmake/templates/c/tbox.static/project/xmake.lua
index 1ebaa6e34..02a9271a3 100644
--- a/xmake/templates/c/tbox.static/project/xmake.lua
+++ b/xmake/templates/c/tbox.static/project/xmake.lua
@@ -66,4 +66,6 @@ else add_syslinks("pthread", "dl", "m", "c") end
add_requires("tbox", {debug = is_mode("debug")})
-- include project sources
-includes("src/[targetname]", "src/[targetname]_demo")
+includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
+
+${FAQ}
diff --git a/xmake/templates/c/tbox.static/template.lua b/xmake/templates/c/tbox.static/template.lua
index 9ddc683f7..8d71d43ee 100644
--- a/xmake/templates/c/tbox.static/template.lua
+++ b/xmake/templates/c/tbox.static/template.lua
@@ -1,25 +1,9 @@
--- set name
-set_name("tbox.static")
-
--- set description
-set_description("The Static Library (tbox)")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
-add_macrofiles("src/_demo/main.c")
-add_macrofiles("src/_demo/xmake.lua")
-add_macrofiles("src/_library/xmake.lua")
-
--- set create script
-on_create(function ()
-
- -- rename target directory
- os.mv("src/_library", "src/$(targetname)")
- os.mv("src/_demo", "src/$(targetname)_demo")
-end)
+template("tbox.static")
+ add_configfiles("xmake.lua")
+ add_configfiles("src/_demo/main.c")
+ add_configfiles("src/_demo/xmake.lua")
+ add_configfiles("src/_library/xmake.lua")
+ after_create(function (template)
+ os.mv("src/_library", "src/${TARGETNAME}")
+ os.mv("src/_demo", "src/${TARGETNAME}_demo")
+ end)
diff --git a/xmake/templates/cuda/console/project/xmake.lua b/xmake/templates/cuda/console/project/xmake.lua
index deee20adf..6521e605c 100644
--- a/xmake/templates/cuda/console/project/xmake.lua
+++ b/xmake/templates/cuda/console/project/xmake.lua
@@ -3,7 +3,7 @@
add_rules("mode.debug", "mode.release")
-- define target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -28,3 +28,5 @@ target("[targetname]")
-- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility
-- add_cugencodes("compute_75")
+
+${FAQ}
diff --git a/xmake/templates/cuda/console/template.lua b/xmake/templates/cuda/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/cuda/console/template.lua
+++ b/xmake/templates/cuda/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/cuda/shared/project/xmake.lua b/xmake/templates/cuda/shared/project/xmake.lua
index ceef4438d..8f854764f 100644
--- a/xmake/templates/cuda/shared/project/xmake.lua
+++ b/xmake/templates/cuda/shared/project/xmake.lua
@@ -3,14 +3,11 @@
add_rules("mode.debug", "mode.release")
-- define target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("shared")
- -- add modes: debug and release
- add_rules("mode.debug", "mode.release")
-
-- add include dirs
add_includedirs("inc")
@@ -34,3 +31,5 @@ target("[targetname]")
-- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility
-- add_cugencodes("compute_75")
+
+${FAQ}
diff --git a/xmake/templates/cuda/shared/template.lua b/xmake/templates/cuda/shared/template.lua
index 6df920968..d7ec5bae4 100644
--- a/xmake/templates/cuda/shared/template.lua
+++ b/xmake/templates/cuda/shared/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("shared")
-
--- set description
-set_description("The Shared Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua") \ No newline at end of file
+template("shared")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/cuda/static/project/xmake.lua b/xmake/templates/cuda/static/project/xmake.lua
index 3896fb238..5e22ba152 100644
--- a/xmake/templates/cuda/static/project/xmake.lua
+++ b/xmake/templates/cuda/static/project/xmake.lua
@@ -3,14 +3,11 @@
add_rules("mode.debug", "mode.release")
-- define target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("static")
- -- add modes: debug and release
- add_rules("mode.debug", "mode.release")
-
-- add include dirs
add_includedirs("inc")
@@ -34,3 +31,5 @@ target("[targetname]")
-- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility
-- add_cugencodes("compute_75")
+
+${FAQ}
diff --git a/xmake/templates/cuda/static/template.lua b/xmake/templates/cuda/static/template.lua
index ff9c56179..abfe91a4b 100644
--- a/xmake/templates/cuda/static/template.lua
+++ b/xmake/templates/cuda/static/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("static")
-
--- set description
-set_description("The Static Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua") \ No newline at end of file
+template("static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/dlang/console/project/xmake.lua b/xmake/templates/dlang/console/project/xmake.lua
index de662d1b4..9f27dbf7f 100644
--- a/xmake/templates/dlang/console/project/xmake.lua
+++ b/xmake/templates/dlang/console/project/xmake.lua
@@ -1,9 +1,8 @@
-
-- add modes: debug and release
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -11,3 +10,4 @@ target("[targetname]")
-- add files
add_files("src/*.d")
+${FAQ}
diff --git a/xmake/templates/dlang/console/template.lua b/xmake/templates/dlang/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/dlang/console/template.lua
+++ b/xmake/templates/dlang/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/dlang/shared/project/xmake.lua b/xmake/templates/dlang/shared/project/xmake.lua
index 962994618..7fe11f488 100644
--- a/xmake/templates/dlang/shared/project/xmake.lua
+++ b/xmake/templates/dlang/shared/project/xmake.lua
@@ -1,28 +1,8 @@
--- the debug mode
-if is_mode("debug") then
-
- -- enable the debug symbols
- set_symbols("debug")
-
- -- disable optimization
- set_optimize("none")
-end
-
--- the release mode
-if is_mode("release") then
-
- -- set the symbols visibility: hidden
- set_symbols("hidden")
-
- -- enable fastest optimization
- set_optimize("fastest")
-
- -- strip all symbols
- set_strip("all")
-end
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("shared")
@@ -31,23 +11,15 @@ target("[targetname]")
add_files("src/interfaces.d")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
-- add deps
- add_deps("test")
+ add_deps("${TARGETNAME}")
-- add files
add_files("src/main.d")
- -- add links
- add_links("[targetname]")
-
- -- add link directory
- add_linkdirs("$(buildir)")
-
- -- add include directory
- add_includedirs("$(projectdir)/src")
-
+${FAQ}
diff --git a/xmake/templates/dlang/shared/template.lua b/xmake/templates/dlang/shared/template.lua
index 666542844..d7ec5bae4 100644
--- a/xmake/templates/dlang/shared/template.lua
+++ b/xmake/templates/dlang/shared/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("shared")
-
--- set description
-set_description("The Shared Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("shared")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/dlang/static/project/xmake.lua b/xmake/templates/dlang/static/project/xmake.lua
index 8cc9d7d9d..6a3d805ad 100644
--- a/xmake/templates/dlang/static/project/xmake.lua
+++ b/xmake/templates/dlang/static/project/xmake.lua
@@ -1,28 +1,8 @@
--- the debug mode
-if is_mode("debug") then
-
- -- enable the debug symbols
- set_symbols("debug")
-
- -- disable optimization
- set_optimize("none")
-end
-
--- the release mode
-if is_mode("release") then
-
- -- set the symbols visibility: hidden
- set_symbols("hidden")
-
- -- enable fastest optimization
- set_optimize("fastest")
-
- -- strip all symbols
- set_strip("all")
-end
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("static")
@@ -31,23 +11,15 @@ target("[targetname]")
add_files("src/interfaces.d")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
-- add deps
- add_deps("[targetname]")
+ add_deps("${TARGETNAME}")
-- add files
add_files("src/main.d")
- -- add links
- add_links("[targetname]")
-
- -- add link directory
- add_linkdirs("$(buildir)")
-
- -- add include directory
- add_includedirs("$(projectdir)/src")
-
+${FAQ}
diff --git a/xmake/templates/dlang/static/template.lua b/xmake/templates/dlang/static/template.lua
index f05045e07..abfe91a4b 100644
--- a/xmake/templates/dlang/static/template.lua
+++ b/xmake/templates/dlang/static/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("static")
-
--- set description
-set_description("The Static Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/go/console/project/xmake.lua b/xmake/templates/go/console/project/xmake.lua
index 090935ed2..35f458b68 100644
--- a/xmake/templates/go/console/project/xmake.lua
+++ b/xmake/templates/go/console/project/xmake.lua
@@ -1,9 +1,8 @@
-
-- add modes: debug and release
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -11,3 +10,4 @@ target("[targetname]")
-- add files
add_files("src/*.go")
+${FAQ}
diff --git a/xmake/templates/go/console/template.lua b/xmake/templates/go/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/go/console/template.lua
+++ b/xmake/templates/go/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/go/static/project/xmake.lua b/xmake/templates/go/static/project/xmake.lua
index ddf3b14c5..3c0f05209 100644
--- a/xmake/templates/go/static/project/xmake.lua
+++ b/xmake/templates/go/static/project/xmake.lua
@@ -1,26 +1,3 @@
--- the debug mode
-if is_mode("debug") then
-
- -- enable the debug symbols
- set_symbols("debug")
-
- -- disable optimization
- set_optimize("none")
-end
-
--- the release mode
-if is_mode("release") then
-
- -- set the symbols visibility: hidden
- set_symbols("hidden")
-
- -- enable fastest optimization
- set_optimize("fastest")
-
- -- strip all symbols
- set_strip("all")
-end
-
-- add target
target("module")
@@ -31,7 +8,7 @@ target("module")
add_files("src/test/*.go")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
@@ -48,3 +25,4 @@ target("[targetname]_demo")
-- add include directory
add_includedirs("$(buildir)")
+${FAQ}
diff --git a/xmake/templates/go/static/template.lua b/xmake/templates/go/static/template.lua
index f05045e07..abfe91a4b 100644
--- a/xmake/templates/go/static/template.lua
+++ b/xmake/templates/go/static/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("static")
-
--- set description
-set_description("The Static Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/objc++/console/project/xmake.lua b/xmake/templates/objc++/console/project/xmake.lua
index 68cba346c..736de146c 100644
--- a/xmake/templates/objc++/console/project/xmake.lua
+++ b/xmake/templates/objc++/console/project/xmake.lua
@@ -1,38 +1,8 @@
--- the debug mode
-if is_mode("debug") then
-
- -- enable the debug symbols
- set_symbols("debug")
-
- -- disable optimization
- set_optimize("none")
-end
-
--- the release mode
-if is_mode("release") then
-
- -- set the symbols visibility: hidden
- set_symbols("hidden")
-
- -- enable fastest optimization
- set_optimize("fastest")
-
- -- strip all symbols
- set_strip("all")
-end
-
--- add frameworks
-add_frameworks("Foundation", "CoreFoundation")
-
--- for macosx or ios
-if is_os("macosx", "ios") then
-
- -- enable arc?
- add_mxflags("-fobjc-arc")
-end
+-- add modes: debug and release
+add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -40,3 +10,12 @@ target("[targetname]")
-- add files
add_files("src/*.mm")
+ -- for macosx or ios
+ if is_os("macosx", "ios") then
+ add_mxflags("-fobjc-arc")
+ end
+
+ -- add frameworks
+ add_frameworks("Foundation", "CoreFoundation")
+
+${FAQ}
diff --git a/xmake/templates/objc++/console/template.lua b/xmake/templates/objc++/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/objc++/console/template.lua
+++ b/xmake/templates/objc++/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/objc/console/project/xmake.lua b/xmake/templates/objc/console/project/xmake.lua
index 0477ea739..199d79528 100644
--- a/xmake/templates/objc/console/project/xmake.lua
+++ b/xmake/templates/objc/console/project/xmake.lua
@@ -1,19 +1,8 @@
-
-- add modes: debug and release
add_rules("mode.debug", "mode.release")
--- add frameworks
-add_frameworks("Foundation", "CoreFoundation")
-
--- for macosx or ios
-if is_os("macosx", "ios") then
-
- -- enable arc?
- add_mxflags("-fobjc-arc")
-end
-
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -21,3 +10,12 @@ target("[targetname]")
-- add files
add_files("src/*.m")
+ -- add frameworks
+ add_frameworks("Foundation", "CoreFoundation")
+
+ -- for macosx or ios
+ if is_os("macosx", "ios") then
+ add_mxflags("-fobjc-arc")
+ end
+
+${FAQ}
diff --git a/xmake/templates/objc/console/template.lua b/xmake/templates/objc/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/objc/console/template.lua
+++ b/xmake/templates/objc/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/rust/console/project/xmake.lua b/xmake/templates/rust/console/project/xmake.lua
index e67de58ab..15fafa7f2 100644
--- a/xmake/templates/rust/console/project/xmake.lua
+++ b/xmake/templates/rust/console/project/xmake.lua
@@ -1,9 +1,8 @@
-
-- add modes: debug and release
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -11,3 +10,4 @@ target("[targetname]")
-- add files
add_files("src/*.rs")
+${FAQ}
diff --git a/xmake/templates/rust/console/template.lua b/xmake/templates/rust/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/rust/console/template.lua
+++ b/xmake/templates/rust/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/rust/static/project/xmake.lua b/xmake/templates/rust/static/project/xmake.lua
index c3a5b497a..fcaaa55f7 100644
--- a/xmake/templates/rust/static/project/xmake.lua
+++ b/xmake/templates/rust/static/project/xmake.lua
@@ -1,26 +1,3 @@
--- the debug mode
-if is_mode("debug") then
-
- -- enable the debug symbols
- set_symbols("debug")
-
- -- disable optimization
- set_optimize("none")
-end
-
--- the release mode
-if is_mode("release") then
-
- -- set the symbols visibility: hidden
- set_symbols("hidden")
-
- -- enable fastest optimization
- set_optimize("fastest")
-
- -- strip all symbols
- set_strip("all")
-end
-
-- add target
target("interfaces")
@@ -31,7 +8,7 @@ target("interfaces")
add_files("src/interfaces.rs")
-- add target
-target("[targetname]_demo")
+target("${TARGETNAME}_demo")
-- set kind
set_kind("binary")
@@ -45,4 +22,4 @@ target("[targetname]_demo")
-- add link directory
add_linkdirs("$(buildir)")
-
+${FAQ}
diff --git a/xmake/templates/rust/static/template.lua b/xmake/templates/rust/static/template.lua
index f05045e07..abfe91a4b 100644
--- a/xmake/templates/rust/static/template.lua
+++ b/xmake/templates/rust/static/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("static")
-
--- set description
-set_description("The Static Library")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("static")
+ add_configfiles("xmake.lua")
diff --git a/xmake/templates/swift/console/project/xmake.lua b/xmake/templates/swift/console/project/xmake.lua
index b9e0d0f9a..4b8c614fa 100644
--- a/xmake/templates/swift/console/project/xmake.lua
+++ b/xmake/templates/swift/console/project/xmake.lua
@@ -1,9 +1,8 @@
-
-- add modes: debug and release
add_rules("mode.debug", "mode.release")
-- add target
-target("[targetname]")
+target("${TARGETNAME}")
-- set kind
set_kind("binary")
@@ -11,3 +10,4 @@ target("[targetname]")
-- add files
add_files("src/*.swift")
+${FAQ}
diff --git a/xmake/templates/swift/console/template.lua b/xmake/templates/swift/console/template.lua
index 52c362723..ed2e13b57 100644
--- a/xmake/templates/swift/console/template.lua
+++ b/xmake/templates/swift/console/template.lua
@@ -1,14 +1,2 @@
--- set name
-set_name("console")
-
--- set description
-set_description("The Console Program")
-
--- set project directory
-set_projectdir("project")
-
--- add macros
-add_macros("targetname", "$(targetname)")
-
--- add macro files
-add_macrofiles("xmake.lua")
+template("console")
+ add_configfiles("xmake.lua")