summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorririyeye <[email protected]>2024-08-29 15:44:36 +0800
committerririyeye <[email protected]>2024-08-29 15:44:36 +0800
commit8a6f4c014f090c5491be5e8a8e74445c48c25fd1 (patch)
treedb811bcdf02e3dd9dc88f4d6f9fae6638fefce3f
parentebc9ffe55beac2b7f8a284e51990612d61e4d1b7 (diff)
if gen dir is specified by "-outdir" , replace autogendir
-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