diff options
| author | ruki <[email protected]> | 2024-01-23 23:00:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-01-25 12:09:58 +0800 |
| commit | eeb0f80823bfd4fdd45a9d9a4eede7f407905fea (patch) | |
| tree | 851062ff26866c7d9a911ad5ae91b6979d185438 | |
| parent | 229bccd5eeca9fb6da8b93c76d0d13f9c2b85314 (diff) | |
remove toolchain runtimes
| -rw-r--r-- | xmake/core/platform/platform.lua | 28 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 1 | ||||
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 35 | ||||
| -rw-r--r-- | xmake/toolchains/ndk/load.lua | 12 |
4 files changed, 13 insertions, 63 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 4a4b4bf96..f9a8fba77 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -147,30 +147,6 @@ function _instance:runenvs() return runenvs end --- get runtimes -function _instance:runtimes() - local runtimes = self:_memcache():get("runtimes") - if runtimes == nil then - runtimes = config.get("runtimes") - if self:name() == "windows" then - runtimes = runtimes or config.get("vs_runtime") - elseif self:name() == "android" then - runtimes = runtimes or config.get("ndk_cxxstl") - end - if runtimes then - 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) - end - return runtimes or nil -end - -- get the toolchains function _instance:toolchains(opt) local toolchains = self:_memcache():get("toolchains") @@ -187,7 +163,7 @@ function _instance:toolchains(opt) local toolchain_given = config.get("toolchain") if toolchain_given then local toolchain_inst, errors = toolchain.load(toolchain_given, { - plat = self:name(), arch = self:arch(), runtimes = self:runtimes()}) + plat = self:name(), arch = self:arch()}) -- attempt to load toolchain from project if not toolchain_inst and platform._project() then toolchain_inst = platform._project().toolchain(toolchain_given) @@ -207,7 +183,7 @@ function _instance:toolchains(opt) if names then for _, name in ipairs(table.wrap(names)) do local toolchain_inst, errors = toolchain.load(name, { - plat = self:name(), arch = self:arch(), runtimes = self:runtimes()}) + plat = self:name(), arch = self:arch()}) -- attempt to load toolchain from project if not toolchain_inst and platform._project() then toolchain_inst = platform._project().toolchain(name) diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index e2262049a..6d6fe66d5 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -2435,7 +2435,6 @@ function _instance:toolchains() local toolchain_opt = table.copy(self:extraconf("toolchains", name)) toolchain_opt.arch = self:arch() toolchain_opt.plat = self:plat() - toolchain_opt.runtimes = self:runtimes() local toolchain_inst, errors = toolchain.load(name, toolchain_opt) -- attempt to load toolchain from project if not toolchain_inst and target._project() then diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index ab9673c91..620b862d5 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -108,41 +108,6 @@ function _instance:is_arch(...) end end --- get toolchain runtimes -function _instance: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? -function _instance:has_runtime(...) - local runtimes_set = self._RUNTIMES_SET - if runtimes_set == nil then - runtimes_set = hashset.from(table.wrap(self:runtimes())) - self._RUNTIMES_SET = runtimes_set - end - for _, v in ipairs(table.pack(...)) do - if runtimes_set:has(v) then - return true - end - end -end - -- get toolchain info function _instance:info() local arch = self:arch() diff --git a/xmake/toolchains/ndk/load.lua b/xmake/toolchains/ndk/load.lua index b9e06c8dd..896e4b837 100644 --- a/xmake/toolchains/ndk/load.lua +++ b/xmake/toolchains/ndk/load.lua @@ -19,6 +19,7 @@ -- -- imports +import("core.base.hashset") import("core.project.config") -- get triple @@ -207,8 +208,17 @@ function main(toolchain) -- get c++ stl sdk directory local cxxstl_sdkdir = nil - local ndk_cxxstl = toolchain:runtimes() or config.get("ndk_cxxstl") + local ndk_cxxstl = config.get("runtimes") or config.get("ndk_cxxstl") if ndk_cxxstl then + if ndk_cxxstl:find(",", 1, true) then + local runtimes_supported = hashset.from(toolchain:get("runtimes")) + for _, item in ipairs(ndk_cxxstl:split(",")) do + if runtimes_supported:has(item) then + ndk_cxxstl = item + break + end + end + end -- we uses c++_static/c++_shared instead of llvmstl_static/llvmstl_shared if ndk_cxxstl:startswith("c++") or ndk_cxxstl:startswith("llvmstl") then cxxstl_sdkdir = cxxstl_sdkdir_llvmstl |
