Skip to content

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

Notifications You must be signed in to change notification settings

OlivierLDff/QtWasmCMakeDocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

🌍 Qt Webassembly CMake

🐳 Publish Docker image

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published