This is a lightweight Snowpack application for rapid testing (with auto-reload on code change) of the Cheerp C/C++ to WebAssembly compiler with C++ code examples.
- There are many C++ applications that analyze or process data. Porting such applications to WebAssembly allows running them on web browser clients and thus eventually reach the goals of massively scalable architecture and low-cost computing.
- Code (scripts and compiled code) under MIT license.
- Cheerp brand assets (icons, logos) under CC BY 4.0 license. Copyright by Leaning Technologies Ltd.
- Brand assets (icons, logos) under CC BY 4.0 license. Copyright by CONGINEER Ltd.
- Media assets (video, audio, graphics, animations) under CC BY 4.0 license. Copyright by CONGINEER Ltd.
Clone the git repository (suppose in git/testlab) into your home directory:
mkdir -p ~/git/testlab/cheerp
git clone https://github.com/congineer/cheerp-testlab.git ~/git/testlab/cheerp
Install Node.js, as described:
OPTIONAL: Install Cheerp compiler, as described:
NOTE: you may have to open build.sh script once to adjust the compiler binary path according to your Cheerp installation.
# IMPORTANT: adjust Cheerp bin path
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
compiler_bin=/opt/cheerp/bin/clang++
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Open the 1st terminal window, navigate to the test app folder
cd ~/git/testlab/cheerp
and start the app:
npm start
The test app will be loaded and then will open the app page in your default web browser. We recommend to open the browser console in order to watch the test results.
NOTE: Upon any saved change in JavaScript code, the running web app will update automatically and will reload the browser page to reflect the changes.
To re-compile the C++ test file with Cheerp, open the 2nd terminal window, navigate to the test app folder
cd ~/git/testlab/cheerp
and build the C++ target, e.g. here an example for buttons.cpp:
./build.sh cpp/buttons/buttons.cpp
NOTE: Upon re-building the C++ target, the running web app will update automatically and will reload the browser page to reflect the changes.
The app part consists of two versions of a basic "buttons" test. Cheerp version to showcase both WebAssembly and JavaScript compiled methods. Pure JavaScript version to allow direct performance profiling against the Cheerp one.
To run the pure Javescript version uncomment it in app/js/index.js
whilst commenting out the Cheerp one.
- Open the browser console to see test results logged there.
- Run a test by clicking on its test buttons.
- Watch the test output and examine error messages (if any).
TBD