Setting up Zig
Install
|
|
To upgrade, brew upgrade zig
To uninstall, brew uninstall zig
Hello, world!
|
|
Replace the content of generated src/main.zig
with this:
|
|
Build and run with:
|
|
The generated executable binary is saved at zig-out/bin/hello-zig
Default build for this “Hello, world” program is around 1.0M
in size.
Build a binary optimized for small file size with:
|
|
This results in a “Hello, world binary” of around 51K
in size!
The distributed financial transactions database TigerBeetle - written in Zig, is only 700K
.
How to cross compile from any host OS to multiple supported CPU Architecture/OS cobination is described here.
Add a test to main.zig
|
|
Build and test with:
|
|