add preliminary instructions on how to build for web assembly

This commit is contained in:
yuni 2024-04-04 03:20:38 +02:00
parent 9edd63bd1f
commit 21b6cc192d

View file

@ -118,6 +118,23 @@ cd outfly
cargo run --release cargo run --release
``` ```
## Building for WASM/Browser
This is a work in progress, for now these are just some general hints:
```
git clone [URL]
cd outfly
rustup target install wasm32-unknown-unknown
pacman -S wasm-bindgen binaryen
mkdir outfly_wasm
cargo build --release --target wasm32-unknown-unknown
wasm-bindgen --out-name outfly --out-dir outfly_wasm --target web target/wasm32-unknown-unknown/release/outfly.wasm
wasm-opt -Oz --output wasm/outfly_bg.wasm wasm/outfly_bg.wasm
echo '<script type="module">import init from "./outfly.js"; init()</script>' > wasm/index.html
python -m http.server -d wasm
```
# Changelog # Changelog
- v0.5.2: - v0.5.2: