With me zig build -femit-docs does nothing. What do I need to do to get that working?
I was curious how it would like up until now.
That only works for directly building a Zig file (e.g. zig build-exe bla.zig -femit-docs), but not for projects with a build.zig (e.g. try zig build-exe -h | less and search for ‘docs’ you’ll find the -femit-docs option, but not for zig build -h in a Zig project).
You’ll basically need to add a build step to build.zig to generate docs.
PS: e.g. see: How to properly make a static library and docs
1 Like
Ok this generated an index.html and some huge .tar file. The index.html showed only Loading... ![]()
Ok… there is no build step. I’ll save this for later. No energy to dive in there.
Here is a very simple codeblock that I have been using to add docs to my projects:
const install_docs = b.addInstallDirectory(.{
.source_dir = lib.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs",
});
const docs_step = b.step("docs", "Generate documentation");
docs_step.dependOn(&install_docs.step);
install.step.dependOn(docs_step);
2 Likes