summaryrefslogtreecommitdiff
path: root/xmake/templates/c++
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/templates/c++')
-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
33 files changed, 93 insertions, 242 deletions
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)