vitreo12 / omni

DSL for low-level audio programming.
https://vitreo12.github.io/omni/
MIT License
188 stars 6 forks source link

Use `zig cc` as C compiler option #144

Open vitreo12 opened 3 years ago

vitreo12 commented 3 years ago

This will allow to pre-bundle the zig compiler together with the omni executable, without the need from the user to rely on external compilers. Moreover, zig cc is more convenient for cross-platform compilation, and, perhaps, WebAssembly too.

-fstrict-aliasing is faster than the conservative -fno-strict-aliasing that the gcc nim compiler uses by default.

Flags: --cc:env --passC:'-O3 -fPIC -flto -fstrict-aliasing -fno-ident' --passL:'-flto'

Shared lib works out of the box.

For static libs, compile with --noLinking.

Static lib can then be built manually with ar. It is installed by default on Unix.

On Windows, the mingw64 version of ar can be used. Builds can be downloaded from: https://nim-lang.org/install_windows.html OR http://winlibs.com/

EDIT: zig ar can easily be used instead!

Check https://github.com/vitreo12/ZigAsNimCCompiler for some more instructions

vitreo12 commented 3 years ago

Recently, zig introduced zig ar! This allows the same zig bundle to build static libs too :)