-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
67 lines (59 loc) · 2.15 KB
/
build.zig
File metadata and controls
67 lines (59 loc) · 2.15 KB
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
const std = @import("std");
const microzig = @import("microzig");
const MicroBuild = microzig.MicroBuild(.{
.rp2xxx = true,
});
pub fn build(b: *std.Build) void {
const mz_dep = b.dependency("microzig", .{});
const mb = MicroBuild.init(b, mz_dep) orelse return;
const blinky = mb.add_firmware(.{
.name = "blinky",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico2_arm,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/blinky/main.zig"),
});
const synth_module = b.createModule(.{
.root_source_file = b.path("src/synth/synth.zig"),
});
const synth = mb.add_firmware(.{
.name = "synth",
.target = mb.ports.rp2xxx.boards.raspberrypi.pico2_arm,
.optimize = .ReleaseSmall,
.root_source_file = b.path("src/pico-synth/main.zig"),
.imports = &.{
.{ .name = "synth", .module = synth_module },
},
});
mb.install_firmware(blinky, .{});
mb.install_firmware(synth, .{});
// Native macOS build for testing DSP code without hardware
const raylib_dep = b.dependency("raylib_zig", .{
.target = b.resolveTargetQuery(.{}),
.optimize = .Debug,
});
const native = b.addExecutable(.{
.name = "synth-native",
.root_module = b.createModule(.{
.root_source_file = b.path("src/native/main.zig"),
.target = b.resolveTargetQuery(.{}),
.optimize = .Debug,
.imports = &.{
.{ .name = "synth", .module = synth_module },
.{ .name = "raylib", .module = raylib_dep.module("raylib") },
},
}),
});
native.linkLibrary(raylib_dep.artifact("raylib"));
b.installArtifact(native);
// Unit tests for synth DSP modules
const synth_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/synth/synth.zig"),
.target = b.resolveTargetQuery(.{}),
.optimize = .Debug,
}),
});
const run_tests = b.addRunArtifact(synth_tests);
const test_step = b.step("test", "Run synth unit tests");
test_step.dependOn(&run_tests.step);
}