Zig NEWS

Discussion on: zig build explained - part 2

Collapse
 
tedk profile image
Ted

This is a great series.

Could you please do something on how to add 'folders' and 'zig files in folders' to the build system.
I find structuring projects somewhat, i.e, ading folders and files to what is automatically created after zig build init, somewhat difficult.
Many thanks.

Collapse
 
xq profile image
Felix "xq" Queißner

There is no "adding folders or files" for Zig. Zig uses relative paths for imports and builds all dependencies from a single .zig file. This is very different from C, where you usually have tons of files in the build process. Zig only requires the "root" one which contains the application entry point (usually main)

Just put your starting file into any folder you like and use a relative path to that in the build.zig file in b.addExecutable (or similar)