summaryrefslogtreecommitdiff
path: root/xmake/core/platform/platform.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-22 22:49:44 +0800
committerruki <[email protected]>2020-05-22 10:58:29 +0800
commit9a3ccbc46480462a7d2a702c8c635af17cd85249 (patch)
tree19595fb3fc9235ed2deec008edcee470652957de /xmake/core/platform/platform.lua
parentb1df391694245eb0f1555b3855fad3faee0d2a82 (diff)
load toolchain from project
Diffstat (limited to 'xmake/core/platform/platform.lua')
-rw-r--r--xmake/core/platform/platform.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index af6a2f0e0..eb247f7af 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -135,6 +135,10 @@ function _instance:toolchains(opt)
local toolchain_given = config.get("toolchain")
if toolchain_given then
local toolchain_inst, errors = toolchain.load(toolchain_given)
+ -- attempt to load toolchain from project
+ if not toolchain_inst and platform._project() then
+ toolchain_inst = platform._project().toolchain(toolchain_given)
+ end
if not toolchain_inst then
os.raise(errors)
end
@@ -149,7 +153,11 @@ function _instance:toolchains(opt)
end
if names then
for _, name in ipairs(names) do
- local toolchain_inst, errors = toolchain.load(name, self:name())
+ local toolchain_inst, errors = toolchain.load(name)
+ -- attempt to load toolchain from project
+ if not toolchain_inst and platform._project() then
+ toolchain_inst = platform._project().toolchain(name)
+ end
if not toolchain_inst then
os.raise(errors)
end
@@ -343,6 +351,11 @@ function platform._interpreter()
return interp
end
+-- get project
+function platform._project()
+ return platform._PROJECT
+end
+
-- get platform apis
function platform._apis()
return