Another optimization for overall speed is to use compiler optimizations when compiling Qt, but you need to edit some files. When you get Qt from Git, you will get qtbase / dir. First you run the configure script that qmake creates
Note: you can change Makefile.win32 or Makefile.unix and add lines, for example:
QMAKE_CXXFLAGS_RELEASE = -CompilerDependentOptimizerSwitches
if you want qmake to be optimized, but I don’t think it is really necessary, given that qmake runtime can be 0.0000001% of the total compilation time for a medium-sized application.
But real optimization arises when editing mkspecs, which are used to build Qt.
For example, in windows with VS2012, you will most likely change qtbase/mkspecs/win32-msvc2012/qmake.conf .
Ex .: default is Qt5.1, msvc2012 mkspec reads:
QMAKE_CFLAGS_RELEASE = -O2 -MD QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
Since you want to optimize the size, you can replace it with:
QMAKE_CFLAGS_RELEASE = -O1 -MD
(According to http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx )
Sometimes it includes the higher level mkspecs found in qtbase/mkspecs/common/ dir.
I successfully compiled Qt5.1 on Debian / g ++ 4.8.1 with -O3 -march=native (default is -O2 ) if it serves anyone.
After that, just run make in the root of Qt git and go to your team with beer, because even on a good computer it will take an age (about 2 hours on i7, without creating demos / examples, but with webkit).