forked from andrewrk/poop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
42 lines (35 loc) · 1.33 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "poop",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.strip = b.option(bool, "strip", "strip the binary") orelse switch (optimize) {
.Debug, .ReleaseSafe => false,
.ReleaseFast, .ReleaseSmall => true,
};
b.installArtifact(exe);
const release = b.step("release", "make an upstream binary release");
const release_targets = &[_][]const u8{
"aarch64-linux", "x86_64-linux", "x86-linux", "riscv64-linux",
};
for (release_targets) |target_string| {
const rel_exe = b.addExecutable(.{
.name = "poop",
.root_source_file = .{ .path = "src/main.zig" },
.target = std.zig.CrossTarget.parse(.{
.arch_os_abi = target_string,
}) catch unreachable,
.optimize = .ReleaseSafe,
});
rel_exe.strip = true;
const install = b.addInstallArtifact(rel_exe);
install.dest_dir = .prefix;
install.dest_sub_path = b.fmt("{s}-{s}", .{ target_string, rel_exe.name });
release.dependOn(&install.step);
}
}