| author | |
| committer | |
| log | 01fc6a05ef4b4de3d351ebbc64f35eef7f3afa7a |
| tree | bf48afc68d45939d62f1b9dfe96689450ecfe045 |
| parent | 28f6559947b7acd2ef3c983c90e1215a0d75ae15 |
7 files changed, 84 insertions(+), 0 deletions(-)
test/standalone.zig+4| ... | @@ -194,6 +194,10 @@ pub const build_cases = [_]BuildCase{ | ... | @@ -194,6 +194,10 @@ pub const build_cases = [_]BuildCase{ |
| 194 | .build_root = "test/standalone/load_dynamic_library", | 194 | .build_root = "test/standalone/load_dynamic_library", |
| 195 | .import = @import("standalone/load_dynamic_library/build.zig"), | 195 | .import = @import("standalone/load_dynamic_library/build.zig"), |
| 196 | }, | 196 | }, |
| 197 | .{ | ||
| 198 | .build_root = "test/standalone/windows_resources", | ||
| 199 | .import = @import("standalone/windows_resources/build.zig"), | ||
| 200 | }, | ||
| 197 | .{ | 201 | .{ |
| 198 | .build_root = "test/standalone/windows_spawn", | 202 | .build_root = "test/standalone/windows_spawn", |
| 199 | .import = @import("standalone/windows_spawn/build.zig"), | 203 | .import = @import("standalone/windows_spawn/build.zig"), |
test/standalone/windows_resources/build.zig created+33| ... | @@ -0,0 +1,33 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const test_step = b.step("test", "Test it"); | ||
| 5 | b.default_step = test_step; | ||
| 6 | |||
| 7 | const native_target: std.zig.CrossTarget = .{}; | ||
| 8 | const cross_target = .{ | ||
| 9 | .cpu_arch = .x86_64, | ||
| 10 | .os_tag = .windows, | ||
| 11 | .abi = .gnu, | ||
| 12 | }; | ||
| 13 | |||
| 14 | add(b, native_target, test_step); | ||
| 15 | add(b, cross_target, test_step); | ||
| 16 | } | ||
| 17 | |||
| 18 | fn add(b: *std.Build, target: std.zig.CrossTarget, test_step: *std.Build.Step) void { | ||
| 19 | const exe = b.addExecutable(.{ | ||
| 20 | .name = "zig_resource_test", | ||
| 21 | .root_source_file = .{ .path = "main.zig" }, | ||
| 22 | .target = target, | ||
| 23 | .optimize = .Debug, | ||
| 24 | }); | ||
| 25 | exe.addWin32ResourceFile(.{ | ||
| 26 | .file = .{ .path = "res/zig.rc" }, | ||
| 27 | .flags = &.{"/c65001"}, // UTF-8 code page | ||
| 28 | }); | ||
| 29 | |||
| 30 | _ = exe.getEmittedBin(); | ||
| 31 | |||
| 32 | test_step.dependOn(&exe.step); | ||
| 33 | } | ||
test/standalone/windows_resources/main.zig created+5| ... | @@ -0,0 +1,5 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn main() !void { | ||
| 4 | std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); | ||
| 5 | } | ||
test/standalone/windows_resources/res/hello.bin created+1| ... | @@ -0,0 +1 @@ | ||
| 1 | abcdefg | ||
| \ No newline at end of file | |||
test/standalone/windows_resources/res/sub/sub.rc created+1| ... | @@ -0,0 +1 @@ | ||
| 1 | 2 RCDATA hello.bin | ||
test/standalone/windows_resources/res/zig.ico created| Binary files /dev/null and b/test/standalone/windows_resources/res/zig.ico differ | |||
test/standalone/windows_resources/res/zig.rc created+40| ... | @@ -0,0 +1,40 @@ | ||
| 1 | #define ICO_ID 1 | ||
| 2 | |||
| 3 | // Nothing from windows.h is used in this .rc file, | ||
| 4 | // but it's common to include it within a .rc file | ||
| 5 | // so this makes sure that it can be found on | ||
| 6 | // all platforms. | ||
| 7 | #include "windows.h" | ||
| 8 | |||
| 9 | ICO_ID ICON "zig.ico" | ||
| 10 | |||
| 11 | 1 VERSIONINFO | ||
| 12 | FILEVERSION 1L,0,0,2 | ||
| 13 | PRODUCTVERSION 1,0,0,1 | ||
| 14 | FILEFLAGSMASK 0x3fL | ||
| 15 | FILEFLAGS 0x1L | ||
| 16 | FILEOS 0x4L | ||
| 17 | FILETYPE 0x1L | ||
| 18 | FILESUBTYPE 0x0L | ||
| 19 | BEGIN | ||
| 20 | BLOCK "StringFileInfo" | ||
| 21 | BEGIN | ||
| 22 | BLOCK "040904e4" | ||
| 23 | BEGIN | ||
| 24 | VALUE "CompanyName", "Zig" | ||
| 25 | VALUE "FileDescription", "My cool zig program" | ||
| 26 | VALUE "FileVersion", "1.0.0.1" | ||
| 27 | VALUE "InternalName", "zig-ico.exe" | ||
| 28 | VALUE "LegalCopyright", "(c) no one" | ||
| 29 | VALUE "OriginalFilename", "zig-ico.exe" | ||
| 30 | VALUE "ProductName", "Zig but with an icon" | ||
| 31 | VALUE "ProductVersion", "1.0.0.1" | ||
| 32 | END | ||
| 33 | END | ||
| 34 | BLOCK "VarFileInfo" | ||
| 35 | BEGIN | ||
| 36 | VALUE "Translation", 0x409, 1252 | ||
| 37 | END | ||
| 38 | END | ||
| 39 | |||
| 40 | #include "sub/sub.rc" | ||