diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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", |
