summaryrefslogtreecommitdiff
path: root/gui/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-12 13:19:32 -0300
committerGabriel Schneider <[email protected]>2026-11-13 00:41:47 -0300
commit4b4113a0217ee27c78e7efddb66ff5a455d49083 (patch)
treeb848dc1e92c3126dec11da8547e8033ff3990140 /gui/build.zig
parenteab50d1c040774351f332a1568fa332c377860bd (diff)
downloadcomputeranim-4b4113a0217ee27c78e7efddb66ff5a455d49083.tar.gz
computeranim-4b4113a0217ee27c78e7efddb66ff5a455d49083.zip
debugger: add a native GUI with live V8 JIT debugging
Diffstat (limited to 'gui/build.zig')
-rw-r--r--gui/build.zig44
1 files changed, 44 insertions, 0 deletions
diff --git a/gui/build.zig b/gui/build.zig
new file mode 100644
index 0000000..ec8b435
--- /dev/null
+++ b/gui/build.zig
@@ -0,0 +1,44 @@
+const std = @import("std");
+const sketchbook = @import("sketchbook");
+
+pub fn build(b: *std.Build) void {
+ const target = b.standardTargetOptions(.{});
+ const optimize = b.standardOptimizeOption(.{});
+ const sb = sketchbook.init(b, .{ .target = target, .optimize = optimize });
+ const canim = b.dependency("canim", .{ .target = target, .optimize = optimize });
+ const zt = b.dependency("ztrace", .{ .target = target, .optimize = optimize });
+ const app = sb.app(.{ .name = "ztrace-gui", .root_source_file = b.path("src/app.zig"), .imports = &.{
+ .{ .name = "canim", .module = canim.module("canim") },
+ .{ .name = "ztrace", .module = zt.module("ztrace") },
+ } });
+ b.installArtifact(zt.artifact("ztrace"));
+ const exe = b.addExecutable(.{ .name = "ztrace-gui", .root_module = b.createModule(.{
+ .root_source_file = b.path("src/main.zig"),
+ .target = target,
+ .optimize = optimize,
+ .imports = &.{ .{ .name = "app", .module = app.module }, .{ .name = "host", .module = sb.modules.host }, .{ .name = "sketch", .module = sb.modules.sketch } },
+ }) });
+ b.installArtifact(exe);
+ const run = std.Build.Step.Run.create(b, "ztrace-gui");
+ run.addFileArg(b.graph.path(.install_bin, "ztrace-gui"));
+ run.step.dependOn(b.getInstallStep());
+ run.addPassthruArgs();
+ b.step("run", "Run the graphical debugger").dependOn(&run.step);
+ const test_run = std.Build.Step.Run.create(b, "GUI interactions");
+ test_run.addFileArg(b.graph.path(.install_bin, "ztrace-gui"));
+ test_run.step.dependOn(b.getInstallStep());
+ test_run.addArgs(&.{ "--headless", "--fresh", "--state" });
+ _ = test_run.addOutputFileArg("gui.state");
+ test_run.addArg("--script");
+ test_run.addFileArg(b.path("test/basic.script"));
+ const small = b.addExecutable(.{ .name = "gui-target", .root_module = b.createModule(.{ .target = target, .optimize = .Debug, .link_libc = true, .sanitize_c = .off }) });
+ small.root_module.addCSourceFile(.{ .file = b.path("targets/loop.c"), .flags = &.{ "-g", "-O0" } });
+ test_run.addArg("--define");
+ test_run.addPrefixedFileArg("TARGET=", small.getEmittedBin());
+ test_run.addArg("--define");
+ _ = test_run.addPrefixedOutputFileArg("STRIKE=", "strike.png");
+ test_run.addArg("--define");
+ _ = test_run.addPrefixedOutputFileArg("SETTLED=", "settled.png");
+ test_run.expectExitCode(0);
+ b.step("test", "Test real debugger interactions through the GUI").dependOn(&test_run.step);
+}