Coder Social home page Coder Social logo

buildqt's Introduction

BuildQt - docker environment to build Qt Apps

Ready-to-use Qt cross-compile environment in Docker/GitLab-CI

The project can be used as a set of images for Qt apps building in GitLab environment. Based on mxe.cc project.

Files

  • Dockerfile - for building basic image with MXE sources and dependencies (tag: qtdeps)
  • Dockerfile.win64s - for building image Windows 64bit Cross-compiled Statically Linked based on qtdeps (tag: win64s)
  • Dockerfile.win64d - for building image Windows 64bit Cross-compiled Dynamically Linked based on qtdeps (tag: win64d)
  • .gitlab-ci.yml - YAML-file to define GitLab-CI pipelines for images building (all stages by default set to manual because MXE Qt building is time-consuming procedure, use it carefully).

How to use

  • Step 0: Create new project buildqt in GitLab for Qt images building and place this project files into it.
  • Step 1: Use manual action in buildqt pipeline to build qtdeps image and be sure that it is successfully built, tagged and placed into GitLab Container Registry.
  • Step 2: Build based on qtdeps next one docker image (win64d or win64s) to prepare Qt build environment. Check the GitLab Container Registry and be sure that image is successfully placed to it and tagged.
  • Step 3: If you don't have qmake/cmake deploy settings inside of your Qt App, place script redist_win64d.sh in the root of your Qt App repository and correct it. The redist shell script places app (EXE) and dependencies (DLLs) from container to project artifacts folder /build.
  • Step 4: Use the proper build image (win64d or win64s) in your Qt App GitLab-repository for building, results will be placed in pipeline' artifacts archive.

Example of .gitlab-ci.yml file of Qt App repository (Windows 64bit Cross-compiled Dynamically Linked):

build:
  stage: build
  image: docker:19
  variables:
    GIT_SUBMODULE_STRATEGY: recursive
  services: 
    - docker:19-dind
  script:
    - docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
    - docker run -v $(pwd):/src -v $(pwd)/build:/build -w /src $CI_REGISTRY/place project group here/buildqt/buildqt:win64d /bin/bash -c "cd /src && qmake YourApp.pro && make release -j $(nproc) && chmod +x ./redist_win64d.sh && ./redist_win64d.sh"
  artifacts:
    name: "$CI_BUILD_REF_NAME-$CI_COMMIT_SHORT_SHA"
    paths:
      - build
    expire_in: 1 week
  tags:
    - shared
    - docker

Example of redist_win64d.sh script of Qt App repository:

CWD=${PWD}
mkdir ${CWD}/build/plugins
mkdir ${CWD}/build/plugins/platforms
cp /opt/mxe/usr/x86_64-w64-mingw32.shared/qt6/plugins/platforms/qwindows.dll ${CWD}/build/plugins/platforms/
cp ${CWD}/app/release/YourApp.exe ${CWD}/build/
cd /opt/mxe/usr/x86_64-w64-mingw32.shared/bin
cp icudt66.dll icuin66.dll icuuc66.dll libbz2.dll libfreetype-6.dll libgcc_s_seh-1.dll libglib-2.0-0.dll libharfbuzz-0.dll libiconv-2.dll libintl-8.dll  libpcre-1.dll libpcre2-16-0.dll libpng16-16.dll libstdc++-6.dll libwinpthread-1.dll libzstd.dll zlib1.dll ${CWD}/build/
cp -r /opt/mxe/usr/x86_64-w64-mingw32.shared/qt6/plugins/imageformats ${CWD}/build/plugins/
cd /opt/mxe/usr/x86_64-w64-mingw32.shared/qt6/bin
cp Qt6Core.dll Qt6Gui.dll Qt6Network.dll Qt6Widgets.dll ${CWD}/build/

buildqt's People

Contributors

shtirlitz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.