wgpu/documentation/platforms/
emscripten.rs

1/*!
2# Running on the Web with Emscripten
3
4At the moment `wgpu` has one example meant to run under Emscripten:
5`wgpu-hal/examples/raw-gles.rs`.
6
7In the workspace's top directory, build the example as follows:
8
9```bash
10cargo clean
11EMCC_CFLAGS="-g -s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry -s FULL_ES3=1" \
12    cargo build --example raw-gles --target wasm32-unknown-emscripten --features gles,emscripten,webgl
13```
14
15Then copy the HTML page that loads the compiled example into the target
16directory alongside the WebAssembly:
17
18```bash
19cp wgpu-hal/examples/raw-gles.em.html target/wasm32-unknown-emscripten/debug/examples/
20```
21
22Finally, start an HTTP server publishing the contents of that directory:
23
24```bash
25cd target/wasm32-unknown-emscripten/debug/examples/
26python -m http.server
27```
28
29Then visit `localhost:8000/` in your browser.
30
31If you get other, more interesting examples working with Emscripten, please
32update this page!
33*/