51 lines
2.0 KiB
Zig
51 lines
2.0 KiB
Zig
//! The ps2-bus driver as a binary package (docs/build-packages-plan.md):
|
|
//! this file names the binary and EXACTLY the modules its source imports —
|
|
//! build-support resolves each name from the domains this zon declares.
|
|
|
|
const std = @import("std");
|
|
const build_support = @import("build-support");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const ps2_bus_exe = build_support.userBinary(b, .{
|
|
.name = "ps2-bus",
|
|
.root_source_file = b.path("ps2-bus.zig"),
|
|
.imports = &.{ "acpi-ids", "channel", "driver", "ipc", "logging", "memory", "process", "service", "time" },
|
|
});
|
|
b.installArtifact(ps2_bus_exe);
|
|
|
|
const ps2_keyboard_exe = build_support.userBinary(b, .{
|
|
.name = "ps2-keyboard",
|
|
.root_source_file = b.path("keyboard.zig"),
|
|
.imports = &.{
|
|
"acpi-ids", "channel", "driver", "input-client", "input-protocol", "ipc",
|
|
"logging", "memory", "process", "time", "xkeyboard-config",
|
|
},
|
|
});
|
|
b.installArtifact(ps2_keyboard_exe);
|
|
|
|
const ps2_mouse_exe = build_support.userBinary(b, .{
|
|
.name = "ps2-mouse",
|
|
.root_source_file = b.path("mouse.zig"),
|
|
.imports = &.{
|
|
"acpi-ids", "channel", "driver", "input-client", "input-protocol", "ipc", "logging",
|
|
"memory", "process", "time",
|
|
},
|
|
});
|
|
b.installArtifact(ps2_mouse_exe);
|
|
|
|
// Standalone `zig build test`; the root aggregate depends on this step.
|
|
const test_step = b.step("test", "Run the ps2-bus unit tests");
|
|
for ([_][]const u8{
|
|
"scancode.zig", // set-2 decode + keyboard state machine
|
|
"mouse-packet.zig", // 3-byte mouse packet assembly
|
|
}) |test_root| {
|
|
const unit_tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path(test_root),
|
|
.target = b.resolveTargetQuery(.{}),
|
|
}),
|
|
});
|
|
test_step.dependOn(&b.addRunArtifact(unit_tests).step);
|
|
}
|
|
}
|