build: work around zig 0.17 optimize member name change
This commit is contained in:
12
build.zig
12
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");
|
||||
|
||||
Reference in New Issue
Block a user