-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
45 lines (38 loc) · 1.28 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
const std = @import("std");
const zigpool_pkg = std.build.Pkg {
.name = "zigpool",
.source = std.build.FileSource {
.path = "src/zigpool.zig",
},
};
pub fn build(b: *std.build.Builder) void {
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const lib = b.addStaticLibrary("zigpool", "src/zigpool.zig");
lib.setBuildMode(mode);
lib.install();
const test_step = b.step("test", "Run library tests");
inline for (.{
"src/zigpool.zig",
"src/mpmc.zig",
"src/mpmc_adapter.zig",
"src/int_utils.zig",
}) |test_file| {
const t = b.addTest(test_file);
t.setBuildMode(mode);
test_step.dependOn(&t.step);
}
const example_step = b.step("examples", "Build examples");
inline for (.{
"simple",
}) |example_name| {
const example = b.addExecutable(example_name, "examples/" ++ example_name ++ ".zig");
example.addPackage(zigpool_pkg);
example.setBuildMode(mode);
example.setTarget(target);
example.install();
example_step.dependOn(&example.step);
}
}