-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
55 lines (47 loc) · 1.52 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
55
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const root_source_file = b.path("src/main.zig");
const version = std.SemanticVersion{ .major = 0, .minor = 1, .patch = 0 };
// Dependencies
const hyperloglog_dep = b.dependency("hyperloglog", .{
.target = target,
.optimize = optimize,
});
const hyperloglog_mod = hyperloglog_dep.module("hyperloglog");
const clap_dep = b.dependency("clap", .{
.target = target,
.optimize = optimize,
});
const clap_mod = clap_dep.module("clap");
// Executable
const exe_step = b.step("exe", "Run executable");
const exe = b.addExecutable(.{
.name = "loog",
.target = target,
.version = version,
.optimize = optimize,
.root_source_file = root_source_file,
});
exe.root_module.addImport("hyperloglog", hyperloglog_mod);
exe.root_module.addImport("clap", clap_mod);
b.installArtifact(exe);
const exe_run = b.addRunArtifact(exe);
if (b.args) |args| {
exe_run.addArgs(args);
}
exe_step.dependOn(&exe_run.step);
b.default_step.dependOn(exe_step);
// Formatting checks
const fmt_step = b.step("fmt", "Run formatting checks");
const fmt = b.addFmt(.{
.paths = &.{
"src/",
"build.zig",
},
.check = true,
});
fmt_step.dependOn(&fmt.step);
b.default_step.dependOn(fmt_step);
}