- Renamed all references from zpdf to zcatpdf
- Module import: @import("zcatpdf")
- Consistent with zcatui, zcatgui naming convention
- All lowercase per Zig standards
Note: Directory rename (zpdf -> zcatpdf) and Forgejo repo rename
should be done manually after this commit.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
75 lines
4 KiB
Zig
75 lines
4 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
// Get libdeflate dependency
|
|
const libdeflate_dep = b.dependency("libdeflate", .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
const libdeflate_lib = libdeflate_dep.artifact("deflate");
|
|
|
|
// zcatpdf module with libdeflate
|
|
const zcatpdf_mod = b.createModule(.{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
zcatpdf_mod.linkLibrary(libdeflate_lib);
|
|
|
|
// Tests
|
|
const unit_tests = b.addTest(.{
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/root.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
});
|
|
unit_tests.root_module.linkLibrary(libdeflate_lib);
|
|
|
|
const run_unit_tests = b.addRunArtifact(unit_tests);
|
|
const test_step = b.step("test", "Run unit tests");
|
|
test_step.dependOn(&run_unit_tests.step);
|
|
|
|
// Example executables
|
|
const examples = [_]struct { name: []const u8, path: []const u8, step_name: []const u8, desc: []const u8 }{
|
|
.{ .name = "hello", .path = "examples/hello.zig", .step_name = "hello", .desc = "Run hello example" },
|
|
.{ .name = "invoice", .path = "examples/invoice.zig", .step_name = "invoice", .desc = "Run invoice example" },
|
|
.{ .name = "text_demo", .path = "examples/text_demo.zig", .step_name = "text_demo", .desc = "Run text demo example" },
|
|
.{ .name = "image_demo", .path = "examples/image_demo.zig", .step_name = "image_demo", .desc = "Run image demo example" },
|
|
.{ .name = "table_demo", .path = "examples/table_demo.zig", .step_name = "table_demo", .desc = "Run table demo example" },
|
|
.{ .name = "pagination_demo", .path = "examples/pagination_demo.zig", .step_name = "pagination_demo", .desc = "Run pagination demo example" },
|
|
.{ .name = "links_demo", .path = "examples/links_demo.zig", .step_name = "links_demo", .desc = "Run links demo example" },
|
|
.{ .name = "bookmarks_demo", .path = "examples/bookmarks_demo.zig", .step_name = "bookmarks_demo", .desc = "Run bookmarks demo example" },
|
|
.{ .name = "curves_demo", .path = "examples/curves_demo.zig", .step_name = "curves_demo", .desc = "Run curves demo example" },
|
|
.{ .name = "transforms_demo", .path = "examples/transforms_demo.zig", .step_name = "transforms_demo", .desc = "Run transforms demo example" },
|
|
.{ .name = "transparency_demo", .path = "examples/transparency_demo.zig", .step_name = "transparency_demo", .desc = "Run transparency demo example" },
|
|
.{ .name = "gradient_demo", .path = "examples/gradient_demo.zig", .step_name = "gradient_demo", .desc = "Run gradient demo example" },
|
|
.{ .name = "barcode_demo", .path = "examples/barcode_demo.zig", .step_name = "barcode_demo", .desc = "Run barcode demo example" },
|
|
.{ .name = "ttf_demo", .path = "examples/ttf_demo.zig", .step_name = "ttf_demo", .desc = "Run TTF font demo example" },
|
|
.{ .name = "template_demo", .path = "examples/template_demo.zig", .step_name = "template_demo", .desc = "Run template demo example" },
|
|
.{ .name = "markdown_demo", .path = "examples/markdown_demo.zig", .step_name = "markdown_demo", .desc = "Run markdown demo example" },
|
|
};
|
|
|
|
inline for (examples) |example| {
|
|
const exe = b.addExecutable(.{
|
|
.name = example.name,
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path(example.path),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.imports = &.{
|
|
.{ .name = "zcatpdf", .module = zcatpdf_mod },
|
|
},
|
|
}),
|
|
});
|
|
b.installArtifact(exe);
|
|
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
const run_step = b.step(example.step_name, example.desc);
|
|
run_step.dependOn(&run_cmd.step);
|
|
}
|
|
}
|