summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index d83b7139..132b3640 100644
--- a/build.zig
+++ b/build.zig
@@ -354,6 +354,13 @@ pub fn build(b: *std.Build) void {
const zstbi_dep = b.dependency("zstbi", .{ .target = target, .optimize = c_optimize });
const zstbi_mod = zstbi_dep.module("root");
+ // The image addon (addons/image/image.c over stb_image), installed where
+ // the start scan finds it (<prefix>/lib/pardes/addons) and handed by
+ // path to every test that opens a picture.
+ const image_addon = b.addLibrary(.{ .name = "image", .linkage = .dynamic, .root_module = b.createModule(.{ .target = target, .optimize = c_optimize, .link_libc = true }) });
+ image_addon.root_module.addIncludePath(b.path("src/kinds"));
+ image_addon.root_module.addIncludePath(zstbi_dep.path("libs/stbi"));
+ image_addon.root_module.addCSourceFile(.{ .file = b.path("addons/image/image.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror" } });
// mvzr backtracks with no bound on its work (its own test "do not make
// this test any longer": `a?` n times is 2^n steps), and pardes searches
@@ -1126,6 +1133,16 @@ pub fn build(b: *std.Build) void {
.root_module = root_mod,
});
installHome(b, exe, home_bin);
+ if (target.result.os.tag == .linux and !static) {
+ b.getInstallStep().dependOn(&b.addInstallFileWithDir(image_addon.getEmittedBin(), .lib, "pardes/addons/image.so").step);
+ if (home_bin) |dir| {
+ const copy = b.addSystemCommand(&.{ "install", "-Dm755" });
+ copy.addFileArg(image_addon.getEmittedBin());
+ copy.addArg(b.pathJoin(&.{ dir, "..", "lib", "pardes", "addons", "image.so" }));
+ copy.has_side_effects = true;
+ b.getInstallStep().dependOn(&copy.step);
+ }
+ }
if (gui_mod) |gm| {
var gui_name: []const u8 = "pardes-gui";
if (target.result.os.tag != .linux or target.result.cpu.arch != .x86_64)