From b01f145c1e6aff3abfaaf42a9cd8ce493c786c44 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 6 Jan 2023 23:22:23 +0800 Subject: improve zig toolchain --- xmake/toolchains/zig/xmake.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'xmake/toolchains/zig/xmake.lua') diff --git a/xmake/toolchains/zig/xmake.lua b/xmake/toolchains/zig/xmake.lua index ebfa4a00c..2f97b0340 100644 --- a/xmake/toolchains/zig/xmake.lua +++ b/xmake/toolchains/zig/xmake.lua @@ -55,10 +55,14 @@ toolchain("zig") -- set toolset -- we patch target to `zig cc` to fix has_flags. see https://github.com/xmake-io/xmake/issues/955#issuecomment-766929692 local zig = toolchain:config("zig") or "zig" - toolchain:set("toolset", "cc", zig .. " cc") - toolchain:set("toolset", "cxx", zig .. " c++") - toolchain:set("toolset", "ld", zig .. " c++") - toolchain:set("toolset", "sh", zig .. " c++") + if toolchain:config("zigcc") ~= false then + -- we can use `set_toolchains("zig", {zigcc = false})` to disable zigcc + -- @see https://github.com/xmake-io/xmake/issues/3251 + toolchain:set("toolset", "cc", zig .. " cc") + toolchain:set("toolset", "cxx", zig .. " c++") + toolchain:set("toolset", "ld", zig .. " c++") + toolchain:set("toolset", "sh", zig .. " c++") + end toolchain:set("toolset", "ar", "$(env ZC)", zig) toolchain:set("toolset", "zc", "$(env ZC)", zig) toolchain:set("toolset", "zcar", "$(env ZC)", zig) @@ -92,7 +96,8 @@ toolchain("zig") -- xmake f -p cross --toolchain=zig --cross=mips64el-linux-gnuabi64 target = toolchain:cross() elseif toolchain:is_plat("macosx") then - target = arch .. "-macos-gnu" + -- zig 0.10 will raise `unable to find or provide libc for target 'x86_64-macos.11.7.1...13-gnu'` + --target = arch .. "-macos-gnu" elseif toolchain:is_plat("linux") then if arch == "arm" then target = "arm-linux-gnueabi" -- cgit v1.3.1