Build system: Allow specifying Win32 resource include paths using LazyPath
Adds an `include_paths` field to RcSourceFile that takes a slice of LazyPaths. The paths are resolved and subsequently appended to the -rcflags as `/I <resolved path>`. This fixes an accidental regression from https://github.com/ziglang/zig/pull/19174. Before that PR, all Win32 resource compilation would inherit the CC flags (via `addCCArgs`), which included things like include directories. After that PR, though, that is no longer the case. However, this commit intentionally does not restore the previous behavior (inheriting the C include paths). Instead, each .rc file will need to have its include paths specified directly and the include paths only apply to one particular resource script. This allows more fine-grained control and has less potentially surprising behavior (at the cost of some convenience). Closes #19605
This commit is contained in:
committed by
Andrew Kelley
parent
f2110b0c0d
commit
ddde99bdfa
@@ -1277,7 +1277,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
.win32_resource_file => |rc_source_file| l: {
|
||||
if (!my_responsibility) break :l;
|
||||
|
||||
if (rc_source_file.flags.len == 0) {
|
||||
if (rc_source_file.flags.len == 0 and rc_source_file.include_paths.len == 0) {
|
||||
if (prev_has_rcflags) {
|
||||
try zig_args.append("-rcflags");
|
||||
try zig_args.append("--");
|
||||
@@ -1288,6 +1288,10 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
for (rc_source_file.flags) |arg| {
|
||||
try zig_args.append(arg);
|
||||
}
|
||||
for (rc_source_file.include_paths) |include_path| {
|
||||
try zig_args.append("/I");
|
||||
try zig_args.append(include_path.getPath2(module.owner, step));
|
||||
}
|
||||
try zig_args.append("--");
|
||||
prev_has_rcflags = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user