From 15dc39430ed49d42709bba3ef2acab8500414a3a Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 22 Apr 2020 22:34:55 +0800 Subject: add xmake.cli rule --- tests/projects/c/xmake_app/src/main.c | 18 ----------- tests/projects/c/xmake_app/xmake.lua | 7 ----- tests/projects/xmake_cli/xmake/src/main.c | 17 +++++++++++ tests/projects/xmake_cli/xmake/src/xmake.ico | Bin 0 -> 119943 bytes tests/projects/xmake_cli/xmake/src/xmake.rc | 43 +++++++++++++++++++++++++++ tests/projects/xmake_cli/xmake/xmake.lua | 10 +++++++ xmake/rules/xmake_cli/xmake.lua | 25 ++++++++++++++++ 7 files changed, 95 insertions(+), 25 deletions(-) delete mode 100644 tests/projects/c/xmake_app/src/main.c delete mode 100644 tests/projects/c/xmake_app/xmake.lua create mode 100644 tests/projects/xmake_cli/xmake/src/main.c create mode 100644 tests/projects/xmake_cli/xmake/src/xmake.ico create mode 100644 tests/projects/xmake_cli/xmake/src/xmake.rc create mode 100644 tests/projects/xmake_cli/xmake/xmake.lua create mode 100644 xmake/rules/xmake_cli/xmake.lua diff --git a/tests/projects/c/xmake_app/src/main.c b/tests/projects/c/xmake_app/src/main.c deleted file mode 100644 index b8570daae..000000000 --- a/tests/projects/c/xmake_app/src/main.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -tb_int_t main(tb_int_t argc, tb_char_t** argv) -{ - tb_int_t ok = -1; - if (xm_init()) - { - xm_engine_ref_t engine = xm_engine_init(); - if (engine) - { - ok = xm_engine_main(engine, argc, argv); - xm_engine_exit(engine); - } - - xm_exit(); - } - return ok; -} diff --git a/tests/projects/c/xmake_app/xmake.lua b/tests/projects/c/xmake_app/xmake.lua deleted file mode 100644 index 42266ead7..000000000 --- a/tests/projects/c/xmake_app/xmake.lua +++ /dev/null @@ -1,7 +0,0 @@ -add_rules("mode.debug", "mode.release") -add_requires("libxmake") -target("test") - set_kind("binary") - add_files("src/*.c") - add_packages("libxmake") - diff --git a/tests/projects/xmake_cli/xmake/src/main.c b/tests/projects/xmake_cli/xmake/src/main.c new file mode 100644 index 000000000..6e75791ed --- /dev/null +++ b/tests/projects/xmake_cli/xmake/src/main.c @@ -0,0 +1,17 @@ +#include + +tb_int_t main(tb_int_t argc, tb_char_t** argv) +{ + tb_int_t ok = -1; + if (xm_init()) + { + xm_engine_ref_t engine = xm_engine_init(); + if (engine) + { + ok = xm_engine_main(engine, argc, argv); + xm_engine_exit(engine); + } + xm_exit(); + } + return ok; +} diff --git a/tests/projects/xmake_cli/xmake/src/xmake.ico b/tests/projects/xmake_cli/xmake/src/xmake.ico new file mode 100644 index 000000000..52c8ef389 Binary files /dev/null and b/tests/projects/xmake_cli/xmake/src/xmake.ico differ diff --git a/tests/projects/xmake_cli/xmake/src/xmake.rc b/tests/projects/xmake_cli/xmake/src/xmake.rc new file mode 100644 index 000000000..0d737ebc3 --- /dev/null +++ b/tests/projects/xmake_cli/xmake/src/xmake.rc @@ -0,0 +1,43 @@ +#include "xmake.config.h" +#include "winres.h" + +#define _STR(x) #x +#define STR(x) _STR(x) + +VS_VERSION_INFO VERSIONINFO + FILEVERSION XM_CONFIG_VERSION_MAJOR, XM_CONFIG_VERSION_MINOR, XM_CONFIG_VERSION_ALTER, 0 + PRODUCTVERSION XM_CONFIG_VERSION_MAJOR, XM_CONFIG_VERSION_MINOR, XM_CONFIG_VERSION_ALTER, 0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004B0" + BEGIN + VALUE "Comments", "A cross-platform build utility based on Lua\nwebsite: https://xmake.io" + VALUE "CompanyName", "The TBOOX Open Source Group" + VALUE "FileDescription", "XMake build utility" + VALUE "FileVersion", XM_CONFIG_VERSION "+" STR(XM_CONFIG_VERSION_BUILD) + VALUE "InternalName", "xmake" + VALUE "LegalCopyright", "Copyright (C) 2015-2020 Ruki Wang, tboox.org, xmake.io\nCopyright (C) 2005-2015 Mike Pall, luajit.org" + VALUE "LegalTrademarks", "" + VALUE "OriginalFilename", "xmake.exe" + VALUE "ProductName", "XMake" + VALUE "ProductVersion", XM_CONFIG_VERSION "+" STR(XM_CONFIG_VERSION_BUILD) + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + + +IDI_APP ICON DISCARDABLE "xmake.ico" diff --git a/tests/projects/xmake_cli/xmake/xmake.lua b/tests/projects/xmake_cli/xmake/xmake.lua new file mode 100644 index 000000000..e00d7e14d --- /dev/null +++ b/tests/projects/xmake_cli/xmake/xmake.lua @@ -0,0 +1,10 @@ +add_rules("mode.debug", "mode.release") +add_requires("libxmake") +target("xmake") + add_rules("xmake.cli") + add_files("src/*.c") + if is_plat("windows") then + add_files("src/*.rc") + end + add_packages("libxmake") + diff --git a/xmake/rules/xmake_cli/xmake.lua b/xmake/rules/xmake_cli/xmake.lua new file mode 100644 index 000000000..25acf0568 --- /dev/null +++ b/xmake/rules/xmake_cli/xmake.lua @@ -0,0 +1,25 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file xmake.lua +-- + +-- define rule: xmake cli program +rule("xmake.cli") + before_load(function (target) + target:set("kind", "binary") + end) -- cgit v1.3.1