summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-09 16:37:27 +0800
committerGitHub <[email protected]>2021-02-09 16:37:27 +0800
commitb5b7cf1d0574b789d0d7d8a5ced75eaf16e82a99 (patch)
tree76ad10c3bf0d70c57aa5ea5a0c2e007d024f15a9
parentc4d7b7994101e9ed897a19fefc660874d9528f6c (diff)
parente37dbcd878fcb455b69ed57e7f271a8e614fb494 (diff)
Merge pull request #1236 from xmake-io/space
Fix includedirs with spaces
-rw-r--r--CHANGELOG.md2
-rw-r--r--tests/projects/c/static library with spaces/i n c/interface.h (renamed from tests/projects/c/static library with spaces/s r c/interface.h)0
-rw-r--r--tests/projects/c/static library with spaces/i n c/stdafx.h0
-rw-r--r--tests/projects/c/static library with spaces/xmake.lua3
-rw-r--r--xmake/actions/require/fetch.lua2
-rw-r--r--xmake/core/tool/builder.lua26
-rw-r--r--xmake/modules/core/tools/cl.lua15
-rw-r--r--xmake/modules/core/tools/cparser.lua4
-rw-r--r--xmake/modules/core/tools/dmd.lua11
-rw-r--r--xmake/modules/core/tools/gcc.lua24
-rw-r--r--xmake/modules/core/tools/go.lua4
-rw-r--r--xmake/modules/core/tools/ld.lua2
-rw-r--r--xmake/modules/core/tools/link.lua4
-rw-r--r--xmake/modules/core/tools/llvm_rc.lua6
-rw-r--r--xmake/modules/core/tools/ml.lua4
-rw-r--r--xmake/modules/core/tools/nasm.lua2
-rw-r--r--xmake/modules/core/tools/nvcc.lua20
-rw-r--r--xmake/modules/core/tools/rc.lua2
-rw-r--r--xmake/modules/core/tools/rustc.lua2
-rw-r--r--xmake/modules/core/tools/sdcc.lua4
-rw-r--r--xmake/modules/core/tools/swiftc.lua14
-rw-r--r--xmake/modules/core/tools/tcc.lua4
-rw-r--r--xmake/modules/core/tools/windres.lua2
-rw-r--r--xmake/modules/core/tools/yasm.lua28
-rw-r--r--xmake/modules/core/tools/zig.lua12
25 files changed, 86 insertions, 111 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5b3743a7e..526d31e8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@
### Bugs fixed
* [#1219](https://github.com/xmake-io/xmake/issues/1219): Fix version check and update
+* [#1235](https://github.com/xmake-io/xmake/issues/1235): Fix include directories with spaces
## v2.5.1
@@ -935,6 +936,7 @@
### Bugs 修复
* [#1219](https://github.com/xmake-io/xmake/issues/1219): 修复版本检测和更新
+* [#1235](https://github.com/xmake-io/xmake/issues/1235): 修复 includes 搜索路径中带有空格编译不过问题
## v2.5.1
diff --git a/tests/projects/c/static library with spaces/s r c/interface.h b/tests/projects/c/static library with spaces/i n c/interface.h
index 10ec0f856..10ec0f856 100644
--- a/tests/projects/c/static library with spaces/s r c/interface.h
+++ b/tests/projects/c/static library with spaces/i n c/interface.h
diff --git a/tests/projects/c/static library with spaces/i n c/stdafx.h b/tests/projects/c/static library with spaces/i n c/stdafx.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/projects/c/static library with spaces/i n c/stdafx.h
diff --git a/tests/projects/c/static library with spaces/xmake.lua b/tests/projects/c/static library with spaces/xmake.lua
index 3febc19f3..ac93d8441 100644
--- a/tests/projects/c/static library with spaces/xmake.lua
+++ b/tests/projects/c/static library with spaces/xmake.lua
@@ -3,11 +3,12 @@ add_rules("mode.release", "mode.debug")
target("test")
set_kind("static")
add_files("s r c/interface.c")
- add_includedirs("$(projectdir)/s r c", {public = true})
+ add_sysincludedirs("$(projectdir)/i n c", {public = true})
target("demo")
set_kind("binary")
add_deps("test")
add_files("s r c/test.c")
+ set_pcheader("$(projectdir)/i n c/stdafx.h")
diff --git a/xmake/actions/require/fetch.lua b/xmake/actions/require/fetch.lua
index 2fd75d7b6..7a7a85fce 100644
--- a/xmake/actions/require/fetch.lua
+++ b/xmake/actions/require/fetch.lua
@@ -85,7 +85,7 @@ function main(requires_raw)
end
end
if #flags > 0 then
- print(table.concat(flags, " "))
+ print(os.args(flags))
else
print(fetchinfos)
end
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 3433813c9..37c55e8cf 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -345,14 +345,14 @@ function builder:_add_flags_from_language(flags, target, getters)
local results = mapper(self:_tool(), table.wrap(getter(flagname)), target, self:_targetkind())
for _, flag in ipairs(table.wrap(results)) do
if flag and flag ~= "" and (not checkstate or self:has_flags(flag)) then
- table.join2(flags, flag)
+ table.insert(flags, flag)
end
end
else
for _, flagvalue in ipairs(table.wrap(getter(flagname))) do
local flag = mapper(self:_tool(), flagvalue, target, self:_targetkind())
if flag and flag ~= "" and (not checkstate or self:has_flags(flag)) then
- table.join2(flags, flag)
+ table.insert(flags, flag)
end
end
end
@@ -368,14 +368,22 @@ function builder:_preprocess_flags(flags)
local unique = {}
local results = {}
for _, flag in ipairs(flags) do
- flag = flag:trim()
- if #flag > 0 and not unique[flag] then
- if flag:find(" ", 1, true) then
- table.join2(results, os.argv(flag, {splitonly = true}))
- else
- table.insert(results, flag)
+ if type(flag) == "string" then
+ flag = flag:trim()
+ if #flag > 0 and not unique[flag] then
+ if flag:find(" ", 1, true) then
+ table.join2(results, os.argv(flag, {splitonly = true}))
+ else
+ table.insert(results, flag)
+ end
+ unique[flag] = true
+ end
+ else
+ -- may be a table group? e.g. {"-I", "/xxx"}
+ if #flag > 0 and not unique[flag] then
+ table.join2(results, flag)
+ unique[flag] = true
end
- unique[flag] = true
end
end
return results
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 64d4d2773..7b7ef3f9f 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -260,9 +260,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- -- @note we use os.args() to escape and wrap it,
- -- because all flags will be preprocessed in `builder:_preprocess_flags`/`os.argv()`
- return "-I" .. os.args(path.translate(dir))
+ return {"-I", path.translate(dir)}
end
-- make the sysincludedir flag
@@ -276,7 +274,7 @@ function nf_sysincludedir(self, dir)
_g._HAS_EXTERNAL_INCLUDEDIR = has_external_includedir
end
if has_external_includedir then
- return {"-experimental:external", "-external:W0", "-external:I" .. os.args(path.translate(dir))}
+ return {"-experimental:external", "-external:W0", "-external:I" .. path.translate(dir)}
else
return nf_includedir(self, dir)
end
@@ -293,9 +291,7 @@ function nf_pcheader(self, pcheaderfile, target)
if objectfiles then
table.insert(objectfiles, target:pcoutputfile("c") .. ".obj")
end
-
- -- make flag
- return "-Yu" .. path.filename(pcheaderfile) .. " -FI" .. path.filename(pcheaderfile) .. " -Fp" .. os.args(target:pcoutputfile("c"))
+ return {"-Yu" .. path.filename(pcheaderfile), "-FI" .. path.filename(pcheaderfile), "-Fp" .. target:pcoutputfile("c")}
end
end
@@ -310,9 +306,7 @@ function nf_pcxxheader(self, pcheaderfile, target)
if objectfiles then
table.insert(objectfiles, target:pcoutputfile("cxx") .. ".obj")
end
-
- -- make flag
- return "-Yu" .. path.filename(pcheaderfile) .. " -FI" .. path.filename(pcheaderfile) .. " -Fp" .. os.args(target:pcoutputfile("cxx"))
+ return {"-Yu" .. path.filename(pcheaderfile), "-FI" .. path.filename(pcheaderfile), "-Fp" .. target:pcoutputfile("cxx")}
end
end
@@ -388,7 +382,6 @@ function compargv(self, sourcefile, objectfile, flags, opt)
end
-- make the compile arguments list
- -- @note only flags in nf_xxx() need be wrapped via os.args, @see nf_includedir
local argv = table.join("-c", flags, "-Fo" .. objectfile, sourcefile)
return self:program(), (opt and opt.rawargs) and argv or winos.cmdargv(argv)
end
diff --git a/xmake/modules/core/tools/cparser.lua b/xmake/modules/core/tools/cparser.lua
index e24ca87fc..a080268be 100644
--- a/xmake/modules/core/tools/cparser.lua
+++ b/xmake/modules/core/tools/cparser.lua
@@ -115,7 +115,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
@@ -135,7 +135,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return {"-L", dir}
end
-- make the link arguments list
diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua
index c172641ac..2a9d860e1 100644
--- a/xmake/modules/core/tools/dmd.lua
+++ b/xmake/modules/core/tools/dmd.lua
@@ -94,7 +94,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I" .. dir}
end
-- make the sysincludedir flag
@@ -114,20 +114,19 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L-L" .. os.args(dir)
+ return {"-L-L" .. dir}
end
-- make the rpathdir flag
function nf_rpathdir(self, dir)
dir = path.translate(dir)
if self:has_flags("-L-rpath=" .. dir, "ldflags") then
- return "-L-rpath=" .. os.args(dir:gsub("@[%w_]+", function (name)
+ return {"-L-rpath=" .. (dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
return maps[name]
- end))
-
+ end))}
elseif self:has_flags("-L-rpath -L" .. dir, "ldflags") then
- return "-L-rpath -L" .. os.args(dir:gsub("%$ORIGIN", "@loader_path"))
+ return {"-L-rpath", "-L" .. (dir:gsub("%$ORIGIN", "@loader_path"))}
end
end
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 4be53c113..24bb62e13 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -233,12 +233,12 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(path.translate(dir))
+ return {"-I", path.translate(dir)}
end
-- make the sysincludedir flag
function nf_sysincludedir(self, dir)
- return "-isystem " .. os.args(path.translate(dir))
+ return {"-isystem", path.translate(dir)}
end
-- make the link flag
@@ -253,30 +253,30 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(path.translate(dir))
+ return {"-L", path.translate(dir)}
end
-- make the rpathdir flag
function nf_rpathdir(self, dir)
dir = path.translate(dir)
if self:has_flags("-Wl,-rpath=" .. dir, "ldflags") then
- return "-Wl,-rpath=" .. os.args(dir:gsub("@[%w_]+", function (name)
+ return {"-Wl,-rpath=" .. (dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
return maps[name]
- end))
+ end))}
elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir, "ldflags") then
- return "-Xlinker -rpath -Xlinker " .. os.args(dir:gsub("%$ORIGIN", "@loader_path"))
+ return {"-Xlinker", "-rpath", "-Xlinker", (dir:gsub("%$ORIGIN", "@loader_path"))}
end
end
-- make the framework flag
function nf_framework(self, framework)
- return "-framework " .. framework
+ return {"-framework", framework}
end
-- make the frameworkdir flag
function nf_frameworkdir(self, frameworkdir)
- return "-F " .. os.args(path.translate(frameworkdir))
+ return {"-F", path.translate(frameworkdir)}
end
-- make the c precompiled header flag
@@ -284,9 +284,9 @@ function nf_pcheader(self, pcheaderfile, target)
if self:kind() == "cc" then
local pcoutputfile = target:pcoutputfile("c")
if self:name() == "clang" then
- return "-include " .. os.args(pcheaderfile) .. " -include-pch " .. os.args(pcoutputfile)
+ return {"-include", pcheaderfile, "-include-pch", pcoutputfile}
else
- return "-include " .. path.filename(pcheaderfile) .. " -I" .. os.args(path.directory(pcoutputfile))
+ return {"-include", path.filename(pcheaderfile), "-I", path.directory(pcoutputfile)}
end
end
end
@@ -296,9 +296,9 @@ function nf_pcxxheader(self, pcheaderfile, target)
if self:kind() == "cxx" then
local pcoutputfile = target:pcoutputfile("cxx")
if self:name() == "clang" then
- return "-include " .. os.args(pcheaderfile) .. " -include-pch " .. os.args(pcoutputfile)
+ return {"-include", pcheaderfile, "-include-pch", pcoutputfile}
else
- return "-include " .. path.filename(pcheaderfile) .. " -I" .. os.args(path.directory(pcoutputfile))
+ return {"-include", path.filename(pcheaderfile), "-I", path.directory(pcoutputfile)}
end
end
end
diff --git a/xmake/modules/core/tools/go.lua b/xmake/modules/core/tools/go.lua
index 17e15bf8c..fbd046cf0 100644
--- a/xmake/modules/core/tools/go.lua
+++ b/xmake/modules/core/tools/go.lua
@@ -80,7 +80,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I " .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
@@ -90,7 +90,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L " .. os.args(dir)
+ return {"-L", dir}
end
-- make the link arguments list
diff --git a/xmake/modules/core/tools/ld.lua b/xmake/modules/core/tools/ld.lua
index c641823bb..0eaa8fc91 100644
--- a/xmake/modules/core/tools/ld.lua
+++ b/xmake/modules/core/tools/ld.lua
@@ -65,7 +65,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(path.translate(dir))
+ return {"-L", path.translate(dir)}
end
-- make the link arguments list
diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua
index 26abc8983..9a70de9ce 100644
--- a/xmake/modules/core/tools/link.lua
+++ b/xmake/modules/core/tools/link.lua
@@ -78,7 +78,7 @@ function nf_symbol(self, level, target)
local targetkind = target:get("kind")
if level == "debug" and (targetkind == "binary" or targetkind == "shared") then
if target and target.symbolfile then
- flags = "-debug -pdb:" .. target:symbolfile()
+ flags = {"-debug", "-pdb:" .. target:symbolfile()}
else
flags = "-debug"
end
@@ -105,7 +105,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-libpath:" .. os.args(path.translate(dir))
+ return {"-libpath:" .. path.translate(dir)}
end
-- make the link arguments list
diff --git a/xmake/modules/core/tools/llvm_rc.lua b/xmake/modules/core/tools/llvm_rc.lua
index 342670d5e..7feb8a621 100644
--- a/xmake/modules/core/tools/llvm_rc.lua
+++ b/xmake/modules/core/tools/llvm_rc.lua
@@ -29,17 +29,17 @@ end
-- make the define flag
function nf_define(self, macro)
- return "/D " .. macro
+ return {"/D", macro}
end
-- make the undefine flag
function nf_undefine(self, macro)
- return "/U " .. macro
+ return {"/U", macro}
end
-- make the includedir flag
function nf_includedir(self, dir)
- return "/I " .. os.args(dir)
+ return {"/I", dir}
end
-- make the sysincludedir flag
diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua
index e3893d05e..a90cade20 100644
--- a/xmake/modules/core/tools/ml.lua
+++ b/xmake/modules/core/tools/ml.lua
@@ -87,7 +87,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
@@ -97,7 +97,7 @@ end
-- make the compile arguments list
function compargv(self, sourcefile, objectfile, flags)
- return self:program(), table.join("-c", flags, "-Fo" .. os.args(objectfile), sourcefile)
+ return self:program(), table.join("-c", flags, "-Fo" .. objectfile, sourcefile)
end
-- compile the source file
diff --git a/xmake/modules/core/tools/nasm.lua b/xmake/modules/core/tools/nasm.lua
index 9f2a51882..8297e21bc 100644
--- a/xmake/modules/core/tools/nasm.lua
+++ b/xmake/modules/core/tools/nasm.lua
@@ -70,7 +70,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua
index c0e844356..011599e8a 100644
--- a/xmake/modules/core/tools/nvcc.lua
+++ b/xmake/modules/core/tools/nvcc.lua
@@ -200,7 +200,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
@@ -220,29 +220,29 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return {"-L", dir}
end
-- make the rpathdir flag
function nf_rpathdir(self, dir)
if self:has_flags("-Wl,-rpath=" .. dir, "ldflags") then
- return "-Wl,-rpath=" .. os.args(dir:gsub("@[%w_]+", function (name)
+ return {"-Wl,-rpath=" .. (dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
return maps[name]
- end))
+ end))}
elseif self:has_flags("-Xlinker -rpath -Xlinker " .. dir, "ldflags") then
- return "-Xlinker -rpath -Xlinker " .. os.args(dir:gsub("%$ORIGIN", "@loader_path"))
+ return {"-Xlinker", "-rpath", "-Xlinker", (dir:gsub("%$ORIGIN", "@loader_path"))}
end
end
-- make the c precompiled header flag
function nf_pcheader(self, pcheaderfile, target)
- return "-include " .. os.args(pcheaderfile)
+ return {"-include", pcheaderfile}
end
-- make the c++ precompiled header flag
function nf_pcxxheader(self, pcheaderfile, target)
- return "-include " .. os.args(pcheaderfile)
+ return {"-include", pcheaderfile}
end
-- make the link arguments list
@@ -260,7 +260,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags)
-- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc
if targetkind == "shared" and config.plat() == "mingw" then
table.insert(flags_extra, "-Xlinker")
- 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
-- make link args
@@ -269,11 +269,7 @@ end
-- link the target file
function link(self, objectfiles, targetkind, targetfile, flags)
-
- -- ensure the target directory
os.mkdir(path.directory(targetfile))
-
- -- link it
os.runv(linkargv(self, objectfiles, targetkind, targetfile, flags))
end
diff --git a/xmake/modules/core/tools/rc.lua b/xmake/modules/core/tools/rc.lua
index a9db3903c..208161b67 100644
--- a/xmake/modules/core/tools/rc.lua
+++ b/xmake/modules/core/tools/rc.lua
@@ -43,7 +43,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I" .. dir}
end
-- make the sysincludedir flag
diff --git a/xmake/modules/core/tools/rustc.lua b/xmake/modules/core/tools/rustc.lua
index 0af2acdd9..ade2daea4 100644
--- a/xmake/modules/core/tools/rustc.lua
+++ b/xmake/modules/core/tools/rustc.lua
@@ -72,7 +72,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return {"-L" .. dir}
end
-- make the build arguments list
diff --git a/xmake/modules/core/tools/sdcc.lua b/xmake/modules/core/tools/sdcc.lua
index 0f307d6ff..351833b14 100644
--- a/xmake/modules/core/tools/sdcc.lua
+++ b/xmake/modules/core/tools/sdcc.lua
@@ -133,7 +133,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
@@ -153,7 +153,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return {"-L", dir}
end
-- make the link arguments list
diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua
index f56e9b392..f67a809bf 100644
--- a/xmake/modules/core/tools/swiftc.lua
+++ b/xmake/modules/core/tools/swiftc.lua
@@ -142,22 +142,22 @@ end
-- make the define flag
function nf_define(self, macro)
- return "-Xcc -D" .. macro
+ return {"-Xcc", "-D" .. macro}
end
-- make the undefine flag
function nf_undefine(self, macro)
- return "-Xcc -U" .. macro
+ return {"-Xcc", "-U" .. macro}
end
-- make the framework flag
function nf_framework(self, framework)
- return "-framework " .. framework
+ return {"-framework", framework}
end
-- make the frameworkdir flag
function nf_frameworkdir(self, frameworkdir)
- return "-F " .. os.args(frameworkdir)
+ return {"-F", frameworkdir}
end
-- make the link flag
@@ -172,7 +172,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return {"-L", dir}
end
-- make the link arguments list
@@ -182,11 +182,7 @@ end
-- link the target file
function link(self, objectfiles, targetkind, targetfile, flags)
-
- -- ensure the target directory
os.mkdir(path.directory(targetfile))
-
- -- link it
os.runv(linkargv(self, objectfiles, targetkind, targetfile, flags))
end
diff --git a/xmake/modules/core/tools/tcc.lua b/xmake/modules/core/tools/tcc.lua
index 39d78b598..d9e18a795 100644
--- a/xmake/modules/core/tools/tcc.lua
+++ b/xmake/modules/core/tools/tcc.lua
@@ -97,7 +97,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
@@ -117,7 +117,7 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return {"-L", dir}
end
-- make the link arguments list
diff --git a/xmake/modules/core/tools/windres.lua b/xmake/modules/core/tools/windres.lua
index 67a108cf7..9acb34515 100644
--- a/xmake/modules/core/tools/windres.lua
+++ b/xmake/modules/core/tools/windres.lua
@@ -39,7 +39,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
diff --git a/xmake/modules/core/tools/yasm.lua b/xmake/modules/core/tools/yasm.lua
index 4a2ab476d..75b835762 100644
--- a/xmake/modules/core/tools/yasm.lua
+++ b/xmake/modules/core/tools/yasm.lua
@@ -70,7 +70,7 @@ end
-- make the includedir flag
function nf_includedir(self, dir)
- return "-I" .. os.args(dir)
+ return {"-I", dir}
end
-- make the sysincludedir flag
@@ -79,12 +79,12 @@ function nf_sysincludedir(self, dir)
end
-- make the compile arguments list
-function _compargv1(self, sourcefile, objectfile, flags)
+function compargv(self, sourcefile, objectfile, flags)
return self:program(), table.join(flags, "-o", objectfile, sourcefile)
end
-- compile the source file
-function _compile1(self, sourcefile, objectfile, dependinfo, flags)
+function compile(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -93,7 +93,7 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags)
local outdata, errdata = try
{
function ()
- return os.iorunv(_compargv1(self, sourcefile, objectfile, flags))
+ return os.iorunv(compargv(self, sourcefile, objectfile, flags))
end,
catch
{
@@ -122,23 +122,3 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags)
}
end
--- make the compile arguments list
-function compargv(self, sourcefiles, objectfile, flags)
-
- -- only support single source file now
- assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-
- -- for only single source file
- return _compargv1(self, sourcefiles, objectfile, flags)
-end
-
--- compile the source file
-function compile(self, sourcefiles, objectfile, dependinfo, flags)
-
- -- only support single source file now
- assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-
- -- for only single source file
- _compile1(self, sourcefiles, objectfile, dependinfo, flags)
-end
-
diff --git a/xmake/modules/core/tools/zig.lua b/xmake/modules/core/tools/zig.lua
index ce03bc3cd..2270e2a3e 100644
--- a/xmake/modules/core/tools/zig.lua
+++ b/xmake/modules/core/tools/zig.lua
@@ -75,29 +75,29 @@ end
-- make the linkdir flag
function nf_linkdir(self, dir)
- return "-L" .. os.args(dir)
+ return {"-L", dir}
end
-- make the framework flag
function nf_framework(self, framework)
- return "-framework " .. framework
+ return {"-framework", framework}
end
-- make the frameworkdir flag
function nf_frameworkdir(self, frameworkdir)
- return "-F " .. os.args(path.translate(frameworkdir))
+ return {"-F", path.translate(frameworkdir)}
end
-- make the rpathdir flag
function nf_rpathdir(self, dir)
dir = path.translate(dir)
if is_plat("macosx") then
- return "-rpath " .. os.args(dir:gsub("%$ORIGIN", "@loader_path"))
+ return {"-rpath", (dir:gsub("%$ORIGIN", "@loader_path"))}
else
- return "-rpath " .. os.args(dir:gsub("@[%w_]+", function (name)
+ return {"-rpath", (dir:gsub("@[%w_]+", function (name)
local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
return maps[name]
- end))
+ end))}
end
end