From b5cd2e7a33871d2042fc4ab3078ac34c2a535ad5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 15 Jan 2024 14:29:55 -0800 Subject: [PATCH] build: set os_version_min on default target so tests work --- build.zig | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 222b8ed37..f142ebabf 100644 --- a/build.zig +++ b/build.zig @@ -37,7 +37,17 @@ const app_version = std.SemanticVersion{ .major = 0, .minor = 1, .patch = 0 }; pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); - const target = b.standardTargetOptions(.{}); + const target = target: { + var result = b.standardTargetOptions(.{}); + + // If we have no minimum OS version, we set the default based on + // our tag. Not all tags have a minimum so this may be null. + if (result.query.os_version_min == null) { + result.query.os_version_min = osVersionMin(result.result.os.tag); + } + + break :target result; + }; const wasm_target: WasmTarget = .browser; @@ -655,7 +665,7 @@ fn osVersionMin(tag: std.Target.Os.Tag) ?std.Target.Query.OsVersion { // This should never happen currently. If we add a new target then // we should add a new case here. - else => @panic("unhandled os version min os tag"), + else => null, }; }