Skip to content

InfiniBrains/qt6-docker

 
 

Repository files navigation

Qt 6 docker containers for CI

The unified way to build your Qt application. This is a collection of the linux docker containers for your CI. Supports native, Android, Windows and MacOS. Primarily it's aimed for Qt, but you can use it with any cmake project and cross-compile anything you want in a number of easy steps.

Uses great AQT tool to simplify the installation process of Qt libs: https://github.com/miurahr/aqtinstall

Dockerhub: https://hub.docker.com/r/stateoftheartio/qt6

  • 6.4-gcc-aqt - Linux GCC 64

  • 6.4-android-aqt - Android Clang multiarch toolkit for x86_64, x86, armv7 and arm64_v8a arch

  • 6.4-wasm-aqt - WebAssembly toolchain

  • 6.4-mingw-aqt - Windows (wine) 64 MinGW toolchain

  • 6.4-macos-aqt - MacOS X osxcross toolchain for x86_64, aarch64

  • 6.3-gcc-aqt - Linux GCC 64

  • 6.3-android-aqt - Android Clang multiarch toolkit for x86_64, x86, armv7 and arm64_v8a arch

  • 6.3-wasm-aqt - WebAssembly toolchain

  • 6.3-mingw-aqt - Windows (wine) 64 MinGW toolchain

  • 6.3-macos-aqt - MacOS X osxcross toolchain for x86_64, aarch64

  • 6.2-gcc-aqt - Linux GCC 64

  • 6.2-android-aqt - Android Clang toolkit for x86_64, x86, armv7 and arm64_v8a arch

  • 6.2-wasm-aqt - WebAssembly toolchain

  • 6.2-mingw-aqt - Windows (wine) 64 MinGW toolchain

  • 6.2-macos-aqt - MacOS X osxcross toolchain for x86_64, aarch64

  • 6.2-gcc-src - Linux GCC 64 built from sources (not ready)

  • 6.2-android-src - Android Clang toolkit for x86_64, x86, armv7 and arm64_v8a built from sources (not ready)

How to build the image

Just go into the required directory and run:

docker build --pull --force-rm=true -t stateoftheartio/qt6:$(basename "${PWD}") .

How to test

You can test the particular image or all of them using test/test.sh script - it will run the defined commands to make sure the image works as expected on a number of sample Qt projects.

How to use

The images are not containing the dev libraries, so if the project needs some of such dependencies, you can build a new image on top of the base one or install the deps dynamically during the build.

In case you want to build in user dir - create it and mount as -v "${PWD}/build:/home/user/build:rw".

Linux GCC:

In the project directory run:

$ docker run -it --rm -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.3-gcc-aqt \
    sh -c 'sudo apt update; sudo apt install -y libgl-dev libvulkan-dev;
           qt-cmake ./project -G Ninja -B ./build; cmake --build ./build;
           linuxdeploy --plugin qt -e "$(find ./build -maxdepth 1 -type f -executable)" --appdir ./build/deploy'

For deploy it uses linuxdeploy and linuxdeploy-plugin-qt, so you can check their capabilities on their github pages:

Android clang:

In the project directory run:

$ docker run -it --rm -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.3-android-aqt \
    sh -c 'qt-cmake ./project -G Ninja -B ./build; cmake --build ./build'

You can use BUILD_ARCH=arm64_v8a (default), =armv7, =x86 or =x86_64 during run of qt-cmake to produce binaries for specific architecture.

Since Qt 6.3 android supports multi-abi, please check how to use it, but in general you can:

$ docker run -it --rm -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.3-android-aqt \
    sh -c 'qt-cmake ./project -G Ninja -B ./build -DQT_ANDROID_ABIS="armeabi-v7a;arm64-v8a"; \
           cmake --build ./build'

Or to build all the available ABIs use -DQT_ANDROID_BUILD_ALL_ABIS=ON.

WebAssembly emsdk:

In the project directory run:

$ docker run -it --rm -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.3-wasm-aqt \
    sh -c 'qt-cmake ./src -G Ninja -B ./build; cmake --build ./build'

You can run it with python3 -m http.server in the build directory - at least widgets sample is running well.

Windows MinGW (wine):

In the project directory run:

$ docker run -it --rm -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.3-mingw-aqt \
    sh -c 'qt-cmake ./src -G Ninja -B ./build; cmake --build ./build;
           windeployqt --qmldir ./src --dir build/deploy --libdir build/deploy/libs --plugindir build/deploy/plugins build/*.exe'

You can use your own applications, but know that by default there is no wine32 so you can run only 64 bit apps or install wine32 if you really need it.

MacOSX clang (osxcross):

In the project directory run:

$ docker run -it --rm -v "${PWD}:/home/user/project:ro" stateoftheartio/qt6:6.3-macos-aqt \
    sh -c 'qt-cmake ./project -G Ninja -B ./build; cmake --build ./build;
           macdeployqt ./build/*.app -verbose=1 -dmg -qmldir=./project'

Uses osxcross project, which actually can be built with apple clang to support arm64e. But for now it uses the regular ubuntu clang.

You can use BUILD_ARCH=aarch64 or BUILD_ARCH=x86_64 (default) during run of qt-cmake to produce binaries for specific architecture.

The macdeployqt application is not completely functional:

  • The -dmg option uses hdiutil which was substituted poorly by shell script, which is using genisoimage - and creates ISO, which somehow is useful.
  • There is no codesign app, could be probably ported from the sources

Releases

No releases published

Packages

No packages published

Languages

  • Shell 74.7%
  • Dockerfile 21.2%
  • C++ 2.2%
  • CMake 1.8%
  • QML 0.1%