- Install Emscripten by following the instructions here.
- Follow the instructions here to update Emscripten to the latest version.
- Install Firefox (for testing).
- Get CoreRT set up by following the Visual Studio instructions.
- Build the WebAssembly runtime by running
build.cmd wasm
from the repo root. - Run the WebAssembly "Hello World" test by running
C:\corert\tests\runtest.cmd wasm
.
- Install Emscripten by following the instructions here.
- Follow the instructions here to update Emscripten to the latest version.
- Get CoreRT set up by installing Prerequisites.
- Build the WebAssembly runtime by running
./build.sh wasm
from the repo root. - Run the WebAssembly "Hello World" test by opening it in Firefox.
- Get CoreRT set up by installing Prerequisites, except install
libicu55
for Ubuntu 16 instead oflibicu52
. - Install Emscripten by following the instructions here.
- Follow the instructions here to update Emscripten to the latest version.
- Build the WebAssembly runtime by running
./build.sh wasm
from the repo root. - Run the WebAssembly "Hello World" test by opening it in Firefox.
This is Windows only for now.
- Set the ILCompiler startup command line to
@C:\corert\tests\src\Simple\HelloWasm\obj\Debug\wasm\native\HelloWasm.ilc.rsp
. That will generate HelloWasm.bc, an LLVM bitcode file. - To compile that to WebAssembly, run
emcc HelloWasm.bc -s ALLOW_MEMORY_GROWTH=1 C:\corert\bin\WebAssembly.wasm.Debug\sdk\libPortableRuntime.bc C:\corert\bin\WebAssembly.wasm.Debug\sdk\libbootstrappercpp.bc -s WASM=1 -o HelloWasm.html
(if emcc isn't on your path, you'll need to launch an Emscripten command prompt to do this). That will generate a .wasm file with your code as well as html and js files to run it.
- Ensure you have Edge 41 (Windows only) or above or Firefox.
- Open the generated html file in Edge or Firefox and look at the on-screen console for output.
- To manually make ILC compile to WebAssembly, add
--wasm
to the command line. - Add
-g3
to the emcc command line to generate more debuggable output and a .wast file with the text form of the WebAssembly. - Omit
-s WASM=1
from the emcc command line to generate asm.js. Browser debuggers currently work better with asm.js and it's often a bit more readable than wast. - Add
-O2 --llvm-lto 2
to the emcc command line to enable optimizations. This makes the generated WebAssembly as much as 75% smaller as well as more efficient.