-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
71 lines (62 loc) · 2.52 KB
/
Copy pathbuild.zig
File metadata and controls
71 lines (62 loc) · 2.52 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const test_filters = b.option([]const []const u8, "test-filter", "Skip tests that do not match any filter") orelse &[0][]const u8{};
const lib_mod = b.addModule("praxis", .{
.root_source_file = b.path("src/praxis.zig"),
.target = target,
.optimize = optimize,
});
const lib = b.addLibrary(.{
.linkage = .static,
.name = "praxis",
.root_module = lib_mod,
});
lib.root_module.addAnonymousImport("larger_dict", .{
.root_source_file = b.path("./test/larger_dict.txt"),
});
b.installArtifact(lib);
// Tell tests where the data repo folder lives
const options = b.addOptions();
options.addOptionPath("repo", b.path("data/repo/"));
options.addOptionPath("small_dict", b.path("test/small_dict.txt"));
const test_mod = b.addModule("test", .{
.root_source_file = b.path("src/praxis.zig"),
.target = target,
.optimize = optimize,
});
const lib_unit_tests = b.addTest(.{
.root_module = test_mod,
.filters = test_filters,
});
lib_unit_tests.root_module.addOptions("options", options);
lib_unit_tests.root_module.addAnonymousImport("byz_parsing", .{
.root_source_file = b.path("test/byz-parsing.txt"),
});
lib_unit_tests.root_module.addAnonymousImport("other_parsing", .{
.root_source_file = b.path("test/other-parsing.txt"),
});
lib_unit_tests.root_module.addAnonymousImport("ccat_parsing", .{
.root_source_file = b.path("test/ccat-test.txt"),
});
lib_unit_tests.root_module.addAnonymousImport("sbl_parsing", .{
.root_source_file = b.path("test/sbl-parsing.txt"),
});
lib_unit_tests.root_module.addAnonymousImport("small_dict", .{
.root_source_file = b.path("test/small_dict.txt"),
});
lib_unit_tests.root_module.addAnonymousImport("larger_dict", .{
.root_source_file = b.path("test/larger_dict.txt"),
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const test_step = b.step("test", "Run unit tests");
const install_docs = b.addInstallDirectory(.{
.source_dir = lib.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs",
});
const docs_step = b.step("docs", "Generate docs into zig-out/docs");
docs_step.dependOn(&install_docs.step);
test_step.dependOn(&run_lib_unit_tests.step);
}