This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.zig
46 lines (42 loc) · 1.49 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
const std = @import("std");
const Builder = std.build.Builder;
pub fn build(b: *Builder) void {
const mod = b.addModule("art", .{
.source_file = .{ .path = "src/art.zig" },
});
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const exe = b.addExecutable(.{
.name = "art",
.root_source_file = .{ .path = "src/main.zig" },
.optimize = optimize,
.target = target,
});
exe.linkLibC();
exe.addModule("art", mod);
const install = b.addInstallArtifact(exe, .{});
b.getInstallStep().dependOn(&install.step);
var tests = b.addTest(.{
.root_source_file = .{ .path = "src/test_art.zig" },
.optimize = optimize,
.target = target,
});
tests.linkLibC();
tests.addModule("art", mod);
tests.filter = b.option([]const u8, "test-filter", "test filter");
const test_step = b.step("test", "Run library tests");
const main_tests_run = b.addRunArtifact(tests);
main_tests_run.has_side_effects = true;
test_step.dependOn(&main_tests_run.step);
const bench = b.addExecutable(.{
.name = "bench",
.root_source_file = .{ .path = "src/bench2.zig" },
.optimize = .ReleaseFast,
.target = target,
});
bench.linkLibC();
bench.addModule("art", mod);
const bench_run = b.addRunArtifact(bench);
const bench_step = b.step("bench", "Bench against std.StringHashMap()");
bench_step.dependOn(&bench_run.step);
}