-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-all.zig
73 lines (67 loc) · 2.1 KB
/
build-all.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const std = @import("std");
const pkgs = @import("deps.zig").pkgs;
const builtin = @import("builtin");
const Mode = std.builtin.Mode;
const CrossTarget = std.zig.CrossTarget;
const Target = std.Target;
const BuildTarget = struct {
name: []const u8,
cross_target: CrossTarget,
mode: Mode,
};
pub fn build(b: *std.build.Builder) void {
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const targets = [_]BuildTarget{
.{
.name = "kernel-installer-i386-windows",
.cross_target = .{
.cpu_arch = Target.Cpu.Arch.i386,
.os_tag = Target.Os.Tag.windows,
},
.mode = Mode.ReleaseFast
},
.{
.name = "kernel-installer-x86_64-windows",
.cross_target = .{
.cpu_arch = Target.Cpu.Arch.x86_64,
.os_tag = Target.Os.Tag.windows,
},
.mode = Mode.ReleaseFast
},
.{
.name = "kernel-installer-i386-linux",
.cross_target = .{
.cpu_arch = Target.Cpu.Arch.i386,
.os_tag = Target.Os.Tag.linux,
},
.mode = Mode.ReleaseFast
},
.{
.name = "kernel-installer-x86_64-linux",
.cross_target = .{
.cpu_arch = Target.Cpu.Arch.x86_64,
.os_tag = Target.Os.Tag.linux,
},
.mode = Mode.ReleaseFast
},
.{
.name = "kernel-installer-x86_64-macos",
.cross_target = .{
.cpu_arch = Target.Cpu.Arch.x86_64,
.os_tag = Target.Os.Tag.macos,
},
.mode = Mode.ReleaseFast
},
};
for (targets) |target| {
const exe = b.addExecutable(target.name, "src/main.zig");
exe.strip = true;
exe.single_threaded = true;
exe.setTarget(target.cross_target);
exe.setBuildMode(target.mode);
exe.linkLibC();
pkgs.addAllTo(exe);
exe.install();
}
}