From 2c9e648c2c9c487c0239760bff23a70c059f018f Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Sun, 1 Feb 2026 19:35:14 -0500 Subject: Clean API and add docs --- build.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 1b7e474..440917f 100644 --- a/build.zig +++ b/build.zig @@ -21,6 +21,9 @@ pub fn build(b: *std.Build) void { // target and optimize options) will be listed when running `zig build --help` // in this directory. + // Get default install step (called with `zig build` or `zig build install`) + const install_step = b.getInstallStep(); + // This creates a module, which represents a collection of source files alongside // some compilation options, such as optimization mode and linked system libraries. // Zig modules are the preferred way of making Zig code available to consumers. @@ -41,6 +44,22 @@ pub fn build(b: *std.Build) void { .target = target, }); + // Only used to generate the documentation + const zaprus_lib = b.addLibrary(.{ + .name = "zaprus", + .root_module = mod, + }); + + const docs_step = b.step("doc", "Emit documentation"); + const docs_install = b.addInstallDirectory(.{ + .install_dir = .prefix, + .install_subdir = "docs", + .source_dir = zaprus_lib.getEmittedDocs(), + }); + + docs_step.dependOn(&docs_install.step); + install_step.dependOn(docs_step); + // Create static library const lib = b.addLibrary(.{ .name = "zaprus", -- cgit