From 912ac2e2ed49f721510754fbd81b2d2ff4bc8baf Mon Sep 17 00:00:00 2001 From: torque Date: Sun, 27 Sep 2026 12:47:03 -0600 Subject: [PATCH] build: work around zig 0.17 optimize member name change --- build.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index ac78380..ed57c41 100644 --- a/build.zig +++ b/build.zig @@ -59,8 +59,9 @@ pub fn build(b: *std.Build) void { root_module.linkSystemLibrary("dbghelp", .{}); root_module.linkSystemLibrary("ole32", .{}); root_module.linkSystemLibrary("shell32", .{}); - if (optimize == .Debug) + if (isDebugBuild(optimize)) root_module.linkSystemLibrary("ucrtbased", .{}); + root_module.addCSourceFiles(.{ .root = src_root, .files = win_sources, @@ -343,6 +344,14 @@ pub fn build(b: *std.Build) void { } } +// Kludge to work around optimization enum member naming change in zig 0.17 +fn isDebugBuild(optimize: anytype) bool { + return if (comptime builtin.zig_version.major == 0 and builtin.zig_version.minor <= 16) + optimize == .Debug + else + return optimize == .debug; +} + const install_headers: []const []const u8 = &.{ "uv.h", "uv/errno.h", @@ -747,3 +756,4 @@ const test_sources: []const []const u8 = &.{ }; const std = @import("std"); +const builtin = @import("builtin");