emscripten

Compile C/C++ to WebAssembly and JavaScript for the web

brewmacoslinux
Try with needOr install directly
Source

About

LLVM bytecode to JavaScript compiler

Commands

emccem++emaremranlibemconfigureemmake

Examples

Compile a simple C program to JavaScript$ emcc hello.c -o hello.js
Compile C++ to WebAssembly with optimizations$ em++ myapp.cpp -o myapp.js -O3 -s WASM=1
Generate HTML file with embedded WebAssembly$ emcc program.c -o program.html