mingw-based build environment based on arch-linux. The image provides an easy to use cross-compilation for windows target. It is also CI-friendly. mingw- versions of Qt5, cmake, Eigen3, boost are included. Dosens of other libraries are available from the package manager.
Start the docker container:
sudo docker run -it burningdaylight/mingw-arch:qt /bin/bash
Compile your application (QNapi is used as an example here):
git clone --recursive 'https://github.com/QNapi/qnapi.git'
cd qnapi/
x86_64-w64-mingw32-qmake-qt5
make
Or for CMake:
x86_64-w64-mingw32-cmake ..
To deploy the program, you will need to copy the dlls from /usr/{x86_64-w64-mingw32,i686-w64-mingw32}/{bin,lib/qt/plugins/{imageformats,iconengines,platforms}}
(for x64 and x32 builds respectively) to the directory with the .exe file. The list of necessary dlls may vary. If a dll is missing, Windows will usually show an error popup window with the name of the missing dll, when you try to start the program.
That's it!
For Gitlab CI the config file could look something like this:
build-win64:
stage: compile
image: burningdaylight/mingw-arch:qt
script:
- mkdir -p ${CI_BUILD_NAME}
- cd ${CI_BUILD_NAME}; x86_64-w64-mingw32-qmake-qt5 ..; make
artifacts:
paths:
- "${CI_BUILD_NAME}/src/*/release/*.exe"
- "${CI_BUILD_NAME}/src/*/release/*.dll"
You can also check out the a full .gitlab-ci.yml file.
If you need some other dependencies, you can install them from AUR.
yay -S --noconfirm mingw-w64-rapidjson
If mingw- version of the needed libarary is not available in AUR, you can add it yourself. The process is really straightforward. You would need to write a PKBUILD file, which is as intuitive as it can get, see mingw-w64-rapidjson, for example.
base
minimal cross-compilation environment which includesyay
to install additional libraries from AUR and a small set of mingw-w64- packages:cmake
,gcc
,zlib
latest
,qt
full-blown cross-compilation environment, which includesQt5
,boost
,openssl
, etc.