Skip to content

Commit

Permalink
improve cross for zig
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Jan 13, 2025
1 parent aa5cdd8 commit e553279
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions xmake/toolchains/zig/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e553279

Please sign in to comment.