English Български

Compile Qt Faster by Skipping Examples

Compiling Qt is fairly straight-forward, but quite a lengthy process.

To make it much quicker, an easy way is to prevent examples from being compiled.

One way of doing it is:

  • extract source sdk (or git clone it)
  • start configure with option “dont-process” (works only on windows, doesn’t seem to exist on Linux configure)
    1. configure -openssl -qt-libjpeg -qt-gif -qt-zlib -webkit -phonon -no-plugin-manifests -plugin-sql-sqlite -opensource -debug-and-release -confirm-license -dont-process
  • then launch explicitely newly created qmake to build only libs and tools
    1. %QTDIR%/qmake/qmake -r QT_BUILD_PARTS="libs tools"
  • Compile generated makefile
    1. nmake

Compilation time is improved by around 80% (approximately 100 minutes instead of 8 hours) and you end up with a perfectly usable Qt, in debug and release.

On Linux configure and build can be accelerated by using all available cores.

  1. export MAKEFLAGS=-j4
  2. configure -AllTheOptionsYouNeed
  3. make -j4

Note that compilation place is hardcoded inside qmake and used to find QMAKESPECs. You can however change it later using

  1. qmake -query
  2. lists all available variable (mostly paths)
  3. qmake -set
  4. overrides previously hardcoded value

Categories: