Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
update build
Browse files Browse the repository at this point in the history
  • Loading branch information
dnjulek committed Jan 14, 2024
1 parent 5d6e8e7 commit 081d804
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ ssim = core.ssimulacra2.SSIMULACRA2(ref, dist)
```

## Building
Zig ver >= 0.12.0-dev.1594

``zig build -Doptimize=ReleaseFast``
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;
}
}
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
.paths = .{""},
.dependencies = .{
.vapoursynth = .{
.url = "https://github.com/dnjulek/vapoursynth-zig/archive/11809b4e8047c15fa5de10a3c3ae15d1546630ea.tar.gz",
.hash = "12208a2b305e3a3cfb509f56320d839d1a7706946ca2baa099088361a71e899461d6",
.url = "https://github.com/dnjulek/vapoursynth-zig/archive/8f00a018ed680886283ee0b5070ae02f01d468a0.tar.gz",
.hash = "12207d0f77de3ea85b5c8b1f49296605834f915338b0a93da180639760011458c22c",
},
},
}

0 comments on commit 081d804

Please sign in to comment.