diff options
| -rw-r--r-- | xmake/core/base/winos.lua | 5 | ||||
| -rw-r--r-- | xmake/core/tool/compiler.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 9 | ||||
| -rw-r--r-- | xmake/modules/private/action/build/object.lua | 3 |
4 files changed, 11 insertions, 8 deletions
diff --git a/xmake/core/base/winos.lua b/xmake/core/base/winos.lua index 5841f5a6c..40283e4f5 100644 --- a/xmake/core/base/winos.lua +++ b/xmake/core/base/winos.lua @@ -154,14 +154,15 @@ end function winos.cmdargv(argv, key) -- too long arguments? + local limit = 4096 local argn = 0 for _, arg in ipairs(argv) do argn = argn + #arg - if argn > 1024 then + if argn > limit then break end end - if argn > 1024 then + if argn > limit then local argsfile = os.tmpfile(key or table.concat(argv, '')) .. ".args.txt" local f = io.open(argsfile, 'w') if f then diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua index b99bfdfca..e56f2d300 100644 --- a/xmake/core/tool/compiler.lua +++ b/xmake/core/tool/compiler.lua @@ -254,7 +254,7 @@ function compiler:compargv(sourcefiles, objectfile, opt) end compflags = self:compflags(opt) end - return self:_tool():compargv(sourcefiles, objectfile, compflags) + return self:_tool():compargv(sourcefiles, objectfile, compflags, opt) end -- get the compile command diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index 8bf8c6232..9f6421c21 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -317,7 +317,7 @@ function _compargv_pch(self, pcheaderfile, pcoutputfile, flags) end -- make the compile arguments list -function compargv(self, sourcefile, objectfile, flags) +function compargv(self, sourcefile, objectfile, flags, opt) -- precompiled header? local extension = path.extension(sourcefile) @@ -327,11 +327,12 @@ function compargv(self, sourcefile, objectfile, flags) -- make the compile arguments list -- @note only flags in nf_xxx() need be wrapped via os.args, @see nf_includedir - return self:program(), table.join("-c", flags, "-Fo" .. objectfile, sourcefile) + local argv = table.join("-c", flags, "-Fo" .. objectfile, sourcefile) + return self:program(), (opt and opt.rawargs) and argv or winos.cmdargv(argv) end -- compile the source file -function compile(self, sourcefile, objectfile, dependinfo, flags) +function compile(self, sourcefile, objectfile, dependinfo, flags, opt) -- ensure the object directory -- @note this path here has been normalized, we can quickly find it by the unique path separator prompt @@ -352,7 +353,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags) end -- use vstool to compile and enable vs_unicode_output @see https://github.com/xmake-io/xmake/issues/528 - return vstool.iorunv(compargv(self, sourcefile, objectfile, compflags)) + return vstool.iorunv(compargv(self, sourcefile, objectfile, compflags, opt)) end, catch { diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua index 3b5bc1368..cee91e18e 100644 --- a/xmake/modules/private/action/build/object.lua +++ b/xmake/modules/private/action/build/object.lua @@ -65,7 +65,8 @@ function _do_build_file(target, sourcefile, opt) -- trace verbose info if verbose then - print(compinst:compcmd(sourcefile, objectfile, {compflags = compflags})) + -- show the full link command with raw arguments, it will expand @xxx.args for msvc/link on windows + print(compinst:compcmd(sourcefile, objectfile, {compflags = compflags, rawargs = true})) end -- compile it |
