summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/rules/swig/xmake.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/xmake/rules/swig/xmake.lua b/xmake/rules/swig/xmake.lua
index daa273231..137587fd0 100644
--- a/xmake/rules/swig/xmake.lua
+++ b/xmake/rules/swig/xmake.lua
@@ -71,11 +71,27 @@ rule("swig.base")
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
local scriptdir
local fileconfig = target:fileconfig(sourcefile)
+
+ local autogenfiles
+ local autogendir = path.join(target:autogendir(), "rules", "swig")
+
if fileconfig then
scriptdir = fileconfig.scriptdir
+ if fileconfig.swigflags then
+ -- find -outdir path
+ local idx = -1
+ for i , par in pairs(fileconfig.swigflags) do
+ if par == "-outdir" then
+ idx = i
+ end
+ end
+
+ if idx > 0 then
+ autogendir = fileconfig.swigflags[idx + 1]
+ end
+ end
end
- local autogenfiles
- local autogendir = path.join(target:autogendir(), "rules", "swig")
+
if moduletype == "python" then
autogenfiles = os.files(path.join(autogendir, "*.py"))
elseif moduletype == "lua" then