diff options
| author | Saikari <[email protected]> | 2026-02-02 09:13:11 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-02 09:13:11 +0300 |
| commit | a172936c31bd2ef1cb7711e68ca584c9e951f487 (patch) | |
| tree | 699dd6a864f0bb0d7b7c722b813c60390f39b4aa | |
| parent | 16235c0f74b9957aa26fd93e0e87308296fc294f (diff) | |
| parent | 84ecebb4e9beaef3d046617c9c5ae3c1714a4aa8 (diff) | |
Merge branch 'xmake-io:dev' into stdin
| -rw-r--r-- | xmake/core/base/utf8.lua | 5 | ||||
| -rw-r--r-- | xmake/core/platform/platform.lua | 4 | ||||
| -rw-r--r-- | xmake/core/tool/toolchain.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/private/utils/toolchain.lua | 10 | ||||
| -rw-r--r-- | xmake/toolchains/kotlin-native/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/toolchains/zig/xmake.lua | 3 |
6 files changed, 23 insertions, 10 deletions
diff --git a/xmake/core/base/utf8.lua b/xmake/core/base/utf8.lua index 67b52e7ec..a35469849 100644 --- a/xmake/core/base/utf8.lua +++ b/xmake/core/base/utf8.lua @@ -37,6 +37,11 @@ local utf8 = utf8 or {} -- @interface utf8.byte(s [, i [, j]]) -- +-- the utf8 bom +if not utf8.bom then + utf8.bom = "\239\187\191" +end + -- the char pattern if not utf8.charpattern then utf8.charpattern = "[\0-\x7F\xC2-\xFD][\x80-\xBF]*" 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 diff --git a/xmake/modules/private/utils/toolchain.lua b/xmake/modules/private/utils/toolchain.lua index b1a26b8da..bf24d3c73 100644 --- a/xmake/modules/private/utils/toolchain.lua +++ b/xmake/modules/private/utils/toolchain.lua @@ -168,10 +168,14 @@ function get_clang_target(toolchain) end -- get clang target flags +-- @see https://github.com/xmake-io/xmake/issues/7271 function get_clang_target_flags(toolchain) - local target = get_clang_target(toolchain) - if target then - return "--target=" .. target + local target + if toolchain:is_cross() or toolchain:is_plat("windows") then + target = get_clang_target(toolchain) + if target then + return "--target=" .. target + end end if toolchain:is_arch("x86_64", "x64") then return "-m64" diff --git a/xmake/toolchains/kotlin-native/xmake.lua b/xmake/toolchains/kotlin-native/xmake.lua index 5e72b0ec1..7633af107 100644 --- a/xmake/toolchains/kotlin-native/xmake.lua +++ b/xmake/toolchains/kotlin-native/xmake.lua @@ -78,7 +78,6 @@ toolchain("kotlin-native") end) on_load(function (toolchain) - import("private.core.base.is_cross") -- bind runenvs for java local runenvs = toolchain:config("runenvs") @@ -91,7 +90,7 @@ toolchain("kotlin-native") -- kotlinc-native -list-targets local target_plat = toolchain:plat() local target_arch = toolchain:arch() - if target_plat and target_arch and is_cross(target_plat, target_arch) then + if target_plat and target_arch and toolchain:is_cross() then if target_plat == "macosx" then target_plat = "macos" elseif target_plat == "iphoneos" then diff --git a/xmake/toolchains/zig/xmake.lua b/xmake/toolchains/zig/xmake.lua index 72e4b943f..d1b2165e4 100644 --- a/xmake/toolchains/zig/xmake.lua +++ b/xmake/toolchains/zig/xmake.lua @@ -78,7 +78,6 @@ toolchain("zig") on_load(function (toolchain) import("core.base.semver") - import("private.core.base.is_cross") -- set toolset -- we patch target to `zig cc` to fix has_flags. see https://github.com/xmake-io/xmake/issues/955#issuecomment-766929692 @@ -110,7 +109,7 @@ toolchain("zig") -- get target from cross only for cross-compilation -- @see https://github.com/xmake-io/xmake/issues/7180 local target - if not target and is_cross(toolchain:plat(), toolchain:arch()) then + if not target and toolchain:is_cross() then target = toolchain:cross() end |
