summaryrefslogtreecommitdiff
path: root/xmake/platforms/checker.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-19 20:14:09 +0800
committerruki <[email protected]>2017-06-19 20:14:09 +0800
commite2d960162cd7c78eaa86ae3fc474a112ec4ddfbe (patch)
tree6fe8f2d89b879f7cc55da4641c827f16e71b3d2e /xmake/platforms/checker.lua
parent8a7b62bca9d65dfe01a8f63016da48aa650c3a89 (diff)
use find_toolname in tool.lua
Diffstat (limited to 'xmake/platforms/checker.lua')
-rw-r--r--xmake/platforms/checker.lua23
1 files changed, 12 insertions, 11 deletions
diff --git a/xmake/platforms/checker.lua b/xmake/platforms/checker.lua
index 458b5f0d5..6d761c1e0 100644
--- a/xmake/platforms/checker.lua
+++ b/xmake/platforms/checker.lua
@@ -32,9 +32,9 @@ import("lib.detect.find_toolname")
-- find the given tool
function _toolchain_check(config, toolkind, toolinfo)
- -- get the tool path
- local toolpath = config.get(toolkind)
- if not toolpath then
+ -- get the program
+ local program = config.get(toolkind)
+ if not program then
-- get name and attempt to get `$(env XX)`
local name = vformat(toolinfo.name)
@@ -46,27 +46,28 @@ function _toolchain_check(config, toolkind, toolinfo)
local cross = config.get("cross") or toolinfo.cross or ""
-- attempt to check it
- if not toolpath then
- toolpath = find_tool(name, {program = cross .. name, pathes = config.get("toolchains"), check = toolinfo.check})
+ local program = nil
+ if not program then
+ program = find_tool(name, {program = cross .. name, pathes = config.get("toolchains"), check = toolinfo.check})
end
-- check ok?
- if toolpath then
- config.set(toolkind, toolpath)
+ if program then
+ config.set(toolkind, program)
end
-- trace
if option.get("verbose") then
- if toolpath then
- cprint("checking for %s (%s) ... ${green}%s", toolinfo.description, toolkind, path.filename(toolpath))
+ if program then
+ cprint("checking for %s (%s) ... ${green}%s", toolinfo.description, toolkind, path.filename(program))
else
cprint("checking for %s (%s: ${red}%s${clear}) ... ${red}no", toolinfo.description, toolkind, name)
end
end
end
- -- get tool path
- return toolpath
+ -- ok?
+ return program
end
-- check all for the given config kind