summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-28 22:32:12 +0800
committerruki <[email protected]>2025-10-28 22:32:12 +0800
commit0b7297bf243e4a8224d3a2eab9b205b969b88d77 (patch)
tree4fd96fc11fb909c79363f2060d214de2ddae4e0e
parentd4d2990f3f5d017542338acc1b753f669d4ec9a2 (diff)
fix trybuild/autoconf
-rw-r--r--xmake/modules/private/action/trybuild/autoconf.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/xmake/modules/private/action/trybuild/autoconf.lua b/xmake/modules/private/action/trybuild/autoconf.lua
index 4aa03a02e..f4771f060 100644
--- a/xmake/modules/private/action/trybuild/autoconf.lua
+++ b/xmake/modules/private/action/trybuild/autoconf.lua
@@ -64,11 +64,22 @@ function _get_buildenv(key)
return value
end
+-- is cross compilation?
+function _is_cross_compilation()
+ if not is_plat(os.subhost()) then
+ return true
+ end
+ if is_plat("macosx") and not is_arch(os.subarch()) then
+ return true
+ end
+ return false
+end
+
-- get the build environments
function _get_buildenvs()
local envs = {}
local cross = false
- if not is_cross() then
+ if not _is_cross_compilation() then
local cflags = table.join(table.wrap(_get_buildenv("cxflags")), _get_buildenv("cflags"))
local cxxflags = table.join(table.wrap(_get_buildenv("cxflags")), _get_buildenv("cxxflags"))
local asflags = table.copy(table.wrap(_get_buildenv("asflags")))
@@ -190,7 +201,7 @@ function _get_configs(artifacts_dir)
end
-- add host for cross-complation
- if is_cross() then
+ if _is_cross_compilation() then
if is_plat("iphoneos", "macosx") then
local triples =
{