-
Notifications
You must be signed in to change notification settings - Fork 102
/
build.zig
57 lines (48 loc) · 1.96 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
56
57
const std = @import("std");
const Build = std.Build;
const MicroZig = @import("build/definitions");
const example_dep_names: []const []const u8 = &.{
"examples/nordic/nrf5x",
"examples/nxp/lpc",
"examples/microchip/atsam",
"examples/microchip/avr",
"examples/gigadevice/gd32",
"examples/stmicro/stm32",
//"examples/espressif/esp",
"examples/raspberrypi/rp2xxx",
};
const ports = .{
.{ "port/nordic/nrf5x", @import("port/nordic/nrf5x") },
.{ "port/nxp/lpc", @import("port/nxp/lpc") },
.{ "port/microchip/atsam", @import("port/microchip/atsam") },
.{ "port/microchip/avr", @import("port/microchip/avr") },
.{ "port/gigadevice/gd32", @import("port/gigadevice/gd32") },
.{ "port/stmicro/stm32", @import("port/stmicro/stm32") },
.{ "port/espressif/esp", @import("port/espressif/esp") },
.{ "port/raspberrypi/rp2xxx", @import("port/raspberrypi/rp2xxx") },
};
pub fn build(b: *Build) void {
const optimize = b.standardOptimizeOption(.{});
// Build all examples
for (example_dep_names) |example_dep_name| {
const example_dep = b.dependency(example_dep_name, .{
.optimize = optimize,
});
const example_dep_install_step = example_dep.builder.getInstallStep();
b.getInstallStep().dependOn(example_dep_install_step);
}
const boxzer_dep = b.dependency("boxzer", .{});
const boxzer_exe = boxzer_dep.artifact("boxzer");
const boxzer_run = b.addRunArtifact(boxzer_exe);
if (b.args) |args|
boxzer_run.addArgs(args);
const package_step = b.step("package", "Package monorepo using boxzer");
package_step.dependOn(&boxzer_run.step);
const test_ports_step = b.step("run-port-tests", "Run all platform agnostic tests for Ports");
inline for (ports) |port| {
const port_dep = b.dependency(port[0], .{});
if (port_dep.builder.top_level_steps.get("test")) |test_step| {
test_ports_step.dependOn(&test_step.step);
}
}
}