diff options
| author | ruki <[email protected]> | 2020-04-22 22:43:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-22 10:18:18 +0800 |
| commit | 762a7bc9386a0acaede7d54453611999a589c776 (patch) | |
| tree | 23973800aa279410ee545ee3e36513dbce502fe1 /tests/projects/xmake_cli | |
| parent | eb53ce52d978925f285991556d2354ceb4cfd654 (diff) | |
improve to run xmake/cli
Diffstat (limited to 'tests/projects/xmake_cli')
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lni/main.c | 9 | ||||
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lua/main.lua | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/projects/xmake_cli/hello/src/lni/main.c b/tests/projects/xmake_cli/hello/src/lni/main.c index 6e75791ed..3e27cf554 100644 --- a/tests/projects/xmake_cli/hello/src/lni/main.c +++ b/tests/projects/xmake_cli/hello/src/lni/main.c @@ -8,7 +8,14 @@ tb_int_t main(tb_int_t argc, tb_char_t** argv) xm_engine_ref_t engine = xm_engine_init(); if (engine) { - ok = xm_engine_main(engine, argc, argv); + tb_int_t argc2 = argc + 2; + tb_char_t* argv2[argc2 + 1]; + argv2[0] = argv[0]; + argv2[1] = "lua"; + argv2[2] = "lua.main"; + if (argc > 1) tb_memcpy(argv2 + 3, argv + 1, (argc - 1) * sizeof(tb_char_t*)); + argv2[argc2] = tb_null; + ok = xm_engine_main(engine, argc2, argv2); xm_engine_exit(engine); } xm_exit(); diff --git a/tests/projects/xmake_cli/hello/src/lua/main.lua b/tests/projects/xmake_cli/hello/src/lua/main.lua index f83baddf8..1ce83e728 100644 --- a/tests/projects/xmake_cli/hello/src/lua/main.lua +++ b/tests/projects/xmake_cli/hello/src/lua/main.lua @@ -1,3 +1,8 @@ +import("core.base.option") function main () print("hello xmake!") + local argv = option.get("arguments") + if argv then + print(argv) + end end |
