Building
Build instructions for Rust, WASM, and Python targets.
Building
Requirements
| Tool | Version | Purpose |
|---|---|---|
| Rust | 2021 edition (1.70+) | Core library |
| cargo | Latest stable | Build system |
| wasm-pack | 0.12+ | WASM builds |
| maturin | 1.0+ | Python bindings |
| Python | 3.8+ | Python bindings |
Dependencies
The crate depends on:
[dependencies]
nalgebra = { version = "0.33", features = ["sparse"] }
petgraph = "0.6"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
approx = "0.5"
rand = "0.8"
[dev-dependencies]
proptest = "1"
criterion = { version = "0.5", features = ["html_reports"] }
nalgebra 0.33 with the sparse feature provides CSC matrix support and sparse linear algebra used by the Sparse CG solver.
Build the Rust Library
# Debug build cargo build # Release build (recommended for benchmarks) cargo build --release
The release build enables LLVM optimizations and is typically 5–10× faster than debug.
Run Tests
# All tests cargo test # Only unit tests cargo test --lib # Only proptests cargo test --test proptest_jacobian # Quick bench test cargo test --test quick_bench
Run Benchmarks
cargo bench
HTML reports are generated in target/criterion/. Open target/criterion/report/index.html in a browser to view interactive charts.
WASM Build
# Add the WASM target rustup target add wasm32-unknown-unknown # Install wasm-pack cargo install wasm-pack # Build using the provided script ./build_wasm.sh
The script runs:
wasm-pack build --target web --out-name solver_test --release
Output goes to pkg/ with solver_test.js, solver_test.d.ts, and solver_test_bg.wasm.
Python Bindings
# Build and install locally cd py-lib maturin develop --release # Or build a wheel cd py-lib maturin build --release
Prebuilt Wheel
A prebuilt wheel is included for convenience:
geom_solver-0.1.0-cp312-cp312-manylinux_2_35_x86_64.whl
Install directly:
pip install geom_solver-0.1.0-cp312-cp312-manylinux_2_35_x86_64.whl
This wheel targets Python 3.12 on manylinux 2.35 (x86_64). For other platforms, build from source using maturin.
Clean Build
cargo clean cargo build --release
Use cargo clean if you encounter build artifacts from a different toolchain or if incremental compilation produces errors.