summaryrefslogtreecommitdiff
path: root/xmake/core/project/target.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-23 23:07:54 +0800
committerruki <[email protected]>2024-01-25 12:09:58 +0800
commit5b7ead17c49b68f8cfd6ca5325f5ccfe1b3e82cc (patch)
tree04f976d30336b08578f4e5b570c4271998544cca /xmake/core/project/target.lua
parenteeb0f80823bfd4fdd45a9d9a4eede7f407905fea (diff)
limit runtimes
Diffstat (limited to 'xmake/core/project/target.lua')
-rw-r--r--xmake/core/project/target.lua22
1 files changed, 18 insertions, 4 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 6d6fe66d5..b5fe3b35b 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -2385,8 +2385,22 @@ function _instance:runtimes()
local runtimes = self:_memcache():get("runtimes")
if runtimes == nil then
runtimes = self:get("runtimes")
- if runtimes and #runtimes > 0 then
- runtimes = table.unwrap(runtimes)
+ if runtimes then
+ local runtimes_supported = hashset.new()
+ for _, toolchain_inst in ipairs(self:toolchains()) do
+ if toolchain_inst:is_standalone() and toolchain_inst:get("runtimes") then
+ for _, runtime in ipairs(table.wrap(toolchain_inst:get("runtimes"))) do
+ runtimes_supported:insert(runtime)
+ end
+ end
+ end
+ local runtimes_current = {}
+ for _, runtime in ipairs(table.wrap(runtimes)) do
+ if runtimes_supported:has(runtime) then
+ table.insert(runtimes_current, runtime)
+ end
+ end
+ runtimes = table.unwrap(runtimes_current)
end
runtimes = runtimes or false
self:_memcache():set("runtimes", runtimes)
@@ -2396,10 +2410,10 @@ end
-- has the given runtime for the current toolchains?
function _instance:has_runtime(...)
- local runtimes_set = self._RUNTIMES_SET
+ local runtimes_set = self:_memcache():get("runtimes_set")
if runtimes_set == nil then
runtimes_set = hashset.from(table.wrap(self:runtimes()))
- self._RUNTIMES_SET = runtimes_set
+ self:_memcache():set("runtimes_set", runtimes_set)
end
for _, v in ipairs(table.pack(...)) do
if runtimes_set:has(v) then