Emscripten is a complete Open Source compiler toolchain to WebAssembly. Using Emscripten you can:
Practically any portable C or C++ codebase can be compiled into WebAssembly using Emscripten, ranging from high-performance games that need to render graphics, play sounds, and load and process files, through to application frameworks like Qt. Emscripten has already been used to convert a very long list of real-world codebases to WebAssembly, including commercial codebases like the Unreal Engine 4 and the Unity engine. For examples and demos, see the community-maintained list on the wiki.
Emscripten generates small and fast code! Its default output format is WebAssembly , a highly optimizable executable format, that runs almost as fast as native code, while being portable and safe. Emscripten does a lot of optimization work for you automatically, by careful integration with LLVM, Binaryen, Closure Compiler, and other tools.
A high level view of the Emscripten toolchain is given below. The main tool is the Emscripten Compiler Frontend (emcc). This is a drop-in replacement for a standard compiler like gcc or clang.
Emscripten support for portable C/C++ code is fairly comprehensive. Support for the C standard library, C++ standard library, C++ exceptions, etc. is very good, as is SDL2 and other APIs. OpenGL support in Emscripten support is excellent for OpenGL ES 2.0-type code, and acceptable for other types.
There are also limitations that can make some code easier to port — read Portability Guidelines to determine where you may need to spend more effort.