Skip to content

Commit

Permalink
fix incorrect zig-cc toolchain wrapper path on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Doekin committed Dec 14, 2024
1 parent 4e7d3dd commit 37a06ba
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 37a06ba

Please sign in to comment.