Skip to content

Commit 8a6f4c0

Browse files
committed
if gen dir is specified by "-outdir" , replace autogendir
1 parent ebc9ffe commit 8a6f4c0

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

xmake/rules/swig/xmake.lua

+18-2
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,27 @@ rule("swig.base")
7171
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
7272
local scriptdir
7373
local fileconfig = target:fileconfig(sourcefile)
74+
75+
local autogenfiles
76+
local autogendir = path.join(target:autogendir(), "rules", "swig")
77+
7478
if fileconfig then
7579
scriptdir = fileconfig.scriptdir
80+
if fileconfig.swigflags then
81+
-- find -outdir path
82+
local idx = -1
83+
for i , par in pairs(fileconfig.swigflags) do
84+
if par == "-outdir" then
85+
idx = i
86+
end
87+
end
88+
89+
if idx > 0 then
90+
autogendir = fileconfig.swigflags[idx + 1]
91+
end
92+
end
7693
end
77-
local autogenfiles
78-
local autogendir = path.join(target:autogendir(), "rules", "swig")
94+
7995
if moduletype == "python" then
8096
autogenfiles = os.files(path.join(autogendir, "*.py"))
8197
elseif moduletype == "lua" then

0 commit comments

Comments
 (0)