This repository was archived by the owner on Mar 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.zig
More file actions
55 lines (43 loc) · 1.59 KB
/
build.zig
File metadata and controls
55 lines (43 loc) · 1.59 KB
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
const std = @import("std");
pub fn build(b: *std.Build) void {
const src_dir = "src";
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const install_step = b.getInstallStep();
const fmt_step = b.step("fmt", "Format the source code");
const test_step = b.step("test", "Run the unit tests");
const doc_step = b.step("doc", "Install the docs");
install_step.dependOn(doc_step);
const release_step = b.step("release", "Format source, install docs and run unit tests");
release_step.dependOn(fmt_step);
release_step.dependOn(doc_step);
release_step.dependOn(test_step);
const fmt = b.addFmt(.{ .paths = &.{src_dir} });
fmt_step.dependOn(&fmt.step);
const src = b.path(src_dir);
const root = src.path(b, "serialize.zig");
const module = b.addModule("serialization", .{
.root_source_file = root,
.target = target,
.optimize = optimize,
});
const tests = b.addTest(.{
.name = "serialization-tests",
.root_module = module,
});
const run_tests = b.addRunArtifact(tests);
test_step.dependOn(&run_tests.step);
const doc_compile = b.addTest(.{
.name = "serialization-docs",
.root_module = module,
});
doc_compile.step.dependOn(fmt_step);
const docs = doc_compile.getEmittedDocs();
b.addNamedLazyPath("docs", docs);
const doc_install = b.addInstallDirectory(.{
.install_dir = .{ .custom = "doc" },
.source_dir = docs,
.install_subdir = &.{},
});
doc_step.dependOn(&doc_install.step);
}