Skip to content

Commit

Permalink
Merge pull request #5967 from Doekin/zigcc-windows
Browse files Browse the repository at this point in the history
Fix incorrect Zig-CC toolchain wrapper path on Windows
  • Loading branch information
waruqi authored Dec 14, 2024
2 parents 4e7d3dd + 37a06ba commit 9efe9e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xmake/toolchains/zig/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 9efe9e3

Please sign in to comment.