Chapter summary
After this last chapter, compiling zig programs and setting up projects with the Zig Build System should feel familiar.
- zig build-exe compiles an executable. It works much like zig run, except it only compiles.
- The compilation mode (Debug, ReleaseFast, etc.) determines the level of optimization and runtime safety checks.
- With zig init, we generate the project structure. Using --minimal mode creates only the essential build.zig and build.zig.zon files.
- build.zig.zon uses the ZON format (Zig Object Notation), inspired by structs, to declare metadata and dependencies.
- build.zig defines how to compile the project through a series of steps.
- With zig fetch, we add external dependencies to projects: this command downloads them and updates the .dependencies field in the build.zig.zon file.