-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
30 lines (25 loc) · 980 Bytes
/
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
const std = @import("std");
const Builder = std.build.Builder;
const pkgs = @import("deps.zig").pkgs;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const progs = .{
.server = b.addExecutable("astrolabe", "src/main.zig"),
.adduser = b.addExecutable("astro-adduser", "src/adduser.zig"),
.publish = b.addExecutable("astro-publish", "src/publish.zig"),
};
inline for (std.meta.fields(@TypeOf(progs))) |field| {
@field(progs, field.name).setTarget(target);
@field(progs, field.name).setBuildMode(mode);
@field(progs, field.name).install();
pkgs.addAllTo(@field(progs, field.name));
}
const run_cmd = progs.server.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the server");
run_step.dependOn(&run_cmd.step);
}