diff options
| author | ruki <[email protected]> | 2025-01-13 23:04:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-01-13 23:04:10 +0800 |
| commit | e553279e918bf8e693f2d59ef685809ae62264d1 (patch) | |
| tree | 58320de68e3345724263b6388155c4fd2fa178c4 | |
| parent | aa5cdd8fbcaa499b9266455545b7777b446c7812 (diff) | |
improve cross for zig
| -rw-r--r-- | xmake/toolchains/zig/xmake.lua | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/xmake/toolchains/zig/xmake.lua b/xmake/toolchains/zig/xmake.lua index 701bf2e78..b88449fb8 100644 --- a/xmake/toolchains/zig/xmake.lua +++ b/xmake/toolchains/zig/xmake.lua @@ -124,25 +124,26 @@ toolchain("zig") end -- init target - local target - if toolchain:is_plat("cross") then - -- xmake f -p cross --toolchain=zig --cross=mips64el-linux-gnuabi64 - target = toolchain:cross() - elseif toolchain:is_plat("macosx") then - --@see https://github.com/ziglang/zig/issues/14226 - target = arch .. "-macos-none" - elseif toolchain:is_plat("linux") then - if arch == "arm" then - target = "arm-linux-gnueabi" - elseif arch == "mips64" or arch == "mips64el" then - target = arch .. "-linux-gnuabi64" - else - target = arch .. "-linux-gnu" + local target = toolchain:cross() + if target == nil then + if toolchain:is_plat("cross") then + -- xmake f -p cross --toolchain=zig --cross=mips64el-linux-gnuabi64 + elseif toolchain:is_plat("macosx") then + --@see https://github.com/ziglang/zig/issues/14226 + target = arch .. "-macos-none" + elseif toolchain:is_plat("linux") then + if arch == "arm" then + target = "arm-linux-gnueabi" + elseif arch == "mips64" or arch == "mips64el" then + target = arch .. "-linux-gnuabi64" + else + target = arch .. "-linux-gnu" + end + elseif toolchain:is_plat("windows") then + target = arch .. "-windows-msvc" + elseif toolchain:is_plat("mingw") then + target = arch .. "-windows-gnu" end - elseif toolchain:is_plat("windows") then - target = arch .. "-windows-msvc" - elseif toolchain:is_plat("mingw") then - target = arch .. "-windows-gnu" end if target then toolchain:add("asflags", "-target", target) |
