summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-20 20:34:37 +0800
committerruki <[email protected]>2015-06-20 20:34:37 +0800
commita3f92451ca522092bd12e0c64a73b1154993253d (patch)
treea85127fb03d430cd25ee65db410aee944321ce8e
parent8452df53aca437c49963afdf9738022c198365a5 (diff)
install c++ console template
-rw-r--r--xmake/scripts/platform/platform.lua6
-rw-r--r--xmake/templates/c++/console/_template.lua32
-rw-r--r--xmake/templates/c++/console/project/xmake.lua4
-rw-r--r--xmake/templates/c/console/_template.lua2
4 files changed, 35 insertions, 9 deletions
diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua
index bad7c8969..c2057e246 100644
--- a/xmake/scripts/platform/platform.lua
+++ b/xmake/scripts/platform/platform.lua
@@ -157,8 +157,12 @@ end
-- make the current platform configure
function platform.make()
+ -- get the platform
+ local plat = config.get("plat")
+ assert(plat)
+
-- make and get the current platform configure
- return platform._configs(config.get("plat"))
+ return platform._configs(plat)
end
-- get the platform os
diff --git a/xmake/templates/c++/console/_template.lua b/xmake/templates/c++/console/_template.lua
index 0cf6efff2..312273a46 100644
--- a/xmake/templates/c++/console/_template.lua
+++ b/xmake/templates/c++/console/_template.lua
@@ -17,11 +17,33 @@
-- Copyright (C) 2009 - 2015, ruki All rights reserved.
--
-- @author ruki
--- @file template.lua
+-- @file _template.lua
--
--- define module: template
-local template = template or {}
+-- define module: _template
+local _template = _template or {}
--- return module: template
-return template
+-- load modules
+local io = require("base/io")
+local os = require("base/os")
+local path = require("base/path")
+local utils = require("base/utils")
+
+-- init the template description
+_template.description = "The Console Program"
+
+-- done the template file
+function _template.done(targetname, projectdir)
+
+ -- check
+ assert(targetname and projectdir)
+
+ -- replace the target name
+ io.gsub(projectdir .. "/xmake.lua", "%[targetname%]", targetname)
+
+ -- ok
+ return true
+end
+
+-- return module: _template
+return _template
diff --git a/xmake/templates/c++/console/project/xmake.lua b/xmake/templates/c++/console/project/xmake.lua
index 7c1409763..30aca7364 100644
--- a/xmake/templates/c++/console/project/xmake.lua
+++ b/xmake/templates/c++/console/project/xmake.lua
@@ -22,11 +22,11 @@ if modes("release") then
end
-- add target
-add_target("demo")
+add_target("[targetname]")
-- set kind
set_kind("binary")
-- add files
- add_files("src/*.cpp")
+ add_files("src/*.c")
diff --git a/xmake/templates/c/console/_template.lua b/xmake/templates/c/console/_template.lua
index 8a1668fbf..312273a46 100644
--- a/xmake/templates/c/console/_template.lua
+++ b/xmake/templates/c/console/_template.lua
@@ -39,7 +39,7 @@ function _template.done(targetname, projectdir)
assert(targetname and projectdir)
-- replace the target name
- io.gsub(projectdir .. "/xmake.lua", "%[targetname%]", targetname)
+ io.gsub(projectdir .. "/xmake.lua", "%[targetname%]", targetname)
-- ok
return true