-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
46 lines (36 loc) · 1.24 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.addModule("kewpie", .{
.target = target,
.optimize = optimize,
.root_source_file = b.path("lib/root.zig"),
});
// Tests
const test_step = b.step("test", "Run the tests");
const tests = b.addTest(.{
.optimize = optimize,
.target = target,
.root_source_file = b.path("test/root.zig"),
});
tests.root_module.addImport("kewpie", mod);
const run_tests = b.addRunArtifact(tests);
test_step.dependOn(&run_tests.step);
addDocsStep(b, .{ .target = target, .optimize = optimize });
}
fn addDocsStep(b: *std.Build, options: anytype) void {
const docs_step = b.step("docs", "Emit docs");
const lib = b.addStaticLibrary(.{
.name = "mac_address",
.root_source_file = b.path("lib/root.zig"),
.target = options.target,
.optimize = options.optimize,
});
const docs_install = b.addInstallDirectory(.{
.install_dir = .prefix,
.install_subdir = "docs",
.source_dir = lib.getEmittedDocs(),
});
docs_step.dependOn(&docs_install.step);
}