diff options
| author | ruki <[email protected]> | 2026-01-31 00:55:07 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-02-01 16:53:34 +0800 |
| commit | a6ebbeecfd5d6ebe084ac5d3d45e1358e89110d3 (patch) | |
| tree | 7cee8633ccb6cf0b3183b7ac128c225d8e4ce407 /xmake/core | |
| parent | d7bdbc99bcc5b64a3fa257c5835014f5d8878150 (diff) | |
add target flags for cross-compilation
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/platform/platform.lua | 4 | ||||
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index 61fee4ec3..f5eb9ab94 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -204,8 +204,8 @@ function _instance:toolchains(opt) if not toolchain_inst then os.raise(errors) end - -- ignore cross toolchains for the host platform:w - if (self:is_host() and not toolchain_inst:is_cross()) or not self:is_host() then + -- ignore cross toolchains for the host platform + if (self:is_host() and not toolchain_inst:is_cross_toolchain()) or not self:is_host() then table.insert(toolchains, toolchain_inst) end end diff --git a/xmake/core/tool/toolchain.lua b/xmake/core/tool/toolchain.lua index 1da1634db..35be6b824 100644 --- a/xmake/core/tool/toolchain.lua +++ b/xmake/core/tool/toolchain.lua @@ -32,6 +32,7 @@ local option = require("base/option") local hashset = require("base/hashset") local scopeinfo = require("base/scopeinfo") local interpreter = require("base/interpreter") +local is_cross = require("base/private/is_cross") local config = require("project/config") local memcache = require("cache/memcache") local localcache = require("cache/localcache") @@ -203,8 +204,13 @@ function _instance:formats() return self:info():get("formats") end --- is cross-compilation toolchain? +-- is cross-compilation? function _instance:is_cross() + return is_cross(self:plat(), self:arch()) or self:is_cross_toolchain() +end + +-- is cross-compilation toolchain? +function _instance:is_cross_toolchain() if self:kind() == "cross" then return true elseif self:kind() == "standalone" and (self:cross() or self:config("sdkdir") or self:info():get("sdkdir")) then |
