summaryrefslogtreecommitdiff
path: root/xmake/core/tool
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-26 00:34:08 +0800
committerruki <[email protected]>2020-05-25 21:24:53 +0800
commit97b53dfcb67c898f40fae06b6b939e4dac32a3a0 (patch)
treec91bfc82592938ae27e2a72ec38737b33cd3988a /xmake/core/tool
parent05b37be8865ff1af2051766a835e7576a6780e55 (diff)
add set_toolchains for target
Diffstat (limited to 'xmake/core/tool')
-rw-r--r--xmake/core/tool/compiler.lua12
-rw-r--r--xmake/core/tool/linker.lua12
-rw-r--r--xmake/core/tool/tool.lua6
3 files changed, 9 insertions, 21 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 27c81879c..1f0d7d6d6 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -71,19 +71,13 @@ end
function compiler._load_tool(sourcekind, target)
-- get program from target
- local program = nil
+ local program, toolname
if target then
- program = target:get("toolchain." .. sourcekind)
- if not program then
- local tools = target:get("tools") -- TODO: deprecated
- if tools then
- program = tools[sourcekind]
- end
- end
+ program, toolname = target:tool(sourcekind)
end
-- load the compiler tool from the source kind
- local result, errors = tool.load(sourcekind, program)
+ local result, errors = tool.load(sourcekind, program, toolname)
if not result then
return nil, errors
end
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index b3f91a904..bbb088e7c 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -78,19 +78,13 @@ function linker._load_tool(targetkind, sourcekinds, target)
for _, _linkerinfo in ipairs(linkerinfos) do
-- get program from target
- local program = nil
+ local program, toolname
if target then
- program = target:get("toolchain." .. _linkerinfo.linkerkind)
- if not program then
- local tools = target:get("tools") -- TODO: deprecated
- if tools then
- program = tools[_linkerinfo.linkerkind]
- end
- end
+ program, toolname = target:tool(_linkerinfo.linkerkind)
end
-- load the linker tool from the linker kind (with cache)
- linkertool, errors = tool.load(_linkerinfo.linkerkind, program)
+ linkertool, errors = tool.load(_linkerinfo.linkerkind, program, toolname)
if linkertool then
linkerinfo = _linkerinfo
linkerinfo.program = program
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index 70c6e62f8..9e6dec6d4 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -130,9 +130,10 @@ end
-- load the given tool from the given kind
--
-- @param kind the tool kind e.g. cc, cxx, mm, mxx, as, ar, ld, sh, ..
--- @param program the tool program, e.g. /xxx/arm-linux-gcc, [email protected]
+-- @param program the tool program, e.g. /xxx/arm-linux-gcc, [email protected], (optional)
+-- @param toolname gcc, clang, .. (optional)
--
-function tool.load(kind, program)
+function tool.load(kind, program, toolname)
-- init key
local key = kind .. (program or "") .. (config.get("arch") or os.arch())
@@ -144,7 +145,6 @@ function tool.load(kind, program)
end
-- contain toolname? parse it, e.g. '[email protected]'
- local toolname = nil
if program then
local pos = program:find('@', 1, true)
if pos then