summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-02-12 12:48:11 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2025-02-12 12:48:11 +0100
commit9fd81c0b38b2b843c24fb61bf8cb5b7873deaa72 (patch)
treea2d4d76a4fcc1334d83c5538e684061913be24d3 /build.zig
parentdae5bc02b1c934075e95694953b4330676e21611 (diff)
graphics: add line
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig106
1 files changed, 53 insertions, 53 deletions
diff --git a/build.zig b/build.zig
index 14f17d6..67df95b 100644
--- a/build.zig
+++ b/build.zig
@@ -1,72 +1,72 @@
const std = @import("std");
const Program = struct {
- name: []const u8,
- qemu: bool,
+ name: []const u8,
+ qemu: bool,
};
const programs = [_]Program {
- .{ .name = "shell", .qemu = false },
- .{ .name = "screen", .qemu = true },
+ .{ .name = "shell", .qemu = false },
+ .{ .name = "screen", .qemu = true },
};
pub fn build(b: *std.Build) void {
- const target = b.standardTargetOptions(.{});
- const optimize = b.standardOptimizeOption(.{});
+ const target = b.standardTargetOptions(.{});
+ const optimize = b.standardOptimizeOption(.{});
- const estd = b.createModule(.{
- .root_source_file = b.path("src/estd/root.zig"),
- });
+ const estd = b.createModule(.{
+ .root_source_file = b.path("src/estd/root.zig"),
+ });
- const init_exe = b.addExecutable(.{
- .name = "init",
- .root_source_file = b.path("src/init/main.zig"),
- .target = target,
- .optimize = optimize,
- });
- init_exe.root_module.addImport("estd", estd);
+ const init_exe = b.addExecutable(.{
+ .name = "init",
+ .root_source_file = b.path("src/init/main.zig"),
+ .target = target,
+ .optimize = optimize,
+ });
+ init_exe.root_module.addImport("estd", estd);
- const test_step = b.step("test", "Run tests");
+ const test_step = b.step("test", "Run tests");
- inline for (programs) |program| {
- const path = b.path("src/" ++ program.name ++ "/main.zig");
+ inline for (programs) |program| {
+ const path = b.path("src/" ++ program.name ++ "/main.zig");
- const exe = b.addExecutable(.{
- .name = program.name,
- .root_source_file = path,
- .target = target,
- .optimize = optimize
- });
- exe.root_module.addImport("estd", estd);
- b.installArtifact(exe);
+ const exe = b.addExecutable(.{
+ .name = program.name,
+ .root_source_file = path,
+ .target = target,
+ .optimize = optimize,
+ });
+ exe.root_module.addImport("estd", estd);
+ b.installArtifact(exe);
- const run = b.step("run-" ++ program.name, "Run " ++ program.name);
+ const run = b.step("run-" ++ program.name, "Run " ++ program.name);
- if (program.qemu) {
- const run_qemu = b.addSystemCommand(&.{ "./build/run-qemu" });
- run_qemu.addFileArg(init_exe.getEmittedBin());
- run_qemu.addFileArg(exe.getEmittedBin());
- run_qemu.step.dependOn(&exe.step);
- run_qemu.step.dependOn(&init_exe.step);
- run.dependOn(&run_qemu.step);
- } else {
- const run_artifact = b.addRunArtifact(exe);
- run.dependOn(&run_artifact.step);
- }
+ if (program.qemu) {
+ const run_qemu = b.addSystemCommand(&.{ "./build/run-qemu" });
+ run_qemu.addFileArg(init_exe.getEmittedBin());
+ run_qemu.addFileArg(exe.getEmittedBin());
+ run_qemu.step.dependOn(&exe.step);
+ run_qemu.step.dependOn(&init_exe.step);
+ run.dependOn(&run_qemu.step);
+ } else {
+ const run_artifact = b.addRunArtifact(exe);
+ run.dependOn(&run_artifact.step);
+ }
- const tests = b.addTest(.{
- .name = program.name,
- .root_source_file = path,
- });
- tests.root_module.addImport("estd", estd);
- const run_tests = b.addRunArtifact(tests);
- test_step.dependOn(&run_tests.step);
- }
+ const tests = b.addTest(.{
+ .name = program.name,
+ .root_source_file = path,
+ });
+ tests.root_module.addImport("estd", estd);
+ const run_tests = b.addRunArtifact(tests);
+ test_step.dependOn(&run_tests.step);
+ }
- const tests = b.addTest(.{
- .name = "estd",
- .root_source_file = b.path("src/estd/root.zig"),
- });
- const run_tests = b.addRunArtifact(tests);
- test_step.dependOn(&run_tests.step);
+ const tests = b.addTest(.{
+ .name = "estd",
+ .root_source_file = b.path("src/estd/root.zig"),
+ });
+ const run_tests = b.addRunArtifact(tests);
+ test_step.dependOn(&run_tests.step);
}