nav-left cat-right
Matthias Pospiech > Programming > C++ > Qt > fixes for Qt plugin makefiles

fixes for Qt plugin makefiles

There are many usefull Qt plugins, such as qwt, qextserialport, qxt and others. With a new major version of Qt, or a new version of a compiler I have to recompile the plugins to make sure everything is working well together. However many plugins are not compilable from comandline such that the resulting files can easily be deployed. Also they should be compilable with mingw and msvc.

Here I show the necessary modifications to enable compilation of everything necessary in a naming scheme for windows.


The current release has a file error that needs to be fixed otherwise compilation fails:

-unix:TARGET = $$join(TARGET,,,d)
+win32:TARGET = $$join(TARGET,,,d)

apart from that it contains the necessary steps to build debug and release and name them different

CONFIG += debug_and_release
CONFIG += build_all

Unfortunately the examples can only be compiled after system wide installation of the library. This can be fixed by adding a file with the content

INCLUDEPATH += ../../../../../include/qt/wwwidgets \
CONFIG += release
CONFIG -= debug
LIBS += -lwwwidgets4 -L../../widgets/release

Please note that here all header files were manually moved to .../include/qt/wwwidgets

This common.pri is then called in every pro file of the examples, here

FORMS += gallery.ui
CONFIG += wwwidgets
SOURCES += main.cpp


This library has many problems. Its qmake files are only designed for msvc and the code does not compile. Additionally it can not be used to build debug and release builds.

-CONFIG           += qt warn_on opengl thread zlib debug
+CONFIG           += qt warn_on opengl thread zlib
+CONFIG           += debug_and_release
+CONFIG           += build_all
-win32:TEMPLATE    = vclib
+win32:TEMPLATE    = lib
+CONFIG(debug, debug|release) {
+  win32:TARGET = $$join(TARGET,,,d)


-CONFIG      += qt warn_on thread debug
+CONFIG      += qt warn_on thread release
+CONFIG      -= debug
-  LIBS += ../../lib/qwtplot3d.lib
+  LIBS += -lqwtplot3d -L../../lib
-  TEMPLATE  = vcapp
+  TEMPLATE  = app


+#include <stdio.h>


Here only the following needs to be enabled in qwtconfig.pri
CONFIG += debug_and_release
CONFIG += build_all

With Qt 4.6.x is does not compile. To fix this the following needs to be changed in qwt_valuelist.h. See this for discussion of the problem.

-#if defined(QWT_TEMPLATEDLL)
-#if QT_VERSION < 0x040300
+#if defined(QWT_TEMPLATEDLL) && QT_VERSION < 0x040600
+#if QT_VERSION == 0x040600


Usual changes for the pro files, here The examples project however has no chance to compile without the changes. Remove:

CONFIG                 -= debug_and_release
#CONFIG                 += debug
CONFIG                 += release

and replace by

CONFIG                 += debug_and_release
CONFIG           	   += build_all

also adding at the end

CONFIG(debug, debug|release) {
  win32:TARGET = $$join(TARGET,,,d)

The examples file is missing correct config and library path specification

+CONFIG           += release     
+CONFIG           -= debug     
-LIBS          += -lqextserialport
+LIBS          += -lqextserialport -L../../

+#include <stdio.h>


Removed the following line from, because it is never used anyway
CONFIG += debug
I changed the deploy configuration in
-CONFIG += debug
+    CONFIG           += debug_and_release
+    CONFIG           += build_all
+    debug:DESTDIR = ../deploy/lib/debug
+    release:DESTDIR = ../deploy/lib/release
+} else {
+    DESTDIR = ..

this required similar changes in further files,

-CONFIG += debug console
+CONFIG += release
+CONFIG -= debug
-LIBS += -L.. -lqcodeedit
+	debug:LIBS += -L../deploy/lib/debug -lqcodeedit
+	release:LIBS += -L../deploy/lib/release -lqcodeedit
+} else {
+	LIBS += -L.. -lqcodeedit

and equivalent in


required no changes at all.

Einen Kommentar schreiben

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.


This blog is kept spam free by WP-SpamFree.