diff options
| author | ruki <[email protected]> | 2024-11-15 23:25:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-11-15 23:25:16 +0800 |
| commit | 25e5ad87354dacbe29007d9e145f205a1d1984f8 (patch) | |
| tree | 5c7c00e536892592a27c4b8b61ff054f627f1fd1 | |
| parent | ad8324471f281a348a01fd982d483bb9cf0e56cf (diff) | |
fix rc #5828
| -rw-r--r-- | xmake/modules/core/tools/rc.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/xmake/modules/core/tools/rc.lua b/xmake/modules/core/tools/rc.lua index 7728e2e20..930fa4942 100644 --- a/xmake/modules/core/tools/rc.lua +++ b/xmake/modules/core/tools/rc.lua @@ -79,22 +79,20 @@ function nf_sysincludedir(self, dir) end -- make the compile arguments list -function compargv(self, sourcefile, objectfile, flags) +function compargv(self, sourcefile, objectfile, flags, opt) return self:program(), table.join(flags, "-Fo" .. objectfile, sourcefile) end -- compile the source file -function compile(self, sourcefile, objectfile, dependinfo, flags) - - -- ensure the object directory +function compile(self, sourcefile, objectfile, dependinfo, flags, opt) + opt = opt or {} os.mkdir(path.directory(objectfile)) - -- compile it try { function () -- @note we don't need to use vstool.iorunv to enable unicode output for rc.exe - local program, argv = compargv(self, sourcefile, objectfile, flags) + local program, argv = compargv(self, sourcefile, objectfile, flags, opt) local outdata, errdata = os.iorunv(program, argv, {envs = self:runenvs()}) return (outdata or "") .. (errdata or "") end, @@ -124,7 +122,12 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) -- try to use cl.exe to parse includes, but cl.exe maybe not exists in masm32 sdk -- @see https://github.com/xmake-io/xmake/issues/2562 - local cl = self:toolchain():tool("cxx") + local cl + if opt.target then + cl = opt.target:tool("cxx") + elseif self:toolchain() then + cl = self:toolchain():tool("cxx") + end if cl then local outfile = os.tmpfile() .. ".rc.out" local errfile = os.tmpfile() .. ".rc.err" |
