Cross compiling from MinGW on Fedora 12 to Windows - console window?
- by elcuco
After reading this article http://lukast.mediablog.sk/log/?p=155 I decided to use mingw on linux to compile windows applications. This means I can compile, test, debug and release directly from Linux.
I hacked this build script which will cross compile the application and even package it in a ZIP file. Note that I am using out of source builds for QMake (did you even know this is supported? wow...). Also note that the script will pull the needed DLLs automagically. Here is the script for you all internets to use and abuse:
#! /bin/sh
set -x
set -e
VERSION=0.1
PRO_FILE=blabla.pro
BUILD_DIR=mingw_build
DIST_DIR=blabla-$VERSION-win32
# clean up old shite
rm -fr $BUILD_DIR
mkdir $BUILD_DIR
cd $BUILD_DIR
# start building
QMAKESPEC=fedora-win32-cross qmake-qt4 QT_LIBINFIX=4 config=\"release\ quiet\" ../$PRO_FILE
#qmake-qt4 -spec fedora-win32-cross
make
DLLS=`i686-pc-mingw32-objdump -p release/*.exe | grep dll | awk '{print $3}'`
for i in $DLLS mingwm10.dll ; do
f=/usr/i686-pc-mingw32/sys-root/mingw/bin/$i
if [ ! -f $f ]; then continue; fi
cp -av $f release
done
mkdir -p $DIST_DIR
mv release/*.exe $DIST_DIR
mv release/*.dll $DIST_DIR
zip -r ../$DIST_DIR.zip $DIST_DIR
The compiled binary works on the Windows7 machine I tested. Now to the questions:
When I execute the application on Windows, the theme is not the Windows7 theme. I assume I am missing a style module, I am not really sure yet.
The application gets a console window for some reason.
The second point (the console window) is critical. How can I remove this background window? Please note that the extra config lines are not working for me, what am I missing there?