summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-27 22:32:14 +0800
committerruki <[email protected]>2020-05-27 09:13:27 +0800
commit19543006bae204763ea5922f883f279c6038f499 (patch)
tree14fa0ef0f238a912180394b603aadec931fc8b92
parent7690eaf09fd10101d67c10f8fdbf3fc0f02992fe (diff)
improve cmdargv for win
-rw-r--r--xmake/modules/core/tools/ar.lua13
-rw-r--r--xmake/modules/core/tools/gcc.lua15
-rw-r--r--xmake/modules/core/tools/ld.lua13
-rw-r--r--xmake/modules/core/tools/llvm_ar.lua13
-rw-r--r--xmake/modules/core/tools/sdar.lua13
5 files changed, 16 insertions, 51 deletions
diff --git a/xmake/modules/core/tools/ar.lua b/xmake/modules/core/tools/ar.lua
index b3a034aac..774afdd9c 100644
--- a/xmake/modules/core/tools/ar.lua
+++ b/xmake/modules/core/tools/ar.lua
@@ -47,17 +47,10 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
assert(targetkind == "static")
-- init arguments
+ opt = opt or {}
local argv = table.join(flags, targetfile, objectfiles)
-
- -- too long arguments for windows?
- if is_host("windows") then
- opt = opt or {}
- local args = os.args(argv, {escape = true})
- if #args > 1024 and not opt.rawargs then
- local argsfile = os.tmpfile(args) .. ".args.txt"
- io.writefile(argsfile, args)
- argv = {"@" .. argsfile}
- end
+ if is_host("windows") and not opt.rawargs then
+ argv = winos.cmdargv(argv)
end
-- make it
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 912519316..1df869751 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -310,21 +310,14 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
-- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc
if targetkind == "shared" and is_plat("mingw") then
- table.insert(flags_extra, "-Wl,--out-implib," .. os.args(path.join(path.directory(targetfile), path.basename(targetfile) .. ".lib")))
+ table.insert(flags_extra, "-Wl,--out-implib," .. path.join(path.directory(targetfile), path.basename(targetfile) .. ".lib"))
end
-- init arguments
+ opt = opt or {}
local argv = table.join("-o", targetfile, objectfiles, flags, flags_extra)
-
- -- too long arguments for windows?
- if is_host("windows") then
- opt = opt or {}
- local args = os.args(argv, {escape = true})
- if #args > 1024 and not opt.rawargs then
- local argsfile = os.tmpfile(args) .. ".args.txt"
- io.writefile(argsfile, args)
- argv = {"@" .. argsfile}
- end
+ if is_host("windows") and not opt.rawargs then
+ argv = winos.cmdargv(argv)
end
return self:program(), argv
end
diff --git a/xmake/modules/core/tools/ld.lua b/xmake/modules/core/tools/ld.lua
index 6894d21b8..9c273d325 100644
--- a/xmake/modules/core/tools/ld.lua
+++ b/xmake/modules/core/tools/ld.lua
@@ -72,17 +72,10 @@ end
function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
-- init arguments
+ opt = opt or {}
local argv = table.join("-o", targetfile, objectfiles, flags)
-
- -- too long arguments for windows?
- if is_host("windows") then
- opt = opt or {}
- local args = os.args(argv, {escape = true})
- if #args > 1024 and not opt.rawargs then
- local argsfile = os.tmpfile(args) .. ".args.txt"
- io.writefile(argsfile, args)
- argv = {"@" .. argsfile}
- end
+ if is_host("windows") and not opt.rawargs then
+ argv = winos.cmdargv(argv)
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 0d890bd5c..ff33efd4f 100644
--- a/xmake/modules/core/tools/llvm_ar.lua
+++ b/xmake/modules/core/tools/llvm_ar.lua
@@ -47,17 +47,10 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
assert(targetkind == "static")
-- init arguments
+ opt = opt or {}
local argv = table.join(flags, targetfile, objectfiles)
-
- -- too long arguments for windows?
- if is_host("windows") then
- opt = opt or {}
- local args = os.args(argv, {escape = true})
- if #args > 1024 and not opt.rawargs then
- local argsfile = os.tmpfile(args) .. ".args.txt"
- io.writefile(argsfile, args)
- argv = {"@" .. argsfile}
- end
+ if is_host("windows") and not opt.rawargs then
+ argv = winos.cmdargv(argv)
end
-- make it
diff --git a/xmake/modules/core/tools/sdar.lua b/xmake/modules/core/tools/sdar.lua
index be8cdae6c..7b05a6ef2 100644
--- a/xmake/modules/core/tools/sdar.lua
+++ b/xmake/modules/core/tools/sdar.lua
@@ -49,17 +49,10 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
assert(targetkind == "static")
-- init arguments
+ opt = opt or {}
local argv = table.join(flags, targetfile, objectfiles)
-
- -- too long arguments for windows?
- if is_host("windows") then
- opt = opt or {}
- local args = os.args(argv, {escape = true})
- if #args > 1024 and not opt.rawargs then
- local argsfile = os.tmpfile(args) .. ".args.txt"
- io.writefile(argsfile, args)
- argv = {"@" .. argsfile}
- end
+ if is_host("windows") and not opt.rawargs then
+ argv = winos.cmdargv(argv)
end
-- make it