summaryrefslogtreecommitdiff
path: root/xmake/rules/lua/native-objects/xmake.lua
diff options
context:
space:
mode:
authorWu, Zhenyu <[email protected]>2025-01-14 20:17:34 +0800
committerWu, Zhenyu <[email protected]>2025-01-16 00:15:23 +0800
commit2e1c281978900b87a738246b90fa130e6c112e9e (patch)
treef6ce3c7d763b047f3b258536581b7e86959b0b13 /xmake/rules/lua/native-objects/xmake.lua
parent58c00fc0baa75fb7e5220fc2afe6402ae2c17772 (diff)
Use lib.detect.find_tool for native_objects
add dependence for rule c
Diffstat (limited to 'xmake/rules/lua/native-objects/xmake.lua')
-rw-r--r--xmake/rules/lua/native-objects/xmake.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/xmake/rules/lua/native-objects/xmake.lua b/xmake/rules/lua/native-objects/xmake.lua
index 74ce19b38..65f3a3c9a 100644
--- a/xmake/rules/lua/native-objects/xmake.lua
+++ b/xmake/rules/lua/native-objects/xmake.lua
@@ -27,7 +27,9 @@
-- end
rule("lua.native-objects")
set_extensions(".nobj.lua")
+ add_deps("c")
before_buildcmd_file(function(target, batchcmds, sourcefile, opt)
+ import("lib.detect.find_tool")
-- get c source file for lua.native-objects
local dirname = path.join(target:autogendir(), "rules", "lua", "native-objects")
local sourcefile_c = path.join(dirname, path.basename(sourcefile) .. ".c")
@@ -39,9 +41,10 @@ rule("lua.native-objects")
-- add commands
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.nobj.lua %s", sourcefile)
batchcmds:mkdir(path.directory(sourcefile_c))
- batchcmds:vrunv("native_objects",
+ local native_objects = find_tool("native_objects")
+ assert(native_objects, "native_objects not found! please `luarocks install luanativeobjects`.")
+ batchcmds:vrunv(native_objects.program,
{ "-outpath", path(dirname), "-gen", "lua", path(sourcefile) })
- -- remember to add_rules("c") if you need
batchcmds:compile(sourcefile_c, objectfile)
-- add deps