diff options
| author | ruki <[email protected]> | 2020-04-22 23:28:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-22 14:51:11 +0800 |
| commit | a69f20d2daf4ed61b58b036eee7bf20a3034a30e (patch) | |
| tree | 746ddf9af271570521c6a3ac5c49fc5ed507bf52 | |
| parent | 9407f3893ca3f71578febcabdf6a022a80dae209 (diff) | |
add lni module
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lni/main.c | 11 | ||||
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lua/main.lua | 4 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/lni.lua | 22 |
3 files changed, 35 insertions, 2 deletions
diff --git a/tests/projects/xmake_cli/hello/src/lni/main.c b/tests/projects/xmake_cli/hello/src/lni/main.c index 1d574dc1b..a2601687a 100644 --- a/tests/projects/xmake_cli/hello/src/lni/main.c +++ b/tests/projects/xmake_cli/hello/src/lni/main.c @@ -22,6 +22,7 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) xm_engine_ref_t engine = xm_engine_init(lni_initalizer); if (engine) { +#if 0 tb_int_t argc2 = argc + 2; tb_char_t* argv2[argc2 + 1]; argv2[0] = argv[0]; @@ -29,6 +30,16 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) argv2[2] = "lua.main"; if (argc > 1) tb_memcpy(argv2 + 3, argv + 1, (argc - 1) * sizeof(tb_char_t*)); argv2[argc2] = tb_null; +#else + tb_int_t argc2 = argc + 3; + tb_char_t* argv2[argc2 + 1]; + argv2[0] = argv[0]; + argv2[1] = "lua"; + argv2[2] = "-vD"; + argv2[3] = "lua.main"; + if (argc > 1) tb_memcpy(argv2 + 4, argv + 1, (argc - 1) * sizeof(tb_char_t*)); + argv2[argc2] = tb_null; +#endif ok = xm_engine_main(engine, argc2, argv2); xm_engine_exit(engine); } diff --git a/tests/projects/xmake_cli/hello/src/lua/main.lua b/tests/projects/xmake_cli/hello/src/lua/main.lua index 26ba586a2..0a1590543 100644 --- a/tests/projects/xmake_cli/hello/src/lua/main.lua +++ b/tests/projects/xmake_cli/hello/src/lua/main.lua @@ -1,8 +1,8 @@ import("core.base.option") -import("lib.lni.test") +import("lib.lni") function main () - print(test) + print(lni) print("hello xmake!") local argv = option.get("arguments") if argv then diff --git a/xmake/core/sandbox/modules/import/lib/lni.lua b/xmake/core/sandbox/modules/import/lib/lni.lua new file mode 100644 index 000000000..72caab115 --- /dev/null +++ b/xmake/core/sandbox/modules/import/lib/lni.lua @@ -0,0 +1,22 @@ +--!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 lni.lua +-- + +-- return module +return _lni or {} |
