summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-20 19:14:20 +0800
committerruki <[email protected]>2020-06-20 19:14:20 +0800
commit8a4d7349f8562a3cf5869dfa4a6460c049f44f3b (patch)
treeb508e7659b0c6be16fbafeb9481df9751a60992f
parent966b8dd7a01b09a93ba21ee4d2df0d471ab2282c (diff)
fix check options
-rw-r--r--xmake/core/platform/platform.lua3
-rw-r--r--xmake/core/tool/tool.lua2
-rw-r--r--xmake/modules/core/tools/ml.lua27
-rw-r--r--xmake/modules/core/tools/rc.lua3
4 files changed, 9 insertions, 26 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index d29c4d3a4..093f5b4bd 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -189,9 +189,10 @@ function _instance:tool(toolkind)
for idx, toolchain_inst in ipairs(toolchains) do
program, toolname = toolchain_inst:tool(toolkind)
if program then
+ toolchain_info = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch()}
toolinfo[1] = program
toolinfo[2] = toolname
- toolinfo[3] = {name = toolchain_inst:name(), plat = toolchain_inst:plat(), arch = toolchain_inst:arch()}
+ toolinfo[3] = toolchain_info
break
end
end
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index 44df48bb0..144ea0d61 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -239,7 +239,7 @@ function tool.load(kind, opt)
-- load toolchain instance
local toolchain_inst
if toolchain_info and toolchain_info.name then
- toolchain_inst = toolchain.load(toolchain_info.name, plat, arch)
+ toolchain_inst = toolchain.load(toolchain_info.name, {plat = plat, arch = arch})
end
-- new an instance
diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua
index 4899b46c6..42c10b633 100644
--- a/xmake/modules/core/tools/ml.lua
+++ b/xmake/modules/core/tools/ml.lua
@@ -91,12 +91,12 @@ function nf_includedir(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("-c", flags, "-Fo" .. os.args(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))
@@ -105,7 +105,8 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags)
{
function ()
-- @note we need not uses vstool.runv to enable unicode output for ml.exe
- os.runv(_compargv1(self, sourcefile, objectfile, flags))
+ local program, argv = compargv(self, sourcefile, objectfile, flags)
+ os.runv(program, argv, {envs = opt.envs})
end,
catch
{
@@ -125,23 +126,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/rc.lua b/xmake/modules/core/tools/rc.lua
index cdaaa6b49..df26e6f09 100644
--- a/xmake/modules/core/tools/rc.lua
+++ b/xmake/modules/core/tools/rc.lua
@@ -59,7 +59,8 @@ function compile(self, sourcefile, objectfile, dependinfo, flags)
{
function ()
-- @note we need not uses vstool.iorunv to enable unicode output for rc.exe
- local outdata, errdata = os.iorunv(compargv(self, sourcefile, objectfile, flags))
+ local program, argv = compargv(self, sourcefile, objectfile, flags)
+ local outdata, errdata = os.iorunv(program, argv, {envs = opt.envs})
return (outdata or "") .. (errdata or "")
end,
catch