summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChan Lee <[email protected]>2024-12-14 19:47:08 +0800
committerChan Lee <[email protected]>2024-12-14 19:47:08 +0800
commit37a06ba56ec27223a10fcfb53a27a0644c0ce4a9 (patch)
tree43e985c4a478035bd93a9159866064caea5cb4dd
parent4e7d3ddc9b5281c1be881e1a855b478bf20ef19b (diff)
fix incorrect zig-cc toolchain wrapper path on Windows
-rw-r--r--xmake/toolchains/zig/xmake.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/toolchains/zig/xmake.lua b/xmake/toolchains/zig/xmake.lua
index 4a92bb59d..701bf2e78 100644
--- a/xmake/toolchains/zig/xmake.lua
+++ b/xmake/toolchains/zig/xmake.lua
@@ -29,11 +29,12 @@ toolchain("zig")
-- @see https://github.com/xmake-io/xmake/issues/5610
function _setup_zigcc_wrapper(zig)
+ local script_suffix = is_host("windows") and ".cmd" or ""
for _, tool in ipairs({"cc", "c++", "ar", "ranlib", "objcopy"}) do
- local wrapper_path = path.join(os.tmpdir(), "zigcc", tool)
+ local wrapper_path = path.join(os.tmpdir(), "zigcc", tool) .. script_suffix
if not os.isfile(wrapper_path) then
if is_host("windows") then
- io.writefile(wrapper_path .. ".cmd", ("@echo off\n\"%s\" %s %%*"):format(zig, tool))
+ io.writefile(wrapper_path, ("@echo off\n\"%s\" %s %%*"):format(zig, tool))
else
io.writefile(wrapper_path, ("#!/bin/bash\nexec \"%s\" %s \"$@\""):format(zig, tool))
os.runv("chmod", {"+x", wrapper_path})