summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-02-28 22:24:19 +0800
committerruki <[email protected]>2026-02-28 22:24:19 +0800
commit71824b87b8932acb2ff1177502b625a267367291 (patch)
tree331d476c7ecd9736b0f98c3fdd56bf3d6dbd9b92
parent5280c9480cb0d7d3ab55d516e296152ec273e14a (diff)
remove tbox templates
-rw-r--r--xmake/actions/create/main.lua30
-rw-r--r--xmake/actions/create/template.lua44
-rw-r--r--xmake/templates/c++/tbox.console/src/main.cpp15
-rw-r--r--xmake/templates/c++/tbox.console/src/xmake.lua15
-rw-r--r--xmake/templates/c++/tbox.console/xmake.lua21
-rw-r--r--xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.cpp11
-rw-r--r--xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.h22
-rw-r--r--xmake/templates/c++/tbox.shared/src/${TARGETNAME}/xmake.lua21
-rw-r--r--xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/main.cpp16
-rw-r--r--xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/xmake.lua7
-rw-r--r--xmake/templates/c++/tbox.shared/xmake.lua21
-rw-r--r--xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.cpp11
-rw-r--r--xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.h22
-rw-r--r--xmake/templates/c++/tbox.static/src/${TARGETNAME}/xmake.lua21
-rw-r--r--xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/main.cpp16
-rw-r--r--xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/xmake.lua7
-rw-r--r--xmake/templates/c++/tbox.static/xmake.lua21
-rw-r--r--xmake/templates/c/tbox.console/src/main.c15
-rw-r--r--xmake/templates/c/tbox.console/src/xmake.lua15
-rw-r--r--xmake/templates/c/tbox.console/xmake.lua19
-rw-r--r--xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.c11
-rw-r--r--xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.h22
-rw-r--r--xmake/templates/c/tbox.shared/src/${TARGETNAME}/xmake.lua21
-rw-r--r--xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/main.c16
-rw-r--r--xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/xmake.lua7
-rw-r--r--xmake/templates/c/tbox.shared/xmake.lua21
-rw-r--r--xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.c11
-rw-r--r--xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.h22
-rw-r--r--xmake/templates/c/tbox.static/src/${TARGETNAME}/xmake.lua21
-rw-r--r--xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/main.c16
-rw-r--r--xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/xmake.lua7
-rw-r--r--xmake/templates/c/tbox.static/xmake.lua21
32 files changed, 23 insertions, 543 deletions
diff --git a/xmake/actions/create/main.lua b/xmake/actions/create/main.lua
index b4f199b69..a544f9f15 100644
--- a/xmake/actions/create/main.lua
+++ b/xmake/actions/create/main.lua
@@ -24,15 +24,9 @@ import("core.project.project")
import("actions.create.template", {rootdir = os.programdir()})
-- create project from template
-function _create_project(language, templateid, targetname)
-
- -- check the targetname
+function _create_project(lang, templateid, targetname)
assert(targetname ~= ".", "you should specify ${red}-P${reset} instead of directly using ${red}.${reset}")
-
- -- check the language
- assert(language, "no language!")
-
- -- check the template id
+ assert(lang, "no language!")
assert(templateid, "no template id!")
-- get project directory
@@ -58,42 +52,38 @@ function _create_project(language, templateid, targetname)
os.cd(projectdir)
-- create project
- local sourcedir = template.templatedir(language, templateid)
- assert(os.isdir(sourcedir), "invalid template id: %s!", templateid)
+ local sourcedir = template.templatedir(lang, templateid)
+ assert(os.isdir(sourcedir), "template(%s/%s): not found!", lang, templateid)
-- get the builtin variables
local builtinvars = template.builtinvars(targetname)
- local createdfiles = template.copy_files(sourcedir, projectdir, builtinvars)
+ -- copy template project files
+ local createdfiles = template.copy_files(sourcedir, projectdir)
+ -- copy the default .gitignore
if not os.isfile(path.join(projectdir, ".gitignore")) then
os.cp(path.join(os.programdir(), "scripts", "gitignore"), path.join(projectdir, ".gitignore"))
table.insert(createdfiles, path.join(projectdir, ".gitignore"))
end
+ -- replace template variables
template.replace_variables_in_files(createdfiles, builtinvars)
+ -- done
table.sort(createdfiles)
for _, file in ipairs(createdfiles) do
cprint(" ${green}[+]: ${clear}%s", path.relative(file, projectdir))
end
end
--- main
function main()
-
-- enter the original working directory, because the default directory is in the project directory
os.cd(os.workingdir())
- -- the target name
+ -- create project from template
local targetname = option.get("target") or path.basename(project.directory()) or "demo"
-
- -- trace
cprint("${bright}create %s ...", targetname)
-
- -- create project from template
_create_project(option.get("language"), option.get("template"), targetname)
-
- -- trace
cprint("${color.success}create ok!")
end
diff --git a/xmake/actions/create/template.lua b/xmake/actions/create/template.lua
index dec10658f..e03cae6bb 100644
--- a/xmake/actions/create/template.lua
+++ b/xmake/actions/create/template.lua
@@ -23,53 +23,31 @@ function builtinvars(targetname)
FAQ = function() return io.readfile(path.join(os.programdir(), "scripts", "faq.lua")) end}
end
-function replace_variables_in_string(s, vars)
- local pattern = "%${(.-)}"
- return (s:gsub(pattern, function (variable)
- variable = variable:trim()
- local value = vars[variable]
- if value == nil then
- return "${" .. variable .. "}"
- end
- return type(value) == "function" and value() or tostring(value)
- end))
-end
-
-function is_binary_file(filepath)
- local file = io.open(filepath, "rb")
- if not file then
- return false
- end
- local data = file:read(4096) or ""
- file:close()
- return data:find("\0", 1, true) ~= nil
-end
-
+-- get template root directory
function templatedir(lang, templateid)
assert(lang)
assert(templateid)
return path.join(os.programdir(), "templates", lang, templateid)
end
-function copy_files(sourcedir, projectdir, vars)
+-- copy template files to project directory
+function copy_files(sourcedir, projectdir)
local createdfiles = {}
for _, srcfile in ipairs(os.files(path.join(sourcedir, "**"))) do
local relpath = path.relative(srcfile, sourcedir)
- if relpath ~= "template.lua" then
- local dstrelpath = replace_variables_in_string(relpath, vars)
- local dstfile = path.absolute(path.join(projectdir, dstrelpath))
- os.mkdir(path.directory(dstfile))
- os.cp(srcfile, dstfile, {writeable = true})
- table.insert(createdfiles, dstfile)
- end
+ local dstfile = path.absolute(path.join(projectdir, relpath))
+ os.mkdir(path.directory(dstfile))
+ os.cp(srcfile, dstfile, {writeable = true})
+ table.insert(createdfiles, dstfile)
end
return createdfiles
end
+-- replace variables in files
function replace_variables_in_files(files, vars)
local pattern = "%${(.-)}"
for _, file in ipairs(files) do
- if os.isfile(file) and not is_binary_file(file) then
+ if os.isfile(file) and path.filename(file) == "xmake.lua" then
io.gsub(file, "(" .. pattern .. ")", function(_, variable)
variable = variable:trim()
local value = vars[variable]
@@ -82,6 +60,7 @@ function replace_variables_in_files(files, vars)
end
end
+-- get all languages from templates
function languages()
local languages = {}
local languages_dirs = os.dirs(path.join(os.programdir(), "templates", "*"))
@@ -94,6 +73,7 @@ function languages()
return languages
end
+-- get all templates for the given language
function templates(lang)
assert(lang)
local results = {}
@@ -110,6 +90,7 @@ function templates(lang)
return results
end
+-- get languages for the given template
function languages_for_template(templateid)
local accepted = {}
for _, l in ipairs(languages()) do
@@ -120,6 +101,7 @@ function languages_for_template(templateid)
return accepted
end
+-- get templates with all supported languages
function templates_with_languages()
local templates_map = {}
for _, lang in ipairs(languages()) do
diff --git a/xmake/templates/c++/tbox.console/src/main.cpp b/xmake/templates/c++/tbox.console/src/main.cpp
deleted file mode 100644
index 2c7596b33..000000000
--- a/xmake/templates/c++/tbox.console/src/main.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "tbox/tbox.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * main
- */
-tb_int_t main(tb_int_t argc, tb_char_t **argv) {
- if (tb_init(tb_null, tb_null)) {
- tb_trace_i("hello tbox!");
- tb_exit();
- }
- return 0;
-}
diff --git a/xmake/templates/c++/tbox.console/src/xmake.lua b/xmake/templates/c++/tbox.console/src/xmake.lua
deleted file mode 100644
index fd618b9ee..000000000
--- a/xmake/templates/c++/tbox.console/src/xmake.lua
+++ /dev/null
@@ -1,15 +0,0 @@
--- add target
-target("${TARGETNAME}")
-
- -- set kind
- set_kind("binary")
-
- -- add definitions
- add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-
- -- add packages
- add_packages("tbox")
-
- -- add files
- add_files("*.cpp")
-
diff --git a/xmake/templates/c++/tbox.console/xmake.lua b/xmake/templates/c++/tbox.console/xmake.lua
deleted file mode 100644
index 8f8a824a1..000000000
--- a/xmake/templates/c++/tbox.console/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-set_xmakever("2.3.6")
-set_warnings("all", "error")
-set_languages("c99", "cxx11")
-add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-
-add_rules("mode.release", "mode.debug")
-add_requires("tbox", {debug = is_mode("debug")})
-
-if is_plat("windows") then
- if is_mode("release") then
- add_cxflags("-MT")
- elseif is_mode("debug") then
- add_cxflags("-MTd")
- end
- add_ldflags("-nodefaultlib:msvcrt.lib")
-end
-
-includes("src")
-
-${FAQ}
diff --git a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.cpp b/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.cpp
deleted file mode 100644
index ab0a826a6..000000000
--- a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * implementation
- */
-tb_int_t add(tb_int_t a, tb_int_t b) {
- return a + b;
-}
diff --git a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.h b/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.h
deleted file mode 100644
index 843ef1c98..000000000
--- a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/interface.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef INTERFACE_H
-#define INTERFACE_H
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "tbox/tbox.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_enter__
-
- __tb_export__ tb_int_t
- add(tb_int_t a, tb_int_t b);
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_leave__
-
-#endif
diff --git a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/xmake.lua b/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/xmake.lua
deleted file mode 100644
index 5c637ccda..000000000
--- a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
--- add target
-target("${TARGETNAME}")
-
- -- set kind
- set_kind("shared")
-
- -- add definitions
- add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-
- -- add the header files for installing
- add_headerfiles("../(${TARGETNAME}/**.h)")
-
- -- add includes directory
- add_includedirs("..", {interface = true})
-
- -- add packages
- add_packages("tbox")
-
- -- add files
- add_files("*.cpp")
-
diff --git a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/main.cpp b/xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/main.cpp
deleted file mode 100644
index b1e763989..000000000
--- a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/main.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "${TARGETNAME}/interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * main
- */
-tb_int_t main(tb_int_t argc, tb_char_t **argv) {
- if (tb_init(tb_null, tb_null)) {
- tb_trace_i("hello tbox!");
- tb_trace_i("add(1 + 1) = %d", add(1, 1));
- tb_exit();
- }
- return 0;
-}
diff --git a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/xmake.lua b/xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/xmake.lua
deleted file mode 100644
index fd2d629da..000000000
--- a/xmake/templates/c++/tbox.shared/src/${TARGETNAME}_demo/xmake.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-target("demo")
- set_kind("binary")
- add_deps("${TARGETNAME}")
- add_defines("__tb_prefix__=\"demo\"")
- add_files("*.cpp")
- add_packages("tbox")
-
diff --git a/xmake/templates/c++/tbox.shared/xmake.lua b/xmake/templates/c++/tbox.shared/xmake.lua
deleted file mode 100644
index 1cd6ebc79..000000000
--- a/xmake/templates/c++/tbox.shared/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-set_xmakever("2.3.6")
-set_warnings("all", "error")
-set_languages("c99", "cxx11")
-add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-
-add_rules("mode.release", "mode.debug")
-add_requires("tbox", {debug = is_mode("debug")})
-
-if is_plat("windows") then
- if is_mode("release") then
- add_cxflags("-MT")
- elseif is_mode("debug") then
- add_cxflags("-MTd")
- end
- add_ldflags("-nodefaultlib:msvcrt.lib")
-end
-
-includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
-
-${FAQ}
diff --git a/xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.cpp b/xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.cpp
deleted file mode 100644
index ab0a826a6..000000000
--- a/xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * implementation
- */
-tb_int_t add(tb_int_t a, tb_int_t b) {
- return a + b;
-}
diff --git a/xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.h b/xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.h
deleted file mode 100644
index caddb8394..000000000
--- a/xmake/templates/c++/tbox.static/src/${TARGETNAME}/interface.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef INTERFACE_H
-#define INTERFACE_H
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "tbox/tbox.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_enter__
-
- tb_int_t
- add(tb_int_t a, tb_int_t b);
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_leave__
-
-#endif
diff --git a/xmake/templates/c++/tbox.static/src/${TARGETNAME}/xmake.lua b/xmake/templates/c++/tbox.static/src/${TARGETNAME}/xmake.lua
deleted file mode 100644
index bdcf999f8..000000000
--- a/xmake/templates/c++/tbox.static/src/${TARGETNAME}/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
--- add target
-target("${TARGETNAME}")
-
- -- set kind
- set_kind("static")
-
- -- add definitions
- add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-
- -- add the header files for installing
- add_headerfiles("../(${TARGETNAME}/**.h)")
-
- -- add includes directory
- add_includedirs("..", {interface = true})
-
- -- add packages
- add_packages("tbox")
-
- -- add files
- add_files("*.cpp")
-
diff --git a/xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/main.cpp b/xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/main.cpp
deleted file mode 100644
index b1e763989..000000000
--- a/xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/main.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "${TARGETNAME}/interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * main
- */
-tb_int_t main(tb_int_t argc, tb_char_t **argv) {
- if (tb_init(tb_null, tb_null)) {
- tb_trace_i("hello tbox!");
- tb_trace_i("add(1 + 1) = %d", add(1, 1));
- tb_exit();
- }
- return 0;
-}
diff --git a/xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/xmake.lua b/xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/xmake.lua
deleted file mode 100644
index fd2d629da..000000000
--- a/xmake/templates/c++/tbox.static/src/${TARGETNAME}_demo/xmake.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-target("demo")
- set_kind("binary")
- add_deps("${TARGETNAME}")
- add_defines("__tb_prefix__=\"demo\"")
- add_files("*.cpp")
- add_packages("tbox")
-
diff --git a/xmake/templates/c++/tbox.static/xmake.lua b/xmake/templates/c++/tbox.static/xmake.lua
deleted file mode 100644
index 1cd6ebc79..000000000
--- a/xmake/templates/c++/tbox.static/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-set_xmakever("2.3.6")
-set_warnings("all", "error")
-set_languages("c99", "cxx11")
-add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-
-add_rules("mode.release", "mode.debug")
-add_requires("tbox", {debug = is_mode("debug")})
-
-if is_plat("windows") then
- if is_mode("release") then
- add_cxflags("-MT")
- elseif is_mode("debug") then
- add_cxflags("-MTd")
- end
- add_ldflags("-nodefaultlib:msvcrt.lib")
-end
-
-includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
-
-${FAQ}
diff --git a/xmake/templates/c/tbox.console/src/main.c b/xmake/templates/c/tbox.console/src/main.c
deleted file mode 100644
index 2c7596b33..000000000
--- a/xmake/templates/c/tbox.console/src/main.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "tbox/tbox.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * main
- */
-tb_int_t main(tb_int_t argc, tb_char_t **argv) {
- if (tb_init(tb_null, tb_null)) {
- tb_trace_i("hello tbox!");
- tb_exit();
- }
- return 0;
-}
diff --git a/xmake/templates/c/tbox.console/src/xmake.lua b/xmake/templates/c/tbox.console/src/xmake.lua
deleted file mode 100644
index 40847766c..000000000
--- a/xmake/templates/c/tbox.console/src/xmake.lua
+++ /dev/null
@@ -1,15 +0,0 @@
--- add target
-target("${TARGETNAME}")
-
- -- set kind
- set_kind("binary")
-
- -- add definitions
- add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-
- -- add packages
- add_packages("tbox")
-
- -- add files
- add_files("*.c")
-
diff --git a/xmake/templates/c/tbox.console/xmake.lua b/xmake/templates/c/tbox.console/xmake.lua
deleted file mode 100644
index 7c17dca1a..000000000
--- a/xmake/templates/c/tbox.console/xmake.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-set_xmakever("2.3.6")
-set_warnings("all", "error")
-set_languages("c99", "cxx11")
-add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-
-add_rules("mode.release", "mode.debug")
-add_requires("tbox", {debug = is_mode("debug")})
-
-if is_plat("windows") then
- if is_mode("release") then
- add_cxflags("-MT")
- elseif is_mode("debug") then
- add_cxflags("-MTd")
- end
- add_ldflags("-nodefaultlib:msvcrt.lib")
-end
-
-includes("src")
diff --git a/xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.c b/xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.c
deleted file mode 100644
index ab0a826a6..000000000
--- a/xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * implementation
- */
-tb_int_t add(tb_int_t a, tb_int_t b) {
- return a + b;
-}
diff --git a/xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.h b/xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.h
deleted file mode 100644
index 843ef1c98..000000000
--- a/xmake/templates/c/tbox.shared/src/${TARGETNAME}/interface.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef INTERFACE_H
-#define INTERFACE_H
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "tbox/tbox.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_enter__
-
- __tb_export__ tb_int_t
- add(tb_int_t a, tb_int_t b);
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_leave__
-
-#endif
diff --git a/xmake/templates/c/tbox.shared/src/${TARGETNAME}/xmake.lua b/xmake/templates/c/tbox.shared/src/${TARGETNAME}/xmake.lua
deleted file mode 100644
index 0c527e2b6..000000000
--- a/xmake/templates/c/tbox.shared/src/${TARGETNAME}/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
--- add target
-target("${TARGETNAME}")
-
- -- set kind
- set_kind("shared")
-
- -- add definitions
- add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-
- -- add the header files for installing
- add_headerfiles("../(${TARGETNAME}/**.h)")
-
- -- add includes directory
- add_includedirs("..", {interface = true})
-
- -- add packages
- add_packages("tbox")
-
- -- add files
- add_files("*.c")
-
diff --git a/xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/main.c b/xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/main.c
deleted file mode 100644
index b1e763989..000000000
--- a/xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/main.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "${TARGETNAME}/interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * main
- */
-tb_int_t main(tb_int_t argc, tb_char_t **argv) {
- if (tb_init(tb_null, tb_null)) {
- tb_trace_i("hello tbox!");
- tb_trace_i("add(1 + 1) = %d", add(1, 1));
- tb_exit();
- }
- return 0;
-}
diff --git a/xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/xmake.lua b/xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/xmake.lua
deleted file mode 100644
index 4b852d481..000000000
--- a/xmake/templates/c/tbox.shared/src/${TARGETNAME}_demo/xmake.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-target("demo")
- set_kind("binary")
- add_deps("${TARGETNAME}")
- add_defines("__tb_prefix__=\"demo\"")
- add_files("*.c")
- add_packages("tbox")
-
diff --git a/xmake/templates/c/tbox.shared/xmake.lua b/xmake/templates/c/tbox.shared/xmake.lua
deleted file mode 100644
index 1cd6ebc79..000000000
--- a/xmake/templates/c/tbox.shared/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-set_xmakever("2.3.6")
-set_warnings("all", "error")
-set_languages("c99", "cxx11")
-add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-
-add_rules("mode.release", "mode.debug")
-add_requires("tbox", {debug = is_mode("debug")})
-
-if is_plat("windows") then
- if is_mode("release") then
- add_cxflags("-MT")
- elseif is_mode("debug") then
- add_cxflags("-MTd")
- end
- add_ldflags("-nodefaultlib:msvcrt.lib")
-end
-
-includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
-
-${FAQ}
diff --git a/xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.c b/xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.c
deleted file mode 100644
index ab0a826a6..000000000
--- a/xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * implementation
- */
-tb_int_t add(tb_int_t a, tb_int_t b) {
- return a + b;
-}
diff --git a/xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.h b/xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.h
deleted file mode 100644
index caddb8394..000000000
--- a/xmake/templates/c/tbox.static/src/${TARGETNAME}/interface.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef INTERFACE_H
-#define INTERFACE_H
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "tbox/tbox.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_enter__
-
- tb_int_t
- add(tb_int_t a, tb_int_t b);
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * extern
- */
-__tb_extern_c_leave__
-
-#endif
diff --git a/xmake/templates/c/tbox.static/src/${TARGETNAME}/xmake.lua b/xmake/templates/c/tbox.static/src/${TARGETNAME}/xmake.lua
deleted file mode 100644
index 782c92616..000000000
--- a/xmake/templates/c/tbox.static/src/${TARGETNAME}/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
--- add target
-target("${TARGETNAME}")
-
- -- set kind
- set_kind("static")
-
- -- add definitions
- add_defines("__tb_prefix__=\"${TARGETNAME}\"")
-
- -- add the header files for installing
- add_headerfiles("../(${TARGETNAME}/**.h)")
-
- -- add includes directory
- add_includedirs("..", {interface = true})
-
- -- add packages
- add_packages("tbox")
-
- -- add files
- add_files("*.c")
-
diff --git a/xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/main.c b/xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/main.c
deleted file mode 100644
index b1e763989..000000000
--- a/xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/main.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* //////////////////////////////////////////////////////////////////////////////////////
- * includes
- */
-#include "${TARGETNAME}/interface.h"
-
-/* //////////////////////////////////////////////////////////////////////////////////////
- * main
- */
-tb_int_t main(tb_int_t argc, tb_char_t **argv) {
- if (tb_init(tb_null, tb_null)) {
- tb_trace_i("hello tbox!");
- tb_trace_i("add(1 + 1) = %d", add(1, 1));
- tb_exit();
- }
- return 0;
-}
diff --git a/xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/xmake.lua b/xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/xmake.lua
deleted file mode 100644
index 4b852d481..000000000
--- a/xmake/templates/c/tbox.static/src/${TARGETNAME}_demo/xmake.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-target("demo")
- set_kind("binary")
- add_deps("${TARGETNAME}")
- add_defines("__tb_prefix__=\"demo\"")
- add_files("*.c")
- add_packages("tbox")
-
diff --git a/xmake/templates/c/tbox.static/xmake.lua b/xmake/templates/c/tbox.static/xmake.lua
deleted file mode 100644
index 1cd6ebc79..000000000
--- a/xmake/templates/c/tbox.static/xmake.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-set_xmakever("2.3.6")
-set_warnings("all", "error")
-set_languages("c99", "cxx11")
-add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
-
-add_rules("mode.release", "mode.debug")
-add_requires("tbox", {debug = is_mode("debug")})
-
-if is_plat("windows") then
- if is_mode("release") then
- add_cxflags("-MT")
- elseif is_mode("debug") then
- add_cxflags("-MTd")
- end
- add_ldflags("-nodefaultlib:msvcrt.lib")
-end
-
-includes("src/${TARGETNAME}", "src/${TARGETNAME}_demo")
-
-${FAQ}