summaryrefslogtreecommitdiff
path: root/xmake/core
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
parentc622a4e8a6542cc9234344ab323139f5e8f23612 (diff)
limit toolchain runtimes
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/platform/platform.lua7
-rw-r--r--xmake/core/project/target.lua7
-rw-r--r--xmake/core/tool/toolchain.lua19
3 files changed, 29 insertions, 4 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index 322e976b8..180e5401e 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -157,8 +157,11 @@ function _instance:runtimes()
elseif self:name() == "android" then
runtimes = runtimes or config.get("ndk_cxxstl")
end
- if runtimes then
- runtimes = table.unwrap(runtimes:split(",", {plain = true}))
+ runtimes = runtimes:split(",", {plain = true})
+ if #runtimes > 0 then
+ runtimes = table.unwrap(runtimes)
+ else
+ runtimes = nil
end
runtimes = runtimes or false
self:_memcache():set("runtimes", runtimes)
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 74d8b77b5..fd8421051 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -2391,7 +2391,12 @@ function _instance:runtimes()
runtimes = runtimes or config.get("ndk_cxxstl")
end
if runtimes then
- runtimes = table.unwrap(runtimes:split(",", {plain = true}))
+ runtimes = runtimes:split(",", {plain = true})
+ if #runtimes > 0 then
+ runtimes = table.unwrap(runtimes)
+ else
+ runtimes = nil
+ end
end
runtimes = runtimes or false
self:_memcache():set("runtimes", runtimes)
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"
}