nandi/jolt-nativepublic Fork 0
459c9cd7d8ffaf8517f2376db0554fb6e0c53c8a
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

build.zig · 51 lines · 1.9 KBZig Blame HistoryRaw
Paint the tree ABI a third way: Zig and dvui 7289263 nandi 9d ago1//! Builds `libjoltzvui.so`: the retained-tree ABI with dvui under it.
2//!
3//! dvui's own build.zig picks a backend from `-Dbackend=`, and exposes the
4//! painted module as `dvui_sdl3` plus the raw SDL backend as `sdl3`. Both are
5//! needed here — the ABI drives the loop itself (open / frame / close), which
6//! is dvui's "standalone" shape rather than its App shape, because the caller
7//! on the other side of this boundary owns the loop.
8
9const std = @import("std");
10
11pub fn build(b: *std.Build) void {
12 const target = b.standardTargetOptions(.{});
13 // ReleaseSafe by default: this library is loaded into a foreign runtime
14 // that cannot survive a panic, so the checks are worth more than the
15 // last few percent. See the note at the top of src/lib.zig.
16 const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSafe });
17
18 const dvui_dep = b.dependency("dvui", .{
19 .target = target,
20 .optimize = optimize,
21 .backend = .sdl3,
22 });
23
24 const mod = b.createModule(.{
25 .root_source_file = b.path("src/lib.zig"),
26 .target = target,
27 .optimize = optimize,
28 .link_libc = true,
29 });
30 mod.addImport("dvui", dvui_dep.module("dvui_sdl3"));
31 mod.addImport("sdl-backend", dvui_dep.module("sdl3"));
32
33 const lib = b.addLibrary(.{
34 .name = "joltzvui",
35 .linkage = .dynamic,
36 .root_module = mod,
37 });
38 b.installArtifact(lib);
39 b.installFile("include/zvui.h", "include/zvui.h");
40
41 // The tree is the half worth testing without a window: `zig build test`.
42 const tests = b.addTest(.{
43 .root_module = b.createModule(.{
44 .root_source_file = b.path("src/tree.zig"),
45 .target = target,
46 .optimize = optimize,
47 }),
48 });
49 const run_tests = b.addRunArtifact(tests);
50 b.step("test", "Run the tree tests").dependOn(&run_tests.step);
51}