build: set os_version_min on default target so tests work

This commit is contained in:
Mitchell Hashimoto
2024-01-15 14:29:55 -08:00
parent 67ea0d81c7
commit b5cd2e7a33

View File

@ -37,7 +37,17 @@ const app_version = std.SemanticVersion{ .major = 0, .minor = 1, .patch = 0 };
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{}); 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; 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 // This should never happen currently. If we add a new target then
// we should add a new case here. // we should add a new case here.
else => @panic("unhandled os version min os tag"), else => null,
}; };
} }