-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
63 lines (55 loc) · 2.13 KB
/
build.zig
File metadata and controls
63 lines (55 loc) · 2.13 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const gengen = b.addExecutable(.{
.name = "gengen",
.root_module = b.createModule(.{
.root_source_file = b.path("src/tools/gengen.zig"),
.target = b.graph.host,
}),
});
const gengen_step = b.addRunArtifact(gengen);
const gengen_output = gengen_step.addOutputFileArg("gen.zig");
const update_gen = b.addUpdateSourceFiles();
update_gen.addCopyFileToSource(gengen_output, "src/gen.zig");
const format_gen = b.addFmt(.{
.check = false,
.paths = &.{"src/gen.zig"},
});
format_gen.step.dependOn(&update_gen.step);
const update_gen_step = b.step("gengen", "generate src/gen.zig");
update_gen_step.dependOn(&update_gen.step);
update_gen_step.dependOn(&format_gen.step);
const mod = b.addModule("h2z", .{
.root_source_file = b.path("src/h2z.zig"),
.target = target,
});
const mod_tests = b.addTest(.{
.root_module = mod,
});
const run_mod_tests = b.addRunArtifact(mod_tests);
const spec_client_step = b.step("h2specc", "build and install the h2specd client executable");
const spec_client_exe = b.addExecutable(.{
.name = "h2specc",
.root_module = b.createModule(.{
.root_source_file = b.path("src/h2specc.zig"),
.target = target,
.optimize = optimize,
}),
});
spec_client_step.dependOn(&b.addInstallArtifact(spec_client_exe, .{}).step);
const run_spec_client_tests = b.addSystemCommand(&.{
"h2specd",
"--verbose",
"--timeout",
"1",
"--exec",
});
run_spec_client_tests.addFileArg(spec_client_exe.getEmittedBin());
run_spec_client_tests.step.dependOn(&spec_client_exe.step);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
const h2spec_test_step = b.step("test:h2spec", "build and run the h2specd client for testing");
h2spec_test_step.dependOn(&run_spec_client_tests.step);
}