Ryan Liptak ea9d817a90 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
2024-05-02 22:08:00 -07:00

45 lines
1.1 KiB
Plaintext

// This include file is generated via build.zig, and it #defines GENERATED_DEFINE
#include "generated.h"
FOO RCDATA { GENERATED_DEFINE }
#define ICO_ID 1
// Nothing from windows.h is used in this .rc file,
// but it's common to include it within a .rc file
// so this makes sure that it can be found on
// all platforms.
#include "windows.h"
ICO_ID ICON "zig.ico"
1 VERSIONINFO
FILEVERSION 1L,0,0,2
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x1L
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "Zig"
VALUE "FileDescription", "My cool zig program"
VALUE "FileVersion", "1.0.0.1"
VALUE "InternalName", "zig-ico.exe"
VALUE "LegalCopyright", "(c) no one"
VALUE "OriginalFilename", "zig-ico.exe"
VALUE "ProductName", "Zig but with an icon"
VALUE "ProductVersion", "1.0.0.1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
#include "sub/sub.rc"