-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
54 lines (46 loc) · 1.73 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
46
47
48
49
50
51
52
53
54
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const poseidon_mod = b.addModule("poseidon", .{
.root_source_file = b.path("src/poseidon.zig"),
.target = target,
.optimize = optimize,
});
const test_exe = b.addTest(.{
.root_source_file = b.path("tests/test.zig"),
.target = target,
.optimize = optimize,
});
test_exe.root_module.addImport("poseidon", poseidon_mod);
const test_step = b.step("test", "Tests the library");
const run_test = b.addRunArtifact(test_exe);
test_step.dependOn(&run_test.step);
const fuzz_exe = b.addExecutable(.{
.name = "fuzz",
.root_source_file = b.path("tests/fuzz.zig"),
.target = target,
.optimize = optimize,
});
fuzz_exe.linkLibC();
fuzz_exe.root_module.addImport("poseidon", poseidon_mod);
fuzz_exe.root_module.omit_frame_pointer = false;
b.installArtifact(fuzz_exe);
const fuzz_step = b.step("fuzz", "Fuzzes the library");
const run_fuzz = b.addRunArtifact(fuzz_exe);
if (b.args) |args| run_fuzz.addArgs(args);
fuzz_step.dependOn(&run_fuzz.step);
const bench_exe = b.addExecutable(.{
.name = "bench",
.root_source_file = b.path("tests/bench.zig"),
.target = target,
.optimize = optimize,
});
bench_exe.linkLibC();
bench_exe.root_module.addImport("poseidon", poseidon_mod);
b.installArtifact(bench_exe);
const bench_step = b.step("bench", "Benches the library");
const run_bench = b.addRunArtifact(bench_exe);
if (b.args) |args| run_bench.addArgs(args);
bench_step.dependOn(&run_bench.step);
}