Jenkins: Qt5 and CrossCompilation for Windows

Installing MXE

cd /opt
git clone https://github.com/mxe/mxe.git
cd mxe
make qt5 MXE_TARGETS=i686-w64-mingw32.static
# or .shared but I have only used static now

Configuring the Build step in Jenkins

Build steps
# Env variables
export target=i686-w64-mingw32.static
export mxedir=/opt/mxe/
export releasedir=$PWD/$JOB_NAME.$BUILD_ID/
export PATH=$mxedir/usr/bin:$PATH
# Build
sed -i "s/^#DEFINES/DEFINES/" cutecw.pro
$mxedir/usr/bin/$target-qmake-qt5 cutecw.pro
make
# Creating release dir and copying assets
mkdir -p $releasedir
cp release/cutecw.exe $releasedir/
cp -r books $releasedir/
cp -r icons $releasedir/
cp LICENSE $releasedir/LICENSE.txt
cp *.qm $releasedir/
cp cutecw.cfg.sample $releasedir/cutecw.cfg
# Build info
echo "Build infos" > $releasedir/BUILD.txt
echo "Built with MXE [git:master] and qt5 with target $target" >> $releasedir/BUILD.txt
echo "Jenkins build: $BUILD_TAG" >> $releasedir/BUILD.txt
echo "Build ID $BUILD_ID: " >> $releasedir/BUILD.txt
# Create a zip archive 
zip -r $JOB_NAME.$BUILD_ID.zip $JOB_NAME.$BUILD_ID/
# Creating checksums
md5sum $JOB_NAME.$BUILD_ID.zip > $JOB_NAME.$BUILD_ID.sums
sha256sum $JOB_NAME.$BUILD_ID.zip >> $JOB_NAME.$BUILD_ID.sums
Archivate artifacts
cutecw.zip, cutecw.sums

I have also used the Copy Artifacts over SSH plugin to copy the archive and checksums over the public repository.