Cheerp is an open source C/C++ compiler, with permissive, enterprise-grade license for Web applications. It allows compiling practically any C/C++ code for WebAssembly and JavaScript.
It is based on and integrated with the LLVM/Clang infrastructure, and presents several stages of custom optimizations to maximize performance and minimize the size of compiled JavaScript/WebAssembly output.
Cheerp is primarily used to port existing C/C++ libraries and applications to HTML5, but can also be used to write high-performance Web applications and WebAssembly components from zero.
There are ready-made binaries for Windows, Ubuntu/Debian and macOS.
For Windows you can download the latest version from the releases page and run the file https://github.com/leaningtech/ cheerp-meta/releases/download/cheerp-3.0/Cheerp-3.0-Windows.exe
;
For Debian and Ubuntu just add the repository and install via APT:
https://github.com/leaningtech /cheerp-meta/releases/download/cheerp-3.0/cheerp-macosx-3.0.dmg
;To build from scratch just follow the instructions at this link.
A basic Hello, World!
would be:
Compile with the command:
And run with Node.js:
You can also use your own index.html
file:
Remembering that some browsers won’t run on ~
file:///
~, but you can usepython3 -m http.server
and then open the file.
For more information see the links:
cpp C language web webassembly