From f3a65e379af558d02ea0b60ad9622b2db8d7916a Mon Sep 17 00:00:00 2001 From: SnorlaxAssist Date: Thu, 13 Jun 2024 17:12:57 -0400 Subject: [PATCH] Docs build step --- .github/workflows/docs.yml | 2 +- build.zig | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 59f6c86..79165a2 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,7 +31,7 @@ jobs: uses: actions/configure-pages@v5 - name: Build docs - run: zig build-lib src/lib.zig -fno-emit-bin -femit-docs=docs + run: zig build docs - name: Archive artifact shell: sh diff --git a/build.zig b/build.zig index 1464904..fd3e522 100644 --- a/build.zig +++ b/build.zig @@ -57,4 +57,23 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&run_lib_unit_tests.step); + + // Docs + const docs_step = b.step("docs", "Build documentation"); + + const docs_obj = b.addObject(.{ + .name = "docs", + .root_source_file = b.path(LIB_SRC), + .target = target, + .optimize = optimize, + }); + docs_obj.linkLibrary(lib); + docs_obj.addIncludePath(lz4_dependency.path("lib")); + + const install_docs = b.addInstallDirectory(.{ + .source_dir = docs_obj.getEmittedDocs(), + .install_dir = .prefix, + .install_subdir = "../docs", + }); + docs_step.dependOn(&install_docs.step); }