-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
50 lines (43 loc) · 1.42 KB
/
build.zig
File metadata and controls
50 lines (43 loc) · 1.42 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
const std = @import("std");
const target: std.Target.Query =
.{ .cpu_arch = .x86_64, .cpu_model = .baseline, .os_tag = .linux, .abi = .musl };
const benchmarks = [_]struct {
name: []const u8,
source_file: []const u8,
}{ .{
.name = "ezqueue-bench-read",
.source_file = "bin/bench-read.zig",
}, .{
.name = "ezqueue-bench-ops",
.source_file = "bin/bench-ops.zig",
} };
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
for (benchmarks) |bench| {
const bench_exe = b.addExecutable(.{
.name = bench.name,
.root_source_file = b.path(bench.source_file),
.optimize = optimize,
.target = b.resolveTargetQuery(target),
});
bench_exe.root_module.addAnonymousImport(
"libezqueue",
.{
.root_source_file = b.path("lib/root.zig"),
},
);
bench_exe.linkLibC();
b.installArtifact(bench_exe);
}
const tests = b.addTest(.{
.root_source_file = b.path("lib/root.zig"),
.target = b.resolveTargetQuery(target),
.optimize = optimize,
.test_runner = .{ .path = b.path("test_runner.zig"), .mode = .simple },
});
tests.linkLibC();
const test_cmd = b.addRunArtifact(tests);
test_cmd.has_side_effects = true;
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&test_cmd.step);
}