Sign inSign up

reivilo1234/qt-webassembly-cmake

By reivilo1234

•Updated about 5 years ago

A container for building Qt applications with CMake for the web platform.

Image
0

1.5K

reivilo1234/qt-webassembly-cmake repository overview

⁠🌍 Qt WebAssembly CMake

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⁠.

⁠🚀 How to use

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).

⁠⌨️ Interative bash

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
⁠🐳 Run only commands inside container

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

⁠Example

Checkout QQuickStaticHelloWorld⁠ for a minimal working project.

⁠🔨 How to build Docker Image

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

Tag summary

Content type

Image

Digest

Size

545.9 MB

Last updated

about 5 years ago

docker pull reivilo1234/qt-webassembly-cmake:qt5.15-em1.39.8