tig-monorepo/tig-wasm
2024-07-30 12:06:51 +08:00
..
src Overhaul tig-wasm to generate challenge instance outside of the WASM. 2024-07-30 11:22:49 +08:00
build.rs Re-run build.rs on env var change. 2024-07-30 12:06:51 +08:00
Cargo.toml Overhaul tig-wasm to generate challenge instance outside of the WASM. 2024-07-30 11:22:49 +08:00
README.md Add legal docs. 2024-05-16 12:41:51 +08:00

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):

  1. Set environment variables to match the algorithm you are compiling:
    export CHALLENGE=<challenge_name>
    export ALGORITHM=<algorithm_name>
    
  2. Compile your algorithm
    cargo build -p tig-wasm --target wasm32-wasi --release --features entry-point
    
  3. 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
    

License

End User License Agreement