-
-
Save blockspacer/698fbca13c01ab977256849daa6cc084 to your computer and use it in GitHub Desktop.
Building Qt for WebAssembly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get dependencies in place (example for Debian based systems) | |
sudo apt-get build-dep --yes qt5-default | |
sudo apt-get install --yes libxcb-xinerama0-dev git python cmake default-jre | |
# Install Emscripten | |
git clone https://github.com/juj/emsdk.git | |
cd emsdk | |
./emsdk install latest | |
./emsdk activate latest | |
source emsdk_env.sh | |
cd .. | |
# Build Qt | |
git clone -b 5.12.0 https://code.qt.io/qt/qt5.git | |
cd qt5 | |
./init-repository -f --module-subset=qtbase,qtdeclarative,qtwebsockets,qtsvg,qtquickcontrols,qtquickcontrols2,qtgraphicaleffects | |
./configure -opensource -confirm-license -xplatform wasm-emscripten -release -static -no-feature-thread -nomake examples -no-dbus -no-ssl | |
make | |
cd .. | |
# Build your project | |
git clone https://github.com/msorvig/qt-webassembly-examples.git | |
cd qt-webassembly-examples/quick_controls2_gallery | |
../../../qt5/qtbase/bin/qmake | |
make | |
# Serve it and browse to http://localhost:8000/gallery.html | |
python -mSimpleHTTPServer |
I bet C++ code of qtwebengine can not be ported to Emscripten.
C++ code of qtwebengine is chromium + some QT code
porting C++ code of qtwebengine to Emscripten is same as porting C++ code of chromium to run in browser (chromium, firefox, etc.) i.e. nearly impossible
in theory (as a workaround), some qtwebengine APIs may be emulated using javascript in browser
BTW
If you need only rendering part of qtwebengine - i managed to port (almost full) skia based HTML renderer from chromium to Emscripten as hobby project https://github.com/blockspacer/skia-opengl-emscripten/tree/master/docs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, thanks for replying.
I forgot to say I was using QT v5.15.2 using emsdk 1.39.8
this is what I wrote:
./init-repository -f --module-subset=qtbase,qtdeclarative,qtwebsockets,qtsvg,qtquickcontrols,qtquickcontrols2,qtgraphicaleffects,qtwebengine
./configure -opensource -confirm-license -xplatform wasm-emscripten -release -static -no-feature-thread -nomake examples -no-dbus -no-ssl
I can't find much information around to explain why webengine can't be compiled with emscripten.
If you happen to know, let me know. Thanks!