Building a Qt for a WebAssembly application requires you to source the Emscripten environment file, so run this in your console command as follows:
source /path/to/emsdk/emsdk_env.sh
You will need to add the path to Qt for WebAssembly qmake
as follows:
export PATH=/path/to/QtForWebAssembly/bin:$PATH.
Of course, you must replace /path/to
with the actual filesystem path.
You are then ready for action! You build it just like any other Qt app, by running qmake
as follows:
qmake mycoolapp.pro && make.
If you need to debug, rerun qmake
with CONFIG+=debug
as follows:
qmake CONFIG+=debug mycoolapp.pro && make.
This will add various Emscripten specific arguments to the compiler and linker.
Once it is built, you can run it by using the emrun
command from Emscripten, which will start a simple web server and serve the <target>.html
file. This will, in turn, load up qtloader.js
, which, in turn, loads up the <target>.js
file, which loads the <target...