summaryrefslogtreecommitdiff
path: root/xmake/modules/core
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-04 13:24:36 +0800
committerGitHub <[email protected]>2023-01-04 13:24:36 +0800
commitb71def1cc032329edeeda97cdefec3eb65e101cc (patch)
tree779059ea475e676fc4bb0c0a92e543620e70b846 /xmake/modules/core
parentff4fb0bbf49a490bfe51dcb29b7d02a82350ad63 (diff)
parent8401a29cdc083b2fe1eb9e89c0a6cc91e334a4c4 (diff)
Merge pull request #3237 from xmake-io/masm32
Add masm32 toolchain
Diffstat (limited to 'xmake/modules/core')
-rw-r--r--xmake/modules/core/tools/link.lua9
-rw-r--r--xmake/modules/core/tools/rc.lua52
2 files changed, 34 insertions, 27 deletions
diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua
index b5ee775af..38ce20a83 100644
--- a/xmake/modules/core/tools/link.lua
+++ b/xmake/modules/core/tools/link.lua
@@ -140,9 +140,14 @@ function link(self, objectfiles, targetkind, targetfile, flags, opt)
{
function ()
- -- use vstool to link and enable vs_unicode_output @see https://github.com/xmake-io/xmake/issues/528
+ local toolchain = self:toolchain()
local program, argv = linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
- vstool.runv(program, argv, {envs = self:runenvs()})
+ if toolchain and toolchain:name() == "masm32" then
+ os.iorunv(program, argv, {envs = self:runenvs()})
+ else
+ -- use vstool to link and enable vs_unicode_output @see https://github.com/xmake-io/xmake/issues/528
+ vstool.runv(program, argv, {envs = self:runenvs()})
+ end
end,
catch
{
diff --git a/xmake/modules/core/tools/rc.lua b/xmake/modules/core/tools/rc.lua
index 662a7b618..c3e5f5c12 100644
--- a/xmake/modules/core/tools/rc.lua
+++ b/xmake/modules/core/tools/rc.lua
@@ -122,35 +122,37 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
}
}
- -- try to use cl.exe to parse includes
+ -- 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 outfile = os.tmpfile() .. ".rc.out"
- local errfile = os.tmpfile() .. ".rc.err"
- local cl = assert(self:toolchain():tool("cxx"), "cl.exe not found!")
- local ok = try {function () os.execv(cl, {"-E", sourcefile}, {stdout = outfile, stderr = errfile, envs = self:runenvs()}); return true end}
- if ok and os.isfile(outfile) then
- local depfiles_rc
- local includeset = hashset.new()
- local file = io.open(outfile)
- local projectdir = os.projectdir()
- for line in file:lines() do
- local includefile = _parse_includefile(line)
- if includefile then
- includefile = _normailize_dep(includefile, projectdir)
- if includefile and not includeset:has(includefile)
- and path.absolute(includefile) ~= path.absolute(sourcefile)
- and os.isfile(includefile) then
- depfiles_rc = (depfiles_rc or "") .. "\n" .. includefile
- includeset:insert(includefile)
+ local cl = self:toolchain():tool("cxx")
+ if cl then
+ local outfile = os.tmpfile() .. ".rc.out"
+ local errfile = os.tmpfile() .. ".rc.err"
+ local ok = try {function () os.execv(cl, {"-E", sourcefile}, {stdout = outfile, stderr = errfile, envs = self:runenvs()}); return true end}
+ if ok and os.isfile(outfile) then
+ local depfiles_rc
+ local includeset = hashset.new()
+ local file = io.open(outfile)
+ local projectdir = os.projectdir()
+ for line in file:lines() do
+ local includefile = _parse_includefile(line)
+ if includefile then
+ includefile = _normailize_dep(includefile, projectdir)
+ if includefile and not includeset:has(includefile)
+ and path.absolute(includefile) ~= path.absolute(sourcefile)
+ and os.isfile(includefile) then
+ depfiles_rc = (depfiles_rc or "") .. "\n" .. includefile
+ includeset:insert(includefile)
+ end
end
end
+ file:close()
+ if dependinfo then
+ dependinfo.depfiles_rc = depfiles_rc
+ end
end
- file:close()
- if dependinfo then
- dependinfo.depfiles_rc = depfiles_rc
- end
+ os.tryrm(outfile)
+ os.tryrm(errfile)
end
- os.tryrm(outfile)
- os.tryrm(errfile)
end