-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
48 lines (36 loc) · 1.43 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const std = @import("std");
const set_version = @import("set_version");
pub fn build(b: *std.Build) void {
set_version.VersionSetterStep.addStep(b);
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addSharedLibrary(.{
.name = "manipmv",
.root_source_file = b.path("src/manipmv.zig"),
.target = target,
.optimize = optimize,
});
const vapoursynth_dep = b.dependency("vapoursynth", .{
.target = target,
.optimize = optimize,
});
// Pass the version in build.zig.zon to the code
const options = b.addOptions();
const current_version: []const u8 = set_version.currentVersion(b.allocator) catch unreachable;
const version = b.option([]const u8, "version", "Semantic version string") orelse current_version;
options.addOption([]const u8, "version", version);
lib.root_module.addOptions("config", options);
lib.root_module.addImport("vapoursynth", vapoursynth_dep.module("vapoursynth"));
lib.linkLibC();
if (lib.root_module.optimize == .ReleaseFast) {
lib.root_module.strip = true;
}
b.installArtifact(lib);
// *** Tests ***
const unit_tests = b.addTest(.{
.root_module = lib.root_module,
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}