-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
37 lines (28 loc) · 1.18 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
const std = @import("std");
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("tribles-zig", "src/main.zig");
lib.setBuildMode(mode);
lib.install();
var main_tests = b.addTest("src/main.zig");
main_tests.setBuildMode(mode);
var bench_exe = b.addExecutable("bench", "src/bench.zig");
bench_exe.setTarget(target);
bench_exe.setBuildMode(mode);
bench_exe.linkLibC();
if(target.isLinux()) {
bench_exe.addCSourceFile("coz/ccoz.c", &[_][]const u8 {});
bench_exe.addIncludePath("coz");
bench_exe.addIncludePath("/usr/include");
bench_exe.addLibraryPath("/usr/lib/coz-profiler");
bench_exe.linkSystemLibrary("coz");
}
bench_exe.install();
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);
const bench_step = b.step("bench", "Create library benchmarks");
bench_step.dependOn(b.getInstallStep());
}