diff options
| author | ririyeye <[email protected]> | 2024-09-02 14:09:10 +0800 |
|---|---|---|
| committer | ririyeye <[email protected]> | 2024-09-02 14:09:10 +0800 |
| commit | 6cad7300ea2de380863c1f46e896a372b74d84a7 (patch) | |
| tree | 2a4c5c125115e41eced45e4dbafaab38a8d65a2f /xmake/rules/swig/build_module_file.lua | |
| parent | 306faf3772a7dd183ce478b1db69ac3d6a3da90e (diff) | |
add swig find_user_outdir
Diffstat (limited to 'xmake/rules/swig/build_module_file.lua')
| -rw-r--r-- | xmake/rules/swig/build_module_file.lua | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/xmake/rules/swig/build_module_file.lua b/xmake/rules/swig/build_module_file.lua index 8c568d00d..451e65d40 100644 --- a/xmake/rules/swig/build_module_file.lua +++ b/xmake/rules/swig/build_module_file.lua @@ -24,26 +24,31 @@ import("utils.progress") import("core.project.depend") import("core.tool.compiler") -function jar_build(target , fileconfig , opt) - local javac = assert(find_tool("javac"), "javac not found!") - local jar = assert(find_tool("jar"), "jar not found!") - - local java_src_dir = path.join(target:autogendir(), "rules", "swig") - local jar_dst_dir = path.join(target:autogendir(), "rules", "swig") - +function find_user_outdir(fileconfig) -- user specified output path if fileconfig and fileconfig.swigflags then -- find -outdir path - local idx = -1 for i , par in pairs(fileconfig.swigflags) do if par == "-outdir" then - idx = i + local dirpath = fileconfig.swigflags[i + 1] + if os.isdir(dirpath) then + return dirpath + end end end + end +end - if idx > 0 then - java_src_dir = fileconfig.swigflags[idx + 1] - end +function jar_build(target , fileconfig , opt) + local javac = assert(find_tool("javac"), "javac not found!") + local jar = assert(find_tool("jar"), "jar not found!") + + local java_src_dir = path.join(target:autogendir(), "rules", "swig") + local jar_dst_dir = path.join(target:autogendir(), "rules", "swig") + + local user_outdir = find_user_outdir(fileconfig) + if user_outdir then + java_src_dir = user_outdir end -- get java files |
