diff options
| author | ruki <[email protected]> | 2024-05-09 23:32:22 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-05-09 23:32:22 +0800 |
| commit | f66ae558c39dfa1411c1e1e2653b8bd4249f477d (patch) | |
| tree | 2194a9cf9cda1b94b55ddc5ce07b9305a4624a28 | |
| parent | d874b69fea978efc2306c4108a21ce295617683a (diff) | |
| parent | aa278bc7fc0b723a315120bb95531991b7939229 (diff) | |
Merge pull request #5078 from xmake-io/tool
improve to system/find_package
| -rw-r--r-- | xmake/modules/package/manager/system/find_package.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/xmake/modules/package/manager/system/find_package.lua b/xmake/modules/package/manager/system/find_package.lua index 9a2a7ea55..4d939e495 100644 --- a/xmake/modules/package/manager/system/find_package.lua +++ b/xmake/modules/package/manager/system/find_package.lua @@ -20,6 +20,7 @@ -- imports import("core.language.language") +import("core.platform.platform") import("private.core.base.is_cross") import("lib.detect.check_cxsnippets") @@ -40,8 +41,17 @@ end -- check package toolchains function _check_package_toolchains(package) local has_standalone - for _, toolchain_inst in ipairs(package:toolchains()) do - if toolchain_inst:check() and toolchain_inst:is_standalone() then + if package:toolchains() then + for _, toolchain_inst in ipairs(package:toolchains()) do + if toolchain_inst:check() and toolchain_inst:is_standalone() then + has_standalone = true + end + end + else + -- we need also check platform toolchain, perhaps it has a different platform arch. + -- @see https://github.com/xmake-io/xmake/issues/4043#issuecomment-2102486249 + local platform_inst = platform.load(package:plat(), package:arch()) + if platform_inst:check() then has_standalone = true end end @@ -76,7 +86,7 @@ function main(name, opt) -- But if it depends on some toolchain packages, -- then they can't be detected early in the fetch and we have to disable system.find_package local package = opt.package - if package and package:toolchains() and not _check_package_toolchains(package) then + if package and not _check_package_toolchains(package) then return end |
