nav-left cat-right
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.

wwWidgets

The current release has a wwwidgets.pro 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 common.pro 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 widgetgallery.pro

FORMS += gallery.ui
TEMPLATE = app
CONFIG += wwwidgets
SOURCES += main.cpp
 
include(../common.pri)

qwtPlot3D

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.

qwtplot3d.pro

-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)
+}

examples/common.pro

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

src/qwt3d_function.cpp

+#include <stdio.h>

Qwt

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

QextSerialPort

Usual changes for the pro files, here qextserialport.pro. 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 QESPTA.pro is missing correct config and library path specification

+CONFIG           += release     
+CONFIG           -= debug     
-LIBS          += -lqextserialport
+LIBS          += -lqextserialport -L../../
examples/qespta/MessageWindow.h

+#include <stdio.h>

QCodeEdit

Removed the following line from qcodeedit.pro, because it is never used anyway
CONFIG += debug
I changed the deploy configuration in lib.pro
-DESTDIR = ..
-CONFIG += debug
+win32{
+    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, example.pro

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

and equivalent in designer-plugin.pro

Qxt

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.