Skip to content

Commit

Permalink
build: add Zig version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Jul 12, 2024
1 parent 0be8bce commit ed5f3f9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
const std = @import("std");
const builtin = @import("builtin");

const minimum_zig_version = std.SemanticVersion.parse("0.12.0") catch unreachable;

pub fn build(b: *std.Build) void {
if (comptime (builtin.zig_version.order(minimum_zig_version) == .lt)) {
@compileError(std.fmt.comptimePrint(
\\Your Zig version does not meet the minimum build requirement:
\\ required Zig version: {[minimum_zig_version]}
\\ actual Zig version: {[current_version]}
\\
, .{
.current_version = builtin.zig_version,
.minimum_zig_version = minimum_zig_version,
}));
}

const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

Expand Down

0 comments on commit ed5f3f9

Please sign in to comment.