-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
81 lines (65 loc) · 2.2 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const root_source_file = b.path("src/Uuid.zig");
const version = std.SemanticVersion{ .major = 1, .minor = 2, .patch = 3 };
// Module
_ = b.addModule("Uuid", .{ .root_source_file = root_source_file });
// Library
const lib_step = b.step("lib", "Install library");
const lib = b.addStaticLibrary(.{
.name = "Uuid",
.target = target,
.version = version,
.optimize = optimize,
.root_source_file = root_source_file,
});
const lib_install = b.addInstallArtifact(lib, .{});
lib_step.dependOn(&lib_install.step);
b.default_step.dependOn(lib_step);
// Documentation
const docs_step = b.step("doc", "Emit documentation");
const docs_install = b.addInstallDirectory(.{
.install_dir = .prefix,
.install_subdir = "doc",
.source_dir = lib.getEmittedDocs(),
});
docs_step.dependOn(&docs_install.step);
b.default_step.dependOn(docs_step);
// Benchmark suite
const benchs_step = b.step("bench", "Run benchmark suite");
const benchs = b.addExecutable(.{
.name = "bench",
.target = target,
.optimize = .ReleaseFast,
.root_source_file = b.path("src/bench.zig"),
});
const benchs_run = b.addRunArtifact(benchs);
if (b.args) |args| {
benchs_run.addArgs(args);
}
benchs_step.dependOn(&benchs_run.step);
b.default_step.dependOn(benchs_step);
// Test suite
const tests_step = b.step("test", "Run test suite");
const tests = b.addTest(.{
.target = target,
.version = version,
.root_source_file = root_source_file,
});
const tests_run = b.addRunArtifact(tests);
tests_step.dependOn(&tests_run.step);
b.default_step.dependOn(tests_step);
// Formatting checks
const fmt_step = b.step("fmt", "Run formatting checks");
const fmt = b.addFmt(.{
.paths = &.{
"src/",
"build.zig",
},
.check = true,
});
fmt_step.dependOn(&fmt.step);
b.default_step.dependOn(fmt_step);
}