From 09f4e2d9d138d313b93ab10cbac1fee2a8f4e9f0 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sat, 28 Jun 2025 19:43:16 -0700 Subject: resinator: Fix include directory detection when cross-compiling from certain host archs Previously, resinator would use the host arch as the target arch when looking for windows-gnu include directories. However, Zig only thinks it can provide a libc for targets specified in the `std.zig.target.available_libcs` array, which only includes a few for windows-gnu. Therefore, when cross-compiling from a host architecture that doesn't have a windows-gnu target in the available_libcs list, resinator would fail to detect the MinGW include directories. Now, the custom option `/:target` is passed to `zig rc` which is intended for the COFF object file target, but can be re-used for the include directory target as well. For the include directory target, resinator will convert the MachineType to the relevant arch, or fail if there is no equivalent arch/no support for detecting the includes for the MachineType (currently 64-bit Itanium and EBC). Fixes the `windows_resources` standalone test failing when the host is, for example, `riscv64-linux`. --- src/Compilation.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 4136b21f61..fb9ee617f5 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -6058,6 +6058,8 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 self_exe_path, "rc", "--zig-integration", + "/:target", + @tagName(comp.getTarget().cpu.arch), "/:no-preprocess", "/x", // ignore INCLUDE environment variable "/c65001", // UTF-8 codepage @@ -6115,6 +6117,8 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 self_exe_path, "rc", "--zig-integration", + "/:target", + @tagName(comp.getTarget().cpu.arch), "/:depfile", out_dep_path, "/:depfile-fmt", -- cgit v1.2.3