summaryrefslogtreecommitdiff
path: root/tests/projects/xmake_cli/hello
diff options
context:
space:
mode:
Diffstat (limited to 'tests/projects/xmake_cli/hello')
-rw-r--r--tests/projects/xmake_cli/hello/src/lni/main.c32
-rw-r--r--tests/projects/xmake_cli/hello/src/lua/main.lua5
-rw-r--r--tests/projects/xmake_cli/hello/xmake.lua2
3 files changed, 7 insertions, 32 deletions
diff --git a/tests/projects/xmake_cli/hello/src/lni/main.c b/tests/projects/xmake_cli/hello/src/lni/main.c
index a2601687a..d1ab0b0fb 100644
--- a/tests/projects/xmake_cli/hello/src/lni/main.c
+++ b/tests/projects/xmake_cli/hello/src/lni/main.c
@@ -16,34 +16,10 @@ static tb_void_t lni_initalizer(xm_engine_ref_t engine, lua_State* lua)
}
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(lni_initalizer);
- if (engine)
- {
-#if 0
- 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;
+#ifdef __tb_debug__
+ tb_char_t const* luaopts = "-vD";
#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;
+ tb_char_t const* luaopts = "-D";
#endif
- ok = xm_engine_main(engine, argc2, argv2);
- xm_engine_exit(engine);
- }
- xm_exit();
- }
- return ok;
+ return xm_engine_run_lua(argc, argv, lni_initalizer, luaopts);
}
diff --git a/tests/projects/xmake_cli/hello/src/lua/main.lua b/tests/projects/xmake_cli/hello/src/lua/main.lua
index 0a1590543..d87daf102 100644
--- a/tests/projects/xmake_cli/hello/src/lua/main.lua
+++ b/tests/projects/xmake_cli/hello/src/lua/main.lua
@@ -1,9 +1,8 @@
import("core.base.option")
-import("lib.lni")
+import("lib.lni.test")
function main ()
- print(lni)
- print("hello xmake!")
+ print(test.hello())
local argv = option.get("arguments")
if argv then
print(argv)
diff --git a/tests/projects/xmake_cli/hello/xmake.lua b/tests/projects/xmake_cli/hello/xmake.lua
index e2e410e03..e4c0aba32 100644
--- a/tests/projects/xmake_cli/hello/xmake.lua
+++ b/tests/projects/xmake_cli/hello/xmake.lua
@@ -1,5 +1,5 @@
add_rules("mode.debug", "mode.release")
-add_requires("libxmake")
+add_requires("libxmake", {debug = is_mode("debug")})
target("hello")
add_rules("xmake.cli")
add_files("src/lni/*.c")