1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);
}
|