diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 15:17:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 15:38:03 -0300 |
| commit | d0c4da0b37f45b805081eb3f3dd95ae0fa9a99da (patch) | |
| tree | 3843d3a78e1442393d4d5f32d067d9f9523c948c /build/addons.zig | |
| parent | b4faa9da0530be0391a7cc61eb4ea1e4cdbfa038 (diff) | |
| download | pardes-d0c4da0b37f45b805081eb3f3dd95ae0fa9a99da.tar.gz pardes-d0c4da0b37f45b805081eb3f3dd95ae0fa9a99da.zip | |
build: sketchbook's devices by name: the window asks sketchbook (in build/gui.zig only) for its `c`, translated from gui.zig's header over pardes's own SDL (-Dc-header, -Dc-include), its `dev` (the executor, cells, presentation, glyph atlas and scene format: src/gui/gui.zig takes the five from it) and the named font.c, compiled against pardes's FreeType and HarfBuzz as before; every sb.path into sketchbook, the copied shader list, compileGlsl and -Dgpu-only are gone; -Dprebuilt-shaders is passed through; the GPU addons take gpu_scene from the same instance (addons.gpu gets the window's dependency, null off the window, after it); the Cells and Atlas tests are sketchbook's own now (5 fewer here). gui: frame corpus 77/77 byte-identical against mbase, unit-test 1582/1590 (the base's 1582; the 5 moved, the base's 8 failures), tui-has-no-sdl; tui: core-test 811/950 (139 skipped), configures with ../sketchbook moved aside
Diffstat (limited to 'build/addons.zig')
| -rw-r--r-- | build/addons.zig | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/build/addons.zig b/build/addons.zig index 195255fd..38b02dff 100644 --- a/build/addons.zig +++ b/build/addons.zig @@ -1,37 +1,37 @@ const std = @import("std"); const mupdf_build = @import("mupdf.zig"); -/// The GPU addons over sketchbook's `gpu_scene`: the snake (addons/snake_shader) -/// and the frame corpus's translucent veil (test/veil.zig). They are the -/// window build's, as sketchbook is: the terminal's configures without -/// sketchbook beside the checkout, and there their steps say so. -pub fn gpu(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang.Optimize, addon_mod: *std.Build.Module, window: bool) ?*std.Build.Step.Compile { +/// The GPU addons over sketchbook's scene format (`gpu_scene`): the snake +/// (addons/snake_shader) and the frame corpus's translucent veil +/// (test/veil.zig). They are the window build's, from the sketchbook it +/// takes (`gui.Window.sketchbook`, null off the window): the terminal's +/// configures without sketchbook beside the checkout, and there their steps +/// say so. +pub fn gpu(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang.Optimize, addon_mod: *std.Build.Module, sketchbook: ?*std.Build.Dependency) ?*std.Build.Step.Compile { const snake_shader_step = b.step("snake-shader", "build the optional GPU snake addon into zig-out/lib"); - var snake_shader_lib: ?*std.Build.Step.Compile = null; const veil_step = b.step("veil", "build the frame corpus's translucent GPU test addon (test/veil.zig) into zig-out/lib"); - if (!window) { + const sb = sketchbook orelse { const fail = b.addFail("the GPU addons are the window's: -Dplatform=gui (sketchbook beside this checkout)"); snake_shader_step.dependOn(&fail.step); veil_step.dependOn(&fail.step); - } else if (b.dependencyLazy("sketchbook", .{ .@"gpu-only" = true })) |sb| { - const files = b.addWriteFiles(); - for ([_][]const u8{ "vert", "frag", "post.frag" }) |stage| { - const compile = b.addSystemCommand(&.{ "glslc", "-O" }); - compile.addFileArg(b.path(b.fmt("addons/snake_shader/snake.{s}", .{stage}))); - compile.addArg("-o"); - _ = files.addCopyFile(compile.addOutputFileArg(b.fmt("snake.{s}.spv", .{stage})), b.fmt("{s}.spv", .{stage})); - } - const shader_module = b.createModule(.{ .root_source_file = files.add("shaders.zig", "const v align(4) = @embedFile(\"vert.spv\").*;\npub const vert: []const u8 = &v;\nconst f align(4) = @embedFile(\"frag.spv\").*;\npub const frag: []const u8 = &f;\nconst p align(4) = @embedFile(\"post.frag.spv\").*;\npub const post: []const u8 = &p;\n") }); - const module = b.createModule(.{ .root_source_file = b.path("addons/snake_shader/snake_shader.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "addon", .module = addon_mod }, .{ .name = "gpu_scene", .module = sb.module("gpu_scene") }, .{ .name = "shaders", .module = shader_module } } }); - const lib = b.addLibrary(.{ .name = "snake_shader", .linkage = .dynamic, .root_module = module }); - snake_shader_lib = lib; - snake_shader_step.dependOn(&b.addInstallArtifact(lib, .{}).step); - snake_shader_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = module })).step); - // The frame corpus's translucent addon (test/veil.zig), into lib/ beside the snake. - const veil = b.addLibrary(.{ .name = "veil", .linkage = .dynamic, .root_module = b.createModule(.{ .root_source_file = b.path("test/veil.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "addon", .module = addon_mod }, .{ .name = "gpu_scene", .module = sb.module("gpu_scene") } } }) }); - veil_step.dependOn(&b.addInstallArtifact(veil, .{}).step); - } else |_| {} - return snake_shader_lib; + return null; + }; + const files = b.addWriteFiles(); + for ([_][]const u8{ "vert", "frag", "post.frag" }) |stage| { + const compile = b.addSystemCommand(&.{ "glslc", "-O" }); + compile.addFileArg(b.path(b.fmt("addons/snake_shader/snake.{s}", .{stage}))); + compile.addArg("-o"); + _ = files.addCopyFile(compile.addOutputFileArg(b.fmt("snake.{s}.spv", .{stage})), b.fmt("{s}.spv", .{stage})); + } + const shader_module = b.createModule(.{ .root_source_file = files.add("shaders.zig", "const v align(4) = @embedFile(\"vert.spv\").*;\npub const vert: []const u8 = &v;\nconst f align(4) = @embedFile(\"frag.spv\").*;\npub const frag: []const u8 = &f;\nconst p align(4) = @embedFile(\"post.frag.spv\").*;\npub const post: []const u8 = &p;\n") }); + const module = b.createModule(.{ .root_source_file = b.path("addons/snake_shader/snake_shader.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "addon", .module = addon_mod }, .{ .name = "gpu_scene", .module = sb.module("gpu_scene") }, .{ .name = "shaders", .module = shader_module } } }); + const lib = b.addLibrary(.{ .name = "snake_shader", .linkage = .dynamic, .root_module = module }); + snake_shader_step.dependOn(&b.addInstallArtifact(lib, .{}).step); + snake_shader_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = module })).step); + // The frame corpus's translucent addon (test/veil.zig), into lib/ beside the snake. + const veil = b.addLibrary(.{ .name = "veil", .linkage = .dynamic, .root_module = b.createModule(.{ .root_source_file = b.path("test/veil.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "addon", .module = addon_mod }, .{ .name = "gpu_scene", .module = sb.module("gpu_scene") } } }) }); + veil_step.dependOn(&b.addInstallArtifact(veil, .{}).step); + return lib; } pub const Pdf = struct { |
