Examples
All examples are in the examples/ directory and build successfully.
Available Examples
| Example | Description | Key Features |
|---|---|---|
| basic-executable | Minimal executable | install = true |
| library-with-tests | Library with test suite | kind = .library, tests = true |
| cross-compile | Multi-platform build | cross field, targets.all() |
| custom-options | Build-time options | boolOption, stringOption |
| system-lib | Link C libraries | system_libs field |
| run-with-args | Run step with arguments | run = true |
| monorepo | Multi-package workspace | workspace(), local_deps |
Running Examples
bash
cd examples/basic-executable
zig buildUsing buildx as a Dependency
Each example's build.zig.zon references buildx.zig:
zig
.dependencies = .{
.buildx = .{
.path = "../..",
},
},