There is a nice repository on build.opensuse.org which provides some
useful packages to cross compile from linux, and I’m going to describe a
simple setup using cmake and Qt:
First install openSUSE 12.1 into a virtual machine (unless you want to
do it on a real machine).
Then add the extra repositories and install the needed packages (as
root):
zypper ar https://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_12.1/windows:mingw:win32.repozypper install mingw32-cross-gcc mingw32-cross-gcc-c++ mingw32-libjpeg-devel mingw32-libpng-devel mingw32-libqt4 mingw32-libqt4-devel mingw32-libtiff-devel mingw32-zlib-develzypper ar https://download.opensuse.org/repositories/devel:/tools:/building/openSUSE_12.1/devel:tools:building.repozypper install cmake-2.8.7 binutils git
The second repository is needed for an updated cmake-2.8.7 which
includes
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ddb1e5b9a3eff941ad12d29609839871fe518ed
binutils includes “strings” which is needed in one of the scripts
below.
Then login with your normal user, and prepare the cmake toolchain file:
Now checkout your favorite project which uses cmake+qt and build it with
cmake in a subdirectory:
git clone -b stefan-wip https://git.stbuehler.de/stbuehler/qcross.gitcd qcrossmkdir winbuildcd winbuildcmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain-windows.cmake ..make````The resulting binaries will need some DLLs; with the two scripts below(`chmod +x`)they should be easy to install into a directory:```console$ installapp~/qcross/winbuild~/app/qcross
Now all the needed files should be in ~/app/qcross.