summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-27 23:23:26 +0800
committerruki <[email protected]>2021-01-27 23:23:26 +0800
commit5edaf8c5ea6e68475c6050dc65bf86152ed66d72 (patch)
tree7449788b82a7ee911c63abbfe280d91bc170ef3b
parent0d06846a572219abb13a6454600bcb802b9b7076 (diff)
fix winos.cmdargv for ar
-rw-r--r--xmake/core/base/winos.lua11
-rw-r--r--xmake/modules/core/tools/ar.lua2
-rw-r--r--xmake/modules/core/tools/emcc.lua2
-rw-r--r--xmake/modules/core/tools/gcc.lua2
-rw-r--r--xmake/modules/core/tools/ifort.lua2
-rw-r--r--xmake/modules/core/tools/ld.lua4
-rw-r--r--xmake/modules/core/tools/llvm_ar.lua2
-rw-r--r--xmake/modules/core/tools/sdar.lua2
8 files changed, 13 insertions, 14 deletions
diff --git a/xmake/core/base/winos.lua b/xmake/core/base/winos.lua
index 4a18d19ee..3683a97ef 100644
--- a/xmake/core/base/winos.lua
+++ b/xmake/core/base/winos.lua
@@ -155,7 +155,7 @@ function winos.version()
end
-- get command arguments on windows to solve 8192 character command line length limit
-function winos.cmdargv(argv, key)
+function winos.cmdargv(argv, opt)
-- too long arguments?
local limit = 4096
@@ -167,7 +167,8 @@ function winos.cmdargv(argv, key)
end
end
if argn > limit then
- local argsfile = os.tmpfile(key or table.concat(argv, '')) .. ".args.txt"
+ opt = opt or {}
+ local argsfile = os.tmpfile(opt.tmpkey or table.concat(argv, '')) .. ".args.txt"
local f = io.open(argsfile, 'w', {encoding = "ansi"})
if f then
-- we need split args file to solve `fatal error LNK1170: line in command file contains 131071 or more characters`
@@ -185,11 +186,11 @@ function winos.cmdargv(argv, key)
-- foo.obj
--
if idx + 1 <= #argv and arg:find("^[-/]") and not argv[idx + 1]:find("^[-/]") then
- f:write(os.args(arg) .. " ")
- f:write(os.args(argv[idx + 1]) .. "\n")
+ f:write(os.args(arg, {escape = opt.escape}) .. " ")
+ f:write(os.args(argv[idx + 1], {escape = opt.escape}) .. "\n")
idx = idx + 2
else
- f:write(os.args(arg) .. "\n")
+ f:write(os.args(arg, {escape = opt.escape}) .. "\n")
idx = idx + 1
end
end
diff --git a/xmake/modules/core/tools/ar.lua b/xmake/modules/core/tools/ar.lua
index 868b4eae1..dc858a19e 100644
--- a/xmake/modules/core/tools/ar.lua
+++ b/xmake/modules/core/tools/ar.lua
@@ -52,7 +52,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
opt = opt or {}
local argv = table.join(flags, targetfile, objectfiles)
if is_host("windows") and not opt.rawargs then
- argv = winos.cmdargv(argv)
+ argv = winos.cmdargv(argv, {escape = true})
end
-- make it
diff --git a/xmake/modules/core/tools/emcc.lua b/xmake/modules/core/tools/emcc.lua
index 39f4ddfbf..a443f43f6 100644
--- a/xmake/modules/core/tools/emcc.lua
+++ b/xmake/modules/core/tools/emcc.lua
@@ -36,7 +36,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
opt = opt or {}
local argv = table.join("-o", targetfile, objectfiles, flags)
if is_host("windows") and not opt.rawargs then
- argv = winos.cmdargv(argv)
+ argv = winos.cmdargv(argv, {escape = true})
end
return self:program(), argv
end
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 02b4b9bc6..e945e2926 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -340,7 +340,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
opt = opt or {}
local argv = table.join("-o", targetfile, objectfiles, flags, flags_extra)
if is_host("windows") and not opt.rawargs then
- argv = winos.cmdargv(argv)
+ argv = winos.cmdargv(argv, {escape = true})
end
return self:program(), argv
end
diff --git a/xmake/modules/core/tools/ifort.lua b/xmake/modules/core/tools/ifort.lua
index cca51c683..2d48f34c7 100644
--- a/xmake/modules/core/tools/ifort.lua
+++ b/xmake/modules/core/tools/ifort.lua
@@ -47,7 +47,7 @@ if is_host("windows") then
opt = opt or {}
local argv = table.join("-o", targetfile, objectfiles, "/link", flags)
if not opt.rawargs then
- argv = winos.cmdargv(argv)
+ argv = winos.cmdargv(argv, {escape = true})
end
-- @note we cannot put -dll to @args.txt
if targetkind == "shared" then
diff --git a/xmake/modules/core/tools/ld.lua b/xmake/modules/core/tools/ld.lua
index 2e337a572..c641823bb 100644
--- a/xmake/modules/core/tools/ld.lua
+++ b/xmake/modules/core/tools/ld.lua
@@ -70,12 +70,10 @@ end
-- make the link arguments list
function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
-
- -- init arguments
opt = opt or {}
local argv = table.join("-o", targetfile, objectfiles, flags)
if is_host("windows") and not opt.rawargs then
- argv = winos.cmdargv(argv)
+ argv = winos.cmdargv(argv, {escape = true})
end
return self:program(), argv
end
diff --git a/xmake/modules/core/tools/llvm_ar.lua b/xmake/modules/core/tools/llvm_ar.lua
index fb20c2320..b00c4435e 100644
--- a/xmake/modules/core/tools/llvm_ar.lua
+++ b/xmake/modules/core/tools/llvm_ar.lua
@@ -50,7 +50,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
opt = opt or {}
local argv = table.join(flags, targetfile, objectfiles)
if is_host("windows") and not opt.rawargs then
- argv = winos.cmdargv(argv)
+ argv = winos.cmdargv(argv, {escape = true})
end
-- make it
diff --git a/xmake/modules/core/tools/sdar.lua b/xmake/modules/core/tools/sdar.lua
index 056ca32d3..41b961444 100644
--- a/xmake/modules/core/tools/sdar.lua
+++ b/xmake/modules/core/tools/sdar.lua
@@ -52,7 +52,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
opt = opt or {}
local argv = table.join(flags, targetfile, objectfiles)
if is_host("windows") and not opt.rawargs then
- argv = winos.cmdargv(argv)
+ argv = winos.cmdargv(argv, {escape = true})
end
-- make it