summaryrefslogtreecommitdiff
path: root/build/addons.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build/addons.zig')
-rw-r--r--build/addons.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/build/addons.zig b/build/addons.zig
index 38b02dff..a1bdb43b 100644
--- a/build/addons.zig
+++ b/build/addons.zig
@@ -52,6 +52,9 @@ pub const Pdf = struct {
/// `pardes_addon` alone.
pub fn pdf(b: *std.Build, c: struct {
addon_mod: *std.Build.Module,
+ /// pdf.zig's and the bridge's (core.zig's `addon_optimize`); MuPDF's
+ /// and the rest of the C's `c_optimize`.
+ addon_optimize: std.lang.Optimize,
c_optimize: std.lang.Optimize,
enable_jpx: bool,
freetype: ?*std.Build.Step.Compile,
@@ -83,7 +86,7 @@ pub fn pdf(b: *std.Build, c: struct {
// The bridge's header translated here for pdf.zig (Zig 0.17 has no
// @cImport), as the kinds' header is for the core.
const bridge_mod = b.addTranslateC(.{ .root_source_file = b.path("addons/pdf/pdf_bridge.h"), .target = c.target, .optimize = c.c_optimize }).createModule();
- const pdf_mod = b.createModule(.{ .root_source_file = b.path("addons/pdf/pdf.zig"), .target = c.target, .optimize = c.c_optimize, .link_libc = true, .imports = &.{ .{ .name = "addon", .module = c.addon_mod }, .{ .name = "pdf_bridge", .module = bridge_mod } } });
+ const pdf_mod = b.createModule(.{ .root_source_file = b.path("addons/pdf/pdf.zig"), .target = c.target, .optimize = c.addon_optimize, .link_libc = true, .imports = &.{ .{ .name = "addon", .module = c.addon_mod }, .{ .name = "pdf_bridge", .module = bridge_mod } } });
mupdf.linkTo(pdf_mod);
pdf_mod.addIncludePath(b.path("addons/pdf"));
pdf_mod.addCSourceFile(.{ .file = b.path("addons/pdf/pdf_bridge.c"), .flags = &.{"-std=gnu11"} });
@@ -105,8 +108,8 @@ pub fn pdf(b: *std.Build, c: struct {
/// The image addon (addons/image/image.zig over stb_image, stb.c),
/// installed by its step and handed by path to every test that opens a
/// picture.
-pub fn image(b: *std.Build, target: std.Build.ResolvedTarget, c_optimize: std.lang.Optimize, addon_mod: *std.Build.Module, zstbi_dep: *std.Build.Dependency) *std.Build.Step.Compile {
- const image_mod = b.createModule(.{ .root_source_file = b.path("addons/image/image.zig"), .target = target, .optimize = c_optimize, .link_libc = true, .imports = &.{.{ .name = "addon", .module = addon_mod }} });
+pub fn image(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang.Optimize, addon_mod: *std.Build.Module, zstbi_dep: *std.Build.Dependency) *std.Build.Step.Compile {
+ const image_mod = b.createModule(.{ .root_source_file = b.path("addons/image/image.zig"), .target = target, .optimize = optimize, .link_libc = true, .imports = &.{.{ .name = "addon", .module = addon_mod }} });
image_mod.addIncludePath(zstbi_dep.path("libs/stbi"));
image_mod.addCSourceFile(.{ .file = b.path("addons/image/stb.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror" } });
const image_addon = b.addLibrary(.{ .name = "image", .linkage = .dynamic, .root_module = image_mod });