summaryrefslogtreecommitdiff
path: root/xmake/toolchains/zig/xmake.lua
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-01-27 04:11:37 +0300
committerSaikari <[email protected]>2026-01-27 04:11:37 +0300
commit6ef9282d922b511f92a20b67edc99467ac1e763f (patch)
tree42756f5fbb094953ef60dfadcd980dee47f8ea02 /xmake/toolchains/zig/xmake.lua
parentb55dade1f55c21c498faa39463c5122b1a3bac22 (diff)
add target architecture validation for cross-compilation in zig toolchain
Diffstat (limited to 'xmake/toolchains/zig/xmake.lua')
-rw-r--r--xmake/toolchains/zig/xmake.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/toolchains/zig/xmake.lua b/xmake/toolchains/zig/xmake.lua
index e9d099782..7ae24eec4 100644
--- a/xmake/toolchains/zig/xmake.lua
+++ b/xmake/toolchains/zig/xmake.lua
@@ -135,6 +135,16 @@ toolchain("zig")
-- init target
local target = toolchain:cross()
+
+ if target then
+ local tarch = target:match("^(.-)-") or target
+ if arch == "x86_64" and tarch ~= "x86_64" then
+ target = nil
+ elseif arch == "aarch64" and tarch ~= "aarch64" then
+ target = nil
+ end
+ end
+
if target == nil then
if toolchain:is_plat("cross") then
-- xmake f -p cross --toolchain=zig --cross=mips64el-linux-gnuabi64