A complete container that is required to compile CMake based C++/Qt application with Emscripten and Qt for WebAssembly.
This project is based on madmanfred/qt-webassembly.
This image is made to build cmake qt project for wasm, but it can also build qmake based (but you should prefer using base image for that).
You can run an interactive bash to build whatever you need. Execute this command from you source folder, to map it to /src
folder in the container.
# This folder will be mounted in the container as /src
cd /path/to/my/project
# Start bash in the container
docker run -it --rm -v $(pwd):/src/ -u $(id -u):$(id -g) reivilo1234/qt-webassembly-cmake:qt5.15-em1.39.10 bash
# Then regular cmake workflow
mkdir -p build && cd build
cmake ..
make -j
# Build target will be available in /path/to/my/project/build
A second approch to use this container is to just run the command that you inside the container.
# Everything need to be executed in the same folder as CMakeLists.txt
# This folder will be mounted in the container as /src
cd /path/to/my/project
# Customize here your build folder name
export BUILD_DIR=build
# Create alias to run a command in the container
alias docker-run='docker run --rm -v $(pwd):/src/ -u $(id -u):$(id -g) reivilo1234/qt-webassembly-cmake:qt5.15-em1.39.10'
# Create build directory in host
mkdir -p $BUILD_DIR
# Execute cmake in container
docker-run cmake -B ./$BUILD_DIR/ -S . ..
# Execute make in container
docker-run make -C $BUILD_DIR -j
Checkout QQuickStaticHelloWorld for a minimal working project.
Run in the same directory as the Dockerfile
export DOCKER_TAG=qt5.15-em1.39.10
docker build --tag qt-webassembly-cmake:$DOCKER_TAG .
docker tag qt-webassembly-cmake:$DOCKER_TAG reivilo1234/qt-webassembly-cmake:$DOCKER_TAG
docker push reivilo1234/qt-webassembly-cmake:$DOCKER_TAG