From eddb673f8fffc281fa9a5c9ef56ef0c00495a627 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 20 Jan 2024 23:42:09 +0800 Subject: limit toolchain runtimes --- xmake/core/tool/toolchain.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'xmake/core/tool/toolchain.lua') 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" } -- cgit v1.3.1