summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index ccec959..7e782c4 100644
--- a/build.zig
+++ b/build.zig
@@ -681,7 +681,11 @@ fn cModule(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.Optimi
/// host links it, and so do a sketch's tests (`App.addTest`), which measure
/// text with no host; a sketch's library never does. Null until the lazy
/// packages are fetched.
-fn textLibrary(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) ?*Build.Step.Compile {
+fn textLibrary(b: *Build, target: Build.ResolvedTarget, mode: std.builtin.OptimizeMode) ?*Build.Step.Compile {
+ // FreeType and HarfBuzz are not what a Debug build debugs, and at -O0 a
+ // layout costs four to six times as much (a screen of source text laid
+ // out twice a frame: 2.9 ms against 0.6): optimised in every mode.
+ const optimize: std.builtin.OptimizeMode = if (mode == .debug) .ReleaseFast else mode;
const freetype = (b.lazyDependency("freetype", .{ .target = target, .optimize = optimize, .@"enable-libpng" = false }) orelse return null).artifact("freetype");
const harfbuzz = b.lazyDependency("harfbuzz", .{}) orelse return null;
const lib = b.addLibrary(.{ .name = "sketchbook-text", .linkage = .static, .root_module = b.createModule(.{