Add WASM build target for Web version of glslang

This adds build rules to support generating a WASM binary to be used
on the web. The API exposed to web applications is definated in the
new glslang.js.cpp file.
This commit is contained in:
Ryan Harrison 2019-08-08 13:50:13 -04:00
parent 3cea2e5882
commit c96e42dca8
4 changed files with 336 additions and 0 deletions

14
HOWTO-build-wasm.md Normal file
View file

@ -0,0 +1,14 @@
Build as usual (see `README.md`), but:
* Need `emsdk` in your *PATH*
+ Instructions located
[here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install)
* Do not checkout SPIRV-Tools into External/
+ Does not work correctly with emscripten out of the box and we don't want
it in the build anyway.
+ *TBD* Add flag to disable SPIRV-Tool inclusion even if directory is
present.
* Wrap call to `cmake` using `emconfigure`:
+ e.g. `emconfigure cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_WEB=ON
-DENABLE_HLSL=OFF -DCMAKE_INSTALL_PREFIX="$(pwd)/install" ..`
+ To get a 'true' size, make sure to use `brotli` to compress the .js and .wasm files