cargo build --releaseThis will build the native library in release mode for DEFAULT target.
The library will be located in:
target/release/lib<name>.soon Linuxtarget/release/lib<name>.dylibon macOStarget/release/<name>.dllon Windows.
To verify default target
rustc -vV | grep host./build_emscripten.shFollowing is a list of supported targets on different platforms:
- macOS
- iOS
- macOS Intel
- macOS Apple Silicon
- Windows () with
x86_64-w64-mingw32-gcc- macOS -
brew install mingw-w64 - Linux -
sudo apt install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64
- macOS -
- Linux static
- Linux
- Android
- Linux
- Linux static
- Windows
- Windows
drop the
--releaseflag for debug builds
cargo build --target x86_64-apple-darwin --releasecargo build --target aarch64-apple-darwin --releasecargo build --target aarch64-apple-ios --releasecargo build --target x86_64-unknown-linux-gnu --releasecargo build --target x86_64-unknown-linux-musl --releasecargo build --target aarch64-linux-android --releasecargo build --target x86_64-pc-windows-gnu --releaseOR
cargo build --target x86_64-pc-windows-msvc --releaseInstall Zig
brew install zigwinget install -e --id zig.zigsudo apt install zigzig version