summaryrefslogtreecommitdiff
path: root/xmake/templates/c/console
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-18 16:37:58 +0800
committerruki <[email protected]>2015-06-18 16:37:58 +0800
commit379675ca870210abdde87db7dfd989855d337cd3 (patch)
tree3ffcd760864a4274944f5f575efbd31015c27d60 /xmake/templates/c/console
parent1cb067b57383aa65ad5500b350aca22d865e7f3c (diff)
add templates
Diffstat (limited to 'xmake/templates/c/console')
-rw-r--r--xmake/templates/c/console/project/src/main.c7
-rw-r--r--xmake/templates/c/console/project/xmake.lua32
-rw-r--r--xmake/templates/c/console/template.lua27
3 files changed, 66 insertions, 0 deletions
diff --git a/xmake/templates/c/console/project/src/main.c b/xmake/templates/c/console/project/src/main.c
new file mode 100644
index 000000000..9ae580511
--- /dev/null
+++ b/xmake/templates/c/console/project/src/main.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char** argv)
+{
+ printf("hello world!\n");
+ return 0;
+}
diff --git a/xmake/templates/c/console/project/xmake.lua b/xmake/templates/c/console/project/xmake.lua
new file mode 100644
index 000000000..d4f8fd029
--- /dev/null
+++ b/xmake/templates/c/console/project/xmake.lua
@@ -0,0 +1,32 @@
+-- the debug mode
+if modes("debug") then
+
+ -- enable the debug symbols
+ set_symbols("debug")
+
+ -- disable optimization
+ set_optimize("none")
+end
+
+-- the release mode
+if modes("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
+add_target("demo")
+
+ -- set kind
+ set_kind("binary")
+
+ -- add files
+ add_files("src/*.c")
+
diff --git a/xmake/templates/c/console/template.lua b/xmake/templates/c/console/template.lua
new file mode 100644
index 000000000..0cf6efff2
--- /dev/null
+++ b/xmake/templates/c/console/template.lua
@@ -0,0 +1,27 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2009 - 2015, ruki All rights reserved.
+--
+-- @author ruki
+-- @file template.lua
+--
+
+-- define module: template
+local template = template or {}
+
+-- return module: template
+return template