about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--build.zig42
-rw-r--r--src/monkey_brain/main.zig5
-rw-r--r--src/monkey_brain/test.zig0
3 files changed, 26 insertions, 21 deletions
diff --git a/build.zig b/build.zig
index 5a00841..cd4e0ae 100644
--- a/build.zig
+++ b/build.zig
@@ -22,8 +22,6 @@ pub fn build(b: *std.Build) void {
         .optimize = optimize,
     });
 
-    // linking for linux only
-    // TODO: link for mac later
     exe.linkSystemLibrary("SDL2");
     exe.linkSystemLibrary("mpg123");
     exe.linkSystemLibrary("asound");
@@ -31,20 +29,9 @@ pub fn build(b: *std.Build) void {
     exe.addCSourceFile(.{ .file = b.path("csrc/cbrr.c"), .flags = &.{} });
     exe.addIncludePath(b.path("./csrc"));
 
-    // This declares intent for the executable to be installed into the
-    // standard location when the user invokes the "install" step (the default
-    // step when running `zig build`).
     b.installArtifact(exe);
 
-    // This *creates* a Run step in the build graph, to be executed when another
-    // step is evaluated that depends on it. The next line below will establish
-    // such a dependency.
     const run_cmd = b.addRunArtifact(exe);
-
-    // By making the run step depend on the install step, it will be run from the
-    // installation directory rather than directly from within the cache directory.
-    // This is not necessary, however, if the application depends on other installed
-    // files, this ensures they will be present and in the expected location.
     run_cmd.step.dependOn(b.getInstallStep());
 
     // This allows the user to pass arguments to the application in the build
@@ -53,9 +40,6 @@ pub fn build(b: *std.Build) void {
         run_cmd.addArgs(args);
     }
 
-    // This creates a build step. It will be visible in the `zig build --help` menu,
-    // and can be selected like this: `zig build run`
-    // This will evaluate the `run` step rather than the default, which is "install".
     const run_step = b.step("run", "Run the app");
     run_step.dependOn(&run_cmd.step);
 
@@ -64,12 +48,28 @@ pub fn build(b: *std.Build) void {
         .target = target,
         .optimize = optimize,
     });
-
     const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
-
-    // Similar to creating the run step earlier, this exposes a `test` step to
-    // the `zig build --help` menu, providing a way for the user to request
-    // running the unit tests.
     const test_step = b.step("test", "Run unit tests");
     test_step.dependOn(&run_exe_unit_tests.step);
+
+    // monkey brains
+    const monkey_brain = b.addExecutable(.{
+        .name = "monkey_brain",
+        .root_source_file = b.path("src/monkey_brain/main.zig"),
+        .target = target,
+        .optimize = optimize,
+    });
+    b.installArtifact(monkey_brain);
+
+    const monkey_brain_run = b.addRunArtifact(monkey_brain);
+    monkey_brain_run.step.dependOn(b.getInstallStep());
+
+    const monkey_run_step = b.step("monkey_run", "Run the monkey brain");
+    monkey_run_step.dependOn(&monkey_brain_run.step);
+
+    const monkey_test_exec = b.addTest(.{ .root_source_file = b.path("src/monkey_brain/test.zig"), .target = target, .optimize = optimize });
+
+    const monkey_test_run = b.addRunArtifact(monkey_test_exec);
+    const monkey_test_step = b.step("monkey_test", "Run monkey brain cells test");
+    monkey_test_step.dependOn(&monkey_test_run.step);
 }
diff --git a/src/monkey_brain/main.zig b/src/monkey_brain/main.zig
new file mode 100644
index 0000000..d488c54
--- /dev/null
+++ b/src/monkey_brain/main.zig
@@ -0,0 +1,5 @@
+const std = @import("std");
+
+pub fn main() !void {
+    std.debug.print("uga buga", .{});
+}
diff --git a/src/monkey_brain/test.zig b/src/monkey_brain/test.zig
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/monkey_brain/test.zig