Skip to content

Commit

Permalink
update to zig-0.12.0-dev.2158 and new
Browse files Browse the repository at this point in the history
  • Loading branch information
dnjulek committed Feb 6, 2024
1 parent 93beaea commit a2a4c7a
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const std = @import("std");

pub const min_zig_version = std.SemanticVersion{ .major = 0, .minor = 12, .patch = 0, .pre = "dev.2158" };

pub fn build(b: *std.Build) void {
ensureZigVersion() catch return;
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

Expand All @@ -16,12 +19,35 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

lib.addModule("vapoursynth", vapoursynth_dep.module("vapoursynth"));
lib.root_module.addImport("vapoursynth", vapoursynth_dep.module("vapoursynth"));
lib.linkLibC();

if (lib.optimize == .ReleaseFast) {
lib.strip = true;
if (lib.root_module.optimize == .ReleaseFast) {
lib.root_module.strip = true;
}

b.installArtifact(lib);
}

fn ensureZigVersion() !void {
var installed_ver = @import("builtin").zig_version;
installed_ver.build = null;

if (installed_ver.order(min_zig_version) == .lt) {
std.log.err("\n" ++
\\---------------------------------------------------------------------------
\\
\\Installed Zig compiler version is too old.
\\
\\Min. required version: {any}
\\Installed version: {any}
\\
\\Please install newer version and try again.
\\Latest version can be found here: https://ziglang.org/download/
\\
\\---------------------------------------------------------------------------
\\
, .{ min_zig_version, installed_ver });
return error.ZigIsTooOld;
}
}

0 comments on commit a2a4c7a

Please sign in to comment.