fastnoise2-sys
Low-level Rust FFI bindings for FastNoise2, a high-performance noise generation library with SIMD support.
Building
Native Platforms (Linux, Windows, macOS)
Native builds use CMake and require a C++17 compiler:
WebAssembly (WASM)
WASM builds require the Emscripten SDK:
1. Install Emscripten
# Clone the emsdk repository
# Install and activate Emscripten 3.1.68 or later
# Add Emscripten to your environment
Note: You need to run source ./emsdk_env.sh in each new terminal session before building for WASM.
2. Build for WASM
The build script will automatically detect the Emscripten target and use Emscripten to compile FastNoise2.
Custom Emscripten Flags
You can pass custom flags to emcc via the EMCC_CFLAGS environment variable:
Environment Variables
| Variable | Purpose | Required |
|---|---|---|
EMSDK |
Path to Emscripten SDK | Yes (WASM only) |
EMCC_CFLAGS |
Custom flags for emcc | No |
FASTNOISE2_SOURCE_DIR |
Override FastNoise2 source path | No |
FASTNOISE2_LIB_DIR |
Use precompiled library | No |
FASTNOISE2_BINDINGS_DIR |
Cache directory for bindings | No |
Troubleshooting
Error: "EMSDK environment variable required for WASM builds"
You need to install and activate the Emscripten SDK (see instructions above), then source the environment:
Slow bindgen compilation
Set FASTNOISE2_BINDINGS_DIR to cache generated bindings:
License
This crate provides bindings to FastNoise2, which is licensed under the MIT License.