[gegl-qt] Qt5: Make QtQuick1/QtWidget dependent code optional
- From: Jon Nordby <jonnor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl-qt] Qt5: Make QtQuick1/QtWidget dependent code optional
- Date: Sun, 11 Mar 2012 18:20:44 +0000 (UTC)
commit 931a931c716e463be2bb659729ced0eeeb3810ed
Author: Jon Nordby <jononor gmail com>
Date: Sun Mar 11 17:22:21 2012 +0100
Qt5: Make QtQuick1/QtWidget dependent code optional
Note that without any of these, the library can currently
not do anything useful at all.
config.pri | 26 +++++++++
examples/display-operation/display-operation.pro | 10 ++--
examples/examples-common.pri | 5 +-
examples/examples.pro | 20 ++++--
gegl-qt.pro | 5 +-
gegl-qt/GeglQtWidgets | 1 +
gegl-qt/gegl-qt-widgets.h | 7 ++
gegl-qt/gegl-qt.h | 2 +
gegl-qt/gegl-qt.pro | 59 ++++++++++++++------
operations/operations.pro | 3 +
plugins/plugins.pro | 4 +-
plugins/qml-plugin/qml-plugin.pro | 10 +++-
.../test-nodeviewimplementation.pro | 2 +-
tests/tests.pro | 8 ++-
14 files changed, 127 insertions(+), 35 deletions(-)
---
diff --git a/config.pri b/config.pri
index f4a2cee..f06e6bf 100644
--- a/config.pri
+++ b/config.pri
@@ -82,6 +82,12 @@ HAVE_PYSIDE = yes
HAVE_PYSIDE = no
}
+# Can go away when PySide supports Qt5
+contains(QT_MAJOR_VERSION, 5) {
+ !build_pass:system(echo "PySide not supported with Qt 5 - no Python support")
+ HAVE_PYSIDE = no
+}
+
HAVE_DOXYGEN = yes
DOXYGEN = $$system(which doxygen)
isEmpty(DOXYGEN){
@@ -96,6 +102,26 @@ isEmpty(PDFLATEX){
HAVE_PDFLATEX = no
}
+# QtWidgets
+HAVE_QT_WIDGETS = yes
+contains(QT_MAJOR_VERSION, 5) {
+ !system(pkg-config QtWidgets) {
+ HAVE_QT_WIDGETS = no
+ }
+} else {
+ # Qt4 always has QtWidgets
+}
+
+!contains(HAVE_QT_WIDGETS, yes) {
+ !build_pass:system(echo "QtWidgets not found - no QtWidgets support")
+}
+
+# On Qt5, widgets is required in addition to gui for "QT" option
+# On Qt4, it should be empty
+contains(QT_MAJOR_VERSION, 5) {
+ QT_WIDGETS = widgets
+}
+
GEGLQT_INSTALL_BIN = $$GEGLQT_INSTALL_PREFIX/bin
GEGLQT_INSTALL_HEADERS = $$GEGLQT_INSTALL_PREFIX/include
GEGLQT_INSTALL_LIBS = $$GEGLQT_INSTALL_PREFIX/lib
diff --git a/examples/display-operation/display-operation.pro b/examples/display-operation/display-operation.pro
index aafc229..a757a3a 100644
--- a/examples/display-operation/display-operation.pro
+++ b/examples/display-operation/display-operation.pro
@@ -1,11 +1,11 @@
-SOURCES += display-operation.cpp
+include(../../config.pri)
QT += core gui
+contains(HAVE_QT_WIDGETS, yes) {
+ QT += $$QT_WIDGETS
+}
-CONFIG += qt
-
-OBJECTS_DIR = .obj
-MOC_DIR = .moc
+SOURCES += display-operation.cpp
# Does not link against gegl-qt as it is not used directly
CONFIG += link_pkgconfig
diff --git a/examples/examples-common.pri b/examples/examples-common.pri
index f87feac..59611e1 100644
--- a/examples/examples-common.pri
+++ b/examples/examples-common.pri
@@ -3,7 +3,10 @@ isEmpty(GEGLQT_CONFIG):error("config.pri not found")
QT += core gui
contains(HAVE_QT_DECLARATIVE, yes) {
- QT += declarative
+ QT += $$QT_DECLARATIVE
+}
+contains(HAVE_QT_WIDGETS, yes) {
+ QT += $$QT_WIDGETS
}
CONFIG += qt
diff --git a/examples/examples.pro b/examples/examples.pro
index 0c8ab3e..633a852 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -3,14 +3,20 @@ include(../config.pri)
TEMPLATE = subdirs
SUBDIRS = \
- qwidget-basic \
- qgv-basic \
- qwidget-transformations \
- qwidget-autotransform \
- display-operation \
-# Examples that depend on Qt Declarative (optional)
-contains(HAVE_QT_DECLARATIVE, yes) {
+# Examples that depend on Qt Widgets (optional)
+contains(HAVE_QT_WIDGETS, yes) {
+ SUBDIRS += \
+ qwidget-basic \
+ qgv-basic \
+ qwidget-transformations \
+ qwidget-autotransform \
+ display-operation \
+
+}
+
+# Examples that depend on Qt Quick1(optional)
+contains(HAVE_QT_QUICK1, yes) {
SUBDIRS += \
qml-basic \
qml-paint \
diff --git a/gegl-qt.pro b/gegl-qt.pro
index 2123b6d..3ca316a 100644
--- a/gegl-qt.pro
+++ b/gegl-qt.pro
@@ -10,7 +10,10 @@ isEmpty(USE_EXTERNAL_GEGLQT) {
contains(HAVE_PYSIDE, yes) {
SUBDIRS += pygegl-qt
}
- SUBDIRS += operations plugins doc
+ contains(HAVE_QT_WIDGETS, yes) {
+ SUBDIRS += operations
+ }
+ SUBDIRS += plugins doc
} else {
!system(pkg-config --exists $$GEGLQT_LIBNAME):error("Could not find required dependency: GEGL-QT")
diff --git a/gegl-qt/GeglQtWidgets b/gegl-qt/GeglQtWidgets
new file mode 100644
index 0000000..70644ff
--- /dev/null
+++ b/gegl-qt/GeglQtWidgets
@@ -0,0 +1 @@
+#include <gegl-qt-widgets.h>
diff --git a/gegl-qt/gegl-qt-widgets.h b/gegl-qt/gegl-qt-widgets.h
new file mode 100644
index 0000000..f00b6ee
--- /dev/null
+++ b/gegl-qt/gegl-qt-widgets.h
@@ -0,0 +1,7 @@
+#ifndef GEGLQTWIDGETS_H
+#define GEGLQTWIDGETS_H
+
+#include <gegl-qt/nodeviewwidget.h>
+#include <gegl-qt/nodeviewgraphicswidget.h>
+
+#endif // GEGLQTWIDGETS_H
diff --git a/gegl-qt/gegl-qt.h b/gegl-qt/gegl-qt.h
index 5fc3e07..facf100 100644
--- a/gegl-qt/gegl-qt.h
+++ b/gegl-qt/gegl-qt.h
@@ -40,6 +40,8 @@
// Node Views
#include <gegl-qt/nodeviewoptions.h>
+// Code requiring QtWidgets
+// FIXME: don't include when not build with widgets
#include <gegl-qt/nodeviewwidget.h>
#include <gegl-qt/nodeviewgraphicswidget.h>
diff --git a/gegl-qt/gegl-qt.pro b/gegl-qt/gegl-qt.pro
index 8feaf84..39717cc 100644
--- a/gegl-qt/gegl-qt.pro
+++ b/gegl-qt/gegl-qt.pro
@@ -9,7 +9,10 @@ VERSION = $$GEGLQT_VERSION
QT += core gui
contains(HAVE_QT_DECLARATIVE, yes) {
- QT += declarative
+ QT += $$QT_DECLARATIVE
+}
+contains(HAVE_QT_WIDGETS, yes) {
+ QT += $$QT_WIDGETS
}
CONFIG += link_pkgconfig
@@ -19,31 +22,53 @@ OBJECTS_DIR = .obj
MOC_DIR = .moc
PUBLIC_SOURCES += \
- nodeviewwidget.cpp \
- nodeviewgraphicswidget.cpp \
nodeviewoptions.cpp \
+PUBLIC_HEADERS += \
+ nodeviewoptions.h \
+
TOP_HEADERS += gegl-qt.h GeglQt
-PUBLIC_HEADERS = \
- nodeviewwidget.h \
- nodeviewgraphicswidget.h \
- nodeviewoptions.h \
+#PRIVATE_HEADERS += \
+
+#PRIVATE_SOURCES += \
+
+contains(HAVE_QT_WIDGETS, yes) {
+ PUBLIC_SOURCES += \
+ nodeviewwidget.cpp \
+ nodeviewgraphicswidget.cpp \
+
+ PUBLIC_HEADERS += \
+ nodeviewwidget.h \
+ nodeviewgraphicswidget.h \
+
+ # FIXME: remove QtWidgets dependency from NodeViewImplementation
+ PRIVATE_HEADERS += \
+ internal/nodeviewimplementation.h \
+ internal/nodeviewchilditem.h \
+
+ PRIVATE_SOURCES += \
+ internal/nodeviewimplementation.cpp \
+ internal/nodeviewchilditem.cpp \
+
+ TOP_HEADERS += gegl-qt-widgets.h GeglQtWidgets
+}
# Code that depends on Qt Declarative (optional)
contains(HAVE_QT_DECLARATIVE, yes) {
- PUBLIC_HEADERS += nodeviewdeclarativeitem.h
- PUBLIC_SOURCES += nodeviewdeclarativeitem.cpp
- TOP_HEADERS += gegl-qt-declarative.h GeglQtDeclarative
-}
-PRIVATE_HEADERS = \
- internal/nodeviewimplementation.h \
- internal/nodeviewchilditem.h \
+ contains(QT_MAJOR_VERSION, 5) {
+ #PUBLIC_HEADERS +=
+ #PUBLIC_SOURCES +=
+ }
+
+ contains(HAVE_QTQUICK1, yes) {
+ PUBLIC_HEADERS += nodeviewdeclarativeitem.h
+ PUBLIC_SOURCES += nodeviewdeclarativeitem.cpp
+ }
-PRIVATE_SOURCES = \
- internal/nodeviewimplementation.cpp \
- internal/nodeviewchilditem.cpp \
+ TOP_HEADERS += gegl-qt-declarative.h GeglQtDeclarative
+}
SOURCES += $$PUBLIC_SOURCES $$PRIVATE_SOURCES
diff --git a/operations/operations.pro b/operations/operations.pro
index edce86d..1462e38 100644
--- a/operations/operations.pro
+++ b/operations/operations.pro
@@ -9,6 +9,9 @@ CONFIG += qt no_keywords plugin
VERSION = $$GEGLQT_VERSION
QT += core gui
+contains(HAVE_QT_WIDGETS, yes) {
+ QT += $$QT_WIDGETS
+}
CONFIG += link_pkgconfig
PKGCONFIG += gegl
diff --git a/plugins/plugins.pro b/plugins/plugins.pro
index 6d9a667..12460bb 100644
--- a/plugins/plugins.pro
+++ b/plugins/plugins.pro
@@ -1,6 +1,8 @@
include(../config.pri)
TEMPLATE = subdirs
-contains(HAVE_QT_DECLARATIVE, yes) {
+
+# Currently don't have anything to register for non-quick1 case, so no bother building
+contains(HAVE_QT_QUICK1, yes) {
SUBDIRS += qml-plugin
}
diff --git a/plugins/qml-plugin/qml-plugin.pro b/plugins/qml-plugin/qml-plugin.pro
index 1bfe618..041676c 100644
--- a/plugins/qml-plugin/qml-plugin.pro
+++ b/plugins/qml-plugin/qml-plugin.pro
@@ -2,7 +2,15 @@ include(../../config.pri)
TEMPLATE = lib
CONFIG += qt plugin no_keywords
-QT += declarative
+
+contains(HAVE_QT_WIDGETS, yes) {
+ QT += $$QT_WIDGETS
+}
+
+contains(HAVE_QT_DECLARATIVE, yes) {
+ QT += $$QT_DECLARATIVE
+}
+
TARGET = $$GEGLQT_QML_API_NAME/$$GEGLQT_LIBNAME
target.path = $$[QT_INSTALL_IMPORTS]/$$GEGLQT_QML_API_NAME
diff --git a/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro b/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro
index 012bf7c..ef5753e 100644
--- a/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro
+++ b/tests/test-nodeviewimplementation/test-nodeviewimplementation.pro
@@ -1,7 +1,7 @@
include(../../config.pri)
include(../tests-common.pri)
-QT += gui
+QT += gui $$QT_WIDGETS
SOURCES += test-nodeviewimplementation.cpp
HEADERS += test-nodeviewimplementation.h
diff --git a/tests/tests.pro b/tests/tests.pro
index 35603be..6c162f1 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -1,3 +1,9 @@
TEMPLATE = subdirs
+
SUBDIRS += \
- test-nodeviewimplementation
+
+contains(HAVE_QT_WIDGETS, yes) {
+ SUBDIRS += \
+ test-nodeviewimplementation \
+
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]