| 1 | const std = @import("std"); |
| 2 | |
| 3 | pub fn build(b: *std.Build) void { |
| 4 | const test_step = b.step("test", "Test it"); |
| 5 | b.default_step = test_step; |
| 6 | |
| 7 | const bootloader = b.addExecutable(.{ |
| 8 | .name = "bootloader", |
| 9 | .root_module = b.createModule(.{ |
| 10 | .root_source_file = b.path("bootloader.zig"), |
| 11 | .target = b.resolveTargetQuery(.{ |
| 12 | .cpu_arch = .x86, |
| 13 | .os_tag = .freestanding, |
| 14 | }), |
| 15 | .optimize = .small, |
| 16 | }), |
| 17 | }); |
| 18 | |
| 19 | const exe = b.addTest(.{ .root_module = b.createModule(.{ |
| 20 | .root_source_file = b.path("main.zig"), |
| 21 | .target = b.graph.host, |
| 22 | .optimize = .debug, |
| 23 | }) }); |
| 24 | exe.root_module.addAnonymousImport("bootloader.elf", .{ |
| 25 | .root_source_file = bootloader.getEmittedBin(), |
| 26 | }); |
| 27 | |
| 28 | // TODO: actually check the output |
| 29 | _ = exe.getEmittedBin(); |
| 30 | |
| 31 | test_step.dependOn(&exe.step); |
| 32 | } |