mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
zig: add a zig version check
This commit is contained in:
21
build.zig
21
build.zig
@@ -1,10 +1,31 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
const jsruntime_path = "vendor/jsruntime-lib/";
|
const jsruntime_path = "vendor/jsruntime-lib/";
|
||||||
const jsruntime = @import("vendor/jsruntime-lib/build.zig");
|
const jsruntime = @import("vendor/jsruntime-lib/build.zig");
|
||||||
const jsruntime_pkgs = jsruntime.packages(jsruntime_path);
|
const jsruntime_pkgs = jsruntime.packages(jsruntime_path);
|
||||||
|
|
||||||
|
const zig_version = builtin.zig_version;
|
||||||
|
|
||||||
|
/// Do not rename this constant. It is scanned by some scripts to determine
|
||||||
|
/// which zig version to install.
|
||||||
|
const recommended_zig_version = jsruntime.recommended_zig_version;
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) !void {
|
pub fn build(b: *std.build.Builder) !void {
|
||||||
|
switch (comptime zig_version.order(std.SemanticVersion.parse(recommended_zig_version) catch unreachable)) {
|
||||||
|
.eq => {},
|
||||||
|
.lt => {
|
||||||
|
@compileError("The minimum version of Zig required to compile is '" ++ recommended_zig_version ++ "', found '" ++ builtin.zig_version_string ++ "'.");
|
||||||
|
},
|
||||||
|
.gt => {
|
||||||
|
std.debug.print(
|
||||||
|
"WARNING: Recommended Zig version '{s}', but found '{s}', build may fail...\n\n",
|
||||||
|
.{ recommended_zig_version, builtin.zig_version_string },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const mode = b.standardOptimizeOption(.{});
|
const mode = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user