summaryrefslogtreecommitdiff
path: root/xmake/core/tool/toolchain.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-20 23:42:09 +0800
committerruki <[email protected]>2024-01-25 12:09:58 +0800
commiteddb673f8fffc281fa9a5c9ef56ef0c00495a627 (patch)
tree4751ce05ae47f80af73f8aa713de55fd513c8cbf /xmake/core/tool/toolchain.lua
parentc622a4e8a6542cc9234344ab323139f5e8f23612 (diff)
limit toolchain runtimes
Diffstat (limited to 'xmake/core/tool/toolchain.lua')
-rw-r--r--xmake/core/tool/toolchain.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua
index 020b790d8..ab9673c91 100644
--- a/xmake/core/tool/toolchain.lua
+++ b/xmake/core/tool/toolchain.lua
@@ -110,7 +110,23 @@ end
-- get toolchain runtimes
function _instance:runtimes()
- return self:config("runtimes")
+ local runtimes = self._RUNTIMES
+ if runtimes == nil then
+ runtimes = {}
+ local runtimes_supported = hashset.from(table.wrap(self:get("runtimes")))
+ for _, runtime in ipairs(table.wrap(self:config("runtimes"))) do
+ if runtimes_supported:has(runtime) then
+ table.insert(runtimes, runtime)
+ end
+ end
+ if #runtimes > 0 then
+ runtimes = table.unwrap(runtimes)
+ else
+ runtimes = false
+ end
+ self._RUNTIMES = runtimes
+ end
+ return runtimes or nil
end
-- has the given runtime for the current toolchains?
@@ -587,6 +603,7 @@ function toolchain.apis()
, "toolchain.set_bindir"
, "toolchain.set_sdkdir"
, "toolchain.set_archs"
+ , "toolchain.set_runtimes"
, "toolchain.set_homepage"
, "toolchain.set_description"
}