Qt crosscompilation for Windows in Linux
Taken from http://habrahabr.ru/blogs/qt_software/98131/.
Requirements:
- Qt SDK for Linux and Qt SDK for Windows must be installed.
- GCC/G++ (usually it comes installed along with a distro).
- Compiler i586-mingw32msvc-gcc/i586-mingw32msvc-g++ (can be found in repository for your distro).
In order to make crosscompilation possible one must create new spec for it. To make this task a bit easier it is more convinient to copy an existing one, for example, win32-g++
(here and further $QT_WIN
points to Qt SDK for Windows installation path and $QT_LINUX
- to Qt SDK for Linux):
Next, some changes must be done in win32-x-g++/qmake.conf:
Building project now is easy. All that should be done is setting of QMAKESPEC environment variable. This variable is checked by qmake on the startup. Unsetting it will return Qt spec target to the Linux one (that is, system’s default).