From 4b5e793f48f6e721c39ab6ddcf755604df73b643 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 9 Aug 2026 20:31:09 -0300 Subject: Better text rendering --- build.zig | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index e399f537..84accf93 100644 --- a/build.zig +++ b/build.zig @@ -532,10 +532,9 @@ pub fn build(b: *std.Build) void { root_mod.addOptions("pardes_config", opts); hx_core_mod.addOptions("pardes_config", opts); - // SDL3 shell wiring (-Dplatform=gui). The sdl package builds SDL3 - // from source as a static lib + emits the SDL3/ headers; gui.zig @cImports - // those, plus a small stb_truetype C shim for the glyph atlas, and embeds - // the SPIR-V compiled at build time from shaders/*.glsl. + // SDL3 shell wiring (-Dplatform=gui). SDL3 and FreeType are both built + // from source as static libraries; gui.zig @cImports their headers plus + // the small FreeType policy shim, and embeds SPIR-V compiled from GLSL. if (platform == .gui) { // sanitize_c MUST stay off: zig cc's UBSan (on for C in Debug AND // ReleaseSafe) traps hidapi's mismatched fn-pointer calls the moment @@ -549,15 +548,20 @@ pub fn build(b: *std.Build) void { root_mod.linkLibrary(sdl_lib); root_mod.addIncludePath(dep.path("include")); } + const freetype_dep = b.dependency("freetype", .{ + .target = target, + .optimize = optimize, + .@"enable-libpng" = false, + }); + root_mod.linkLibrary(freetype_dep.artifact("freetype")); // darwin: SDL_GPU only speaks SPIRV here (shaders/*.glsl -> glslc), so // it must pick its vulkan backend via the Vulkan SDK's loader + // MoltenVK in /usr/local/lib — a path dyld no longer searches for // bare dlopen names. The rpath restores that lookup. if (target.result.os.tag.isDarwin()) root_mod.addRPath(.{ .cwd_relative = "/usr/local/lib" }); - root_mod.addIncludePath(b.path("vendor/stb")); - root_mod.addCSourceFile(.{ .file = b.path("vendor/stb/stb_truetype_impl.c") }); - root_mod.addCSourceFile(.{ .file = b.path("vendor/stb/font.c") }); + root_mod.addIncludePath(b.path("src/gui")); + root_mod.addCSourceFile(.{ .file = b.path("src/gui/font.c") }); // the embedded UI font: provided as a build import since assets/ lives // outside the src/ module root (@embedFile can't escape it) root_mod.addAnonymousImport("AdwaitaMono-Regular.ttf", .{ -- cgit v1.3