summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-27 22:40:47 +0800
committerruki <[email protected]>2021-09-27 22:40:47 +0800
commit383c52d93446a72497b132ff6f38d2ef96817eeb (patch)
tree9290553e1f35c4a1c09bdcef9e11c3dfc215e28a
parentc223db1bdd7e90d970b378e6d6755e977ceb4c6d (diff)
add swigflags
-rw-r--r--tests/projects/swig/lua_c/xmake.lua2
-rw-r--r--xmake/rules/swig/build_module_file.lua4
2 files changed, 5 insertions, 1 deletions
diff --git a/tests/projects/swig/lua_c/xmake.lua b/tests/projects/swig/lua_c/xmake.lua
index 4ee0226ee..06dfac12b 100644
--- a/tests/projects/swig/lua_c/xmake.lua
+++ b/tests/projects/swig/lua_c/xmake.lua
@@ -3,6 +3,6 @@ add_requires("lua")
target("example")
add_rules("swig.c", {moduletype = "lua"})
- add_files("src/example.i")
+ add_files("src/example.i", {swigflags = "-no-old-metatable-bindings"})
add_files("src/example.c")
add_packages("lua")
diff --git a/xmake/rules/swig/build_module_file.lua b/xmake/rules/swig/build_module_file.lua
index a38fb009e..42c9d9238 100644
--- a/xmake/rules/swig/build_module_file.lua
+++ b/xmake/rules/swig/build_module_file.lua
@@ -38,6 +38,10 @@ function main(target, batchcmds, sourcefile, opt)
if opt.sourcekind == "cxx" then
table.insert(argv, "-c++")
end
+ local fileconfig = target:fileconfig(sourcefile)
+ if fileconfig.swigflags then
+ table.join2(argv, fileconfig.swigflags)
+ end
table.insert(argv, sourcefile)
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.swig.%s %s", moduletype, sourcefile)
batchcmds:mkdir(path.directory(sourcefile_cx))