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
45
46
47
48
49
50
51
|
//! Builds `libjoltzvui.so`: the retained-tree ABI with dvui under it.
//!
//! dvui's own build.zig picks a backend from `-Dbackend=`, and exposes the
//! painted module as `dvui_sdl3` plus the raw SDL backend as `sdl3`. Both are
//! needed here — the ABI drives the loop itself (open / frame / close), which
//! is dvui's "standalone" shape rather than its App shape, because the caller
//! on the other side of this boundary owns the loop.
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
// ReleaseSafe by default: this library is loaded into a foreign runtime
// that cannot survive a panic, so the checks are worth more than the
// last few percent. See the note at the top of src/lib.zig.
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSafe });
const dvui_dep = b.dependency("dvui", .{
.target = target,
.optimize = optimize,
.backend = .sdl3,
});
const mod = b.createModule(.{
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
mod.addImport("dvui", dvui_dep.module("dvui_sdl3"));
mod.addImport("sdl-backend", dvui_dep.module("sdl3"));
const lib = b.addLibrary(.{
.name = "joltzvui",
.linkage = .dynamic,
.root_module = mod,
});
b.installArtifact(lib);
b.installFile("include/zvui.h", "include/zvui.h");
// The tree is the half worth testing without a window: `zig build test`.
const tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/tree.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_tests = b.addRunArtifact(tests);
b.step("test", "Run the tree tests").dependOn(&run_tests.step);
}
|