diff --git a/build.zig b/build.zig index 58e4c31..e098760 100644 --- a/build.zig +++ b/build.zig @@ -61,4 +61,20 @@ pub fn build(b: *Build) void { .optimize = optimize, .mod_chipz = mod_chipz, }); + buildDocs(b, target); +} + +fn buildDocs(b: *Build, target: Build.ResolvedTarget) void { + const obj_autodocs = b.addObject(.{ + .name = "chipz", + .root_source_file = b.path("src/chipz.zig"), + .target = target, + .optimize = .Debug, + }); + const install_autodocs = b.addInstallDirectory(.{ + .source_dir = obj_autodocs.getEmittedDocs(), + .install_dir = .prefix, + .install_subdir = "docs", + }); + b.getInstallStep().dependOn(&install_autodocs.step); }