diff options
| author | ruki <[email protected]> | 2015-06-18 16:37:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-18 16:37:58 +0800 |
| commit | 379675ca870210abdde87db7dfd989855d337cd3 (patch) | |
| tree | 3ffcd760864a4274944f5f575efbd31015c27d60 /xmake | |
| parent | 1cb067b57383aa65ad5500b350aca22d865e7f3c (diff) | |
add templates
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/scripts/_xmake_main.lua | 25 | ||||
| -rw-r--r-- | xmake/templates/c++/console/project/src/main.cpp | 9 | ||||
| -rw-r--r-- | xmake/templates/c++/console/project/xmake.lua | 32 | ||||
| -rw-r--r-- | xmake/templates/c++/console/template.lua | 27 | ||||
| -rw-r--r-- | xmake/templates/c/console/project/src/main.c | 7 | ||||
| -rw-r--r-- | xmake/templates/c/console/project/xmake.lua | 32 | ||||
| -rw-r--r-- | xmake/templates/c/console/template.lua | 27 |
7 files changed, 147 insertions, 12 deletions
diff --git a/xmake/scripts/_xmake_main.lua b/xmake/scripts/_xmake_main.lua index 89a8c7fc2..cdc2cf016 100644 --- a/xmake/scripts/_xmake_main.lua +++ b/xmake/scripts/_xmake_main.lua @@ -21,18 +21,19 @@ -- -- init namespace: xmake -xmake = xmake or {} -xmake._ARGV = _ARGV -xmake._HOST = _HOST -xmake._ARCH = _ARCH -xmake._NULDEV = _NULDEV -xmake._VERSION = "XMake v1.0.1" -xmake._PROGRAM_DIR = _PROGRAM_DIR -xmake._PROJECT_DIR = _PROJECT_DIR -xmake._SCRIPTS_DIR = _PROGRAM_DIR .. "/scripts" -xmake._PROJECT_FILE = "xmake.lua" -xmake._OPTIONS = {} -xmake._CONFIGS = {} +xmake = xmake or {} +xmake._ARGV = _ARGV +xmake._HOST = _HOST +xmake._ARCH = _ARCH +xmake._NULDEV = _NULDEV +xmake._VERSION = "XMake v1.0.1" +xmake._PROGRAM_DIR = _PROGRAM_DIR +xmake._PROJECT_DIR = _PROJECT_DIR +xmake._SCRIPTS_DIR = _PROGRAM_DIR .. "/scripts" +xmake._TEMPLATES_DIR = _PROGRAM_DIR .. "/templates" +xmake._PROJECT_FILE = "xmake.lua" +xmake._OPTIONS = {} +xmake._CONFIGS = {} -- init package path package.path = xmake._SCRIPTS_DIR .. "/?.lua;" .. package.path diff --git a/xmake/templates/c++/console/project/src/main.cpp b/xmake/templates/c++/console/project/src/main.cpp new file mode 100644 index 000000000..db2361659 --- /dev/null +++ b/xmake/templates/c++/console/project/src/main.cpp @@ -0,0 +1,9 @@ +#include <iostream> + +using namespace std; + +int main(int argc, char** argv) +{ + cout << "hello world!" << endl; + 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..7c1409763 --- /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/*.cpp") + 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 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 |
