Add required_zig_version back

This commit is contained in:
Krzysztof Wolicki 2023-11-29 18:17:18 +01:00
parent 7a693efc80
commit 466b044bba

View file

@ -5,6 +5,8 @@ const CompileStep = std.Build.Step.Compile;
/// set this to true to link libc /// set this to true to link libc
const should_link_libc = false; const should_link_libc = false;
const required_zig_version = std.SemanticVersion.parse("0.12.0-dev.1754+2a3226453") catch unreachable;
fn linkObject(b: *Build, obj: *CompileStep) void { fn linkObject(b: *Build, obj: *CompileStep) void {
if (should_link_libc) obj.linkLibC(); if (should_link_libc) obj.linkLibC();
_ = b; _ = b;
@ -13,6 +15,11 @@ fn linkObject(b: *Build, obj: *CompileStep) void {
} }
pub fn build(b: *Build) void { pub fn build(b: *Build) void {
if (comptime @import("builtin").zig_version.order(required_zig_version) == .lt) {
std.debug.print("Warning: Your version of Zig too old. You will need to download a newer build\n", .{});
std.os.exit(1);
}
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const mode = b.standardOptimizeOption(.{}); const mode = b.standardOptimizeOption(.{});