Skip to content

Commit 5b6a3a3

Browse files
committed
swig fix include err , fix par err
1 parent 6cad730 commit 5b6a3a3

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

tests/projects/swig/java_c/src/example.i

-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,4 @@ extern int fact(int n);
44
%}
55
extern int fact(int n);
66

7-
8-
9-
10-
117
%include "example2.i"

tests/projects/swig/java_c/src/example2.i

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
%inline %{
42
#include "test.h"
53
%}

tests/projects/swig/java_c/xmake.lua

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ target("example")
1717
"build/java/com/example/"
1818
}})
1919
add_files("src/example.c")
20+
add_includedirs("src")
2021
before_build(function()
2122
-- ensure output path exists before running swig
2223
os.mkdir("build/java/com/example/")

xmake/rules/swig/build_module_file.lua

+11-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ function swig_par(target, sourcefile, opt)
119119
end
120120

121121
table.insert(argv, sourcefile)
122-
return { argv = argv , objectfile = objectfile , swig = swig , sourcefile_cx = sourcefile_cx}
122+
return { argv = argv
123+
, objectfile = objectfile
124+
, swig = swig
125+
, sourcefile_cx = sourcefile_cx
126+
, moduletype = moduletype
127+
, fileconfig = fileconfig
128+
}
123129
end
124130

125131
function swig_build_cmd(target, batchcmds, sourcefile, opt, pars)
@@ -129,6 +135,8 @@ function swig_build_cmd(target, batchcmds, sourcefile, opt, pars)
129135
local argv = par.argv
130136
local swig = par.swig
131137
local sourcefile_cx = par.sourcefile_cx
138+
local moduletype = par.moduletype
139+
local fileconfig = par.fileconfig
132140

133141
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.swig.%s %s", moduletype, sourcefile)
134142
batchcmds:mkdir(path.directory(sourcefile_cx))
@@ -149,6 +157,8 @@ function swig_build_file(target, sourcefile, opt, par)
149157
local argv = par.argv
150158
local swig = par.swig
151159
local sourcefile_cx = par.sourcefile_cx
160+
local moduletype = par.moduletype
161+
local fileconfig = par.fileconfig
152162

153163
local dependfile = target:dependfile(objectfile)
154164
local dependinfo = target:is_rebuilt() and {} or (depend.load(dependfile) or {})

0 commit comments

Comments
 (0)