summaryrefslogtreecommitdiff
path: root/build/core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build/core.zig')
-rw-r--r--build/core.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/build/core.zig b/build/core.zig
index e8150843..32228ab2 100644
--- a/build/core.zig
+++ b/build/core.zig
@@ -514,8 +514,15 @@ pub fn assemble(b: *std.Build, c: struct {
const kind_mod = b.addTranslateC(.{ .root_source_file = b.path("abi/pardes_addon.h"), .target = target, .optimize = optimize }).createModule();
// ...and what an addon in Zig imports over it (abi/addon.zig).
const addon_mod = b.createModule(.{ .root_source_file = b.path("abi/addon.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "pardes_addon", .module = kind_mod }} });
+ // The C-backed addons' own Zig and bridge at the C's speed, with the
+ // checks a release keeps: ReleaseSafe in a Debug build, as in the
+ // user's (a page's search without a hit sliced a NULL: only a release
+ // build aborted, Debug's addons ran ReleaseFast); MuPDF and stb stay
+ // at c_optimize.
+ const addon_optimize: std.lang.Optimize = if (optimize == .debug) .safe else c_optimize;
const pdf_built = addons.pdf(b, .{
.addon_mod = addon_mod,
+ .addon_optimize = addon_optimize,
.c_optimize = c_optimize,
.enable_jpx = c.enable_jpx,
.freetype = freetype,
@@ -602,7 +609,7 @@ pub fn assemble(b: *std.Build, c: struct {
// library and no allocator hook of its own (it takes Zig allocators).
const xitdb_mod = b.dependency("xitdb", .{ .target = target, .optimize = optimize }).module("xitdb");
- const image_addon = addons.image(b, target, c_optimize, addon_mod, zstbi_dep);
+ const image_addon = addons.image(b, target, addon_optimize, addon_mod, zstbi_dep);
// The records the core and the terminal both name (abi/plain.zig).
const plain_mod = b.createModule(.{ .root_source_file = b.path("abi/plain.zig"), .target = target, .optimize = optimize });
// The terminal, a module of its own (core/term/term.zig): the emulator and