mirror of
https://github.com/tig-foundation/tig-monorepo.git
synced 2026-02-21 10:27:49 +08:00
| .. | ||
| src | ||
| build.rs | ||
| Cargo.toml | ||
| README.md | ||
tig-wasm
A Rust crate for wrapping algorithm submissions for compilation into WASM with an exported entry_point.
Compiling Algorithm into WASM with entry-point
These steps replicate what TIG's CI does (.github/workflows/build_algorithm.yml):
- Set environment variables to match the algorithm you are compiling:
export CHALLENGE=<challenge_name> export ALGORITHM=<algorithm_name> - Compile your algorithm
cargo build -p tig-wasm --target wasm32-wasi --release --features entry-point - Optimise the WASM and save it into
tig-algorithms/wasm:mkdir -p tig-algorithms/wasm/${CHALLENGE} wasm-opt target/wasm32-wasi/release/tig_wasm.wasm -o tig-algorithms/wasm/${CHALLENGE}/${ALGORITHM}.wasm -O2 --remove-imports