[gegl-qt] Build: Fix build with GEGL 0.2.0+



commit cc20b829c9170d607e386cf2dc542b6ed262e521
Author: Jon Nordby <jononor gmail com>
Date:   Thu Apr 12 22:24:01 2012 +0200

    Build: Fix build with GEGL 0.2.0+
    
    Try first to look for gegl-0.2, fallback to gegl (0.1) if not existing.
    Adapt to change in metadata handling in operations.
    Also fix parallel install of display operations for Qt4 vs Qt5 builds.

 config.pri                                       |   24 ++++++++++++++++++++++
 examples/common/common.pro                       |    2 +-
 examples/display-operation/display-operation.pro |    2 +-
 examples/examples-common.pri                     |    2 +-
 examples/examples.pro                            |    1 +
 gegl-qt.pro                                      |    4 ---
 gegl-qt/gegl-qt.pro                              |    4 +-
 gegl-qt/gegl-qt4-0.1.pc.in                       |    2 +-
 gegl-qt/gegl-qt5-0.1.pc.in                       |    2 +-
 operations/geglqtdisplay.cpp                     |   10 ++++++++-
 operations/operations.pro                        |    7 ++++-
 plugins/qml-plugin/qml-plugin.pro                |    2 +-
 tests/tests-common.pri                           |    2 +-
 13 files changed, 48 insertions(+), 16 deletions(-)
---
diff --git a/config.pri b/config.pri
index f06e6bf..3fe15aa 100644
--- a/config.pri
+++ b/config.pri
@@ -17,6 +17,29 @@ GEGLQT_QML_API_VERSION = 0.1
 OBJECTS_DIR = .obj
 MOC_DIR = .moc
 
+### Hard dependencies ###
+
+# GEGL
+HAVE_GEGL = no
+GEGL_PKG = ""
+
+contains(HAVE_GEGL, no) {
+    system(pkg-config --exists gegl-0.2) {
+        HAVE_GEGL = 0.2
+        GEGL_PKG = gegl-0.2
+    }
+}
+
+contains(HAVE_GEGL, no) {
+    system(pkg-config --exists gegl) {
+        HAVE_GEGL = 0.1
+        GEGL_PKG = gegl
+    }
+}
+
+contains(HAVE_GEGL, no):error("Could not find required dependency: GEGL")
+
+### Options ###
 # Can be used to specify custom install prefix
 isEmpty(GEGLQT_INSTALL_PREFIX) {
     GEGLQT_INSTALL_PREFIX = /usr
@@ -151,6 +174,7 @@ SUBST_VARIABLES += \
     GEGLQT_PROJECTBRIEF \
     GEGLQT_PROJECTNAME \
     GEGLQT_IN_PWD \
+    GEGL_PKG \
 
 # Generate the specified file from its .in template, and substitute variables
 # Variables to be substituted in .in files must be of the form @VARIABLE_NAME@
diff --git a/examples/common/common.pro b/examples/common/common.pro
index a630905..767d8f4 100644
--- a/examples/common/common.pro
+++ b/examples/common/common.pro
@@ -9,4 +9,4 @@ SOURCES += paint-engine.cpp
 HEADERS += paint-engine.h
 
 CONFIG += link_pkgconfig
-PKGCONFIG += gegl
+PKGCONFIG += $$GEGL_PKG
diff --git a/examples/display-operation/display-operation.pro b/examples/display-operation/display-operation.pro
index a757a3a..8ad6cf2 100644
--- a/examples/display-operation/display-operation.pro
+++ b/examples/display-operation/display-operation.pro
@@ -9,4 +9,4 @@ SOURCES += display-operation.cpp
 
 # Does not link against gegl-qt as it is not used directly
 CONFIG += link_pkgconfig
-PKGCONFIG += gegl
+PKGCONFIG += $$GEGL_PKG
diff --git a/examples/examples-common.pri b/examples/examples-common.pri
index 682a6d7..21ee5a6 100644
--- a/examples/examples-common.pri
+++ b/examples/examples-common.pri
@@ -25,4 +25,4 @@ isEmpty(USE_EXTERNAL_GEGLQT) {
 LIBS += ../../examples/common/lib$$GEGLQT_LIBNAME-examples-common.a
 
 CONFIG += link_pkgconfig
-PKGCONFIG += gegl
+PKGCONFIG += $$GEGL_PKG
diff --git a/examples/examples.pro b/examples/examples.pro
index bd2f50b..f5324e8 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -2,6 +2,7 @@ include(../config.pri)
 # TODO: install examples
 
 TEMPLATE = subdirs
+CONFIG += ordered
 SUBDIRS += \
     common \
 
diff --git a/gegl-qt.pro b/gegl-qt.pro
index 3ca316a..b9771a2 100644
--- a/gegl-qt.pro
+++ b/gegl-qt.pro
@@ -20,10 +20,6 @@ isEmpty(USE_EXTERNAL_GEGLQT) {
 }
 SUBDIRS += examples tests
 
-# Check hard deps
-!system(pkg-config --exists gegl):error("Could not find required dependency: GEGL")
-
-
 ### Extra targets for distribution ###
 
 DIST_NAME = $$GEGLQT_PROJECTNAME-$$GEGLQT_VERSION
diff --git a/gegl-qt/gegl-qt.pro b/gegl-qt/gegl-qt.pro
index 39717cc..6f88fb9 100644
--- a/gegl-qt/gegl-qt.pro
+++ b/gegl-qt/gegl-qt.pro
@@ -16,7 +16,7 @@ contains(HAVE_QT_WIDGETS, yes) {
 }
 
 CONFIG += link_pkgconfig
-PKGCONFIG += gegl
+PKGCONFIG += $$GEGL_PKG
 
 OBJECTS_DIR = .obj
 MOC_DIR = .moc
@@ -95,6 +95,6 @@ INSTALLS += target headers top_headers pkgconfig
     INSTALLS += private_headers
 }
 
-OTHER_FILES = \
+OTHER_FILES += \
     gegl-qt$$QT_MAJOR_VERSION-$${GEGLQT_API_VERSION}.pc.in \
 
diff --git a/gegl-qt/gegl-qt4-0.1.pc.in b/gegl-qt/gegl-qt4-0.1.pc.in
index a663f55..820f5d4 100644
--- a/gegl-qt/gegl-qt4-0.1.pc.in
+++ b/gegl-qt/gegl-qt4-0.1.pc.in
@@ -6,7 +6,7 @@ includedir= GEGLQT_INSTALL_HEADERS@
 Name: GEGL-QT
 Description: Convenience library for using Gegl in Qt applications
 Version: @GEGLQT_VERSION@
-Requires: gegl @GEGLQT_DECLARATIVE_PKGCONFIG@ QtGui
+Requires: @GEGL_PKG@ @GEGLQT_DECLARATIVE_PKGCONFIG@ QtGui
 Cflags: -I${includedir}/@GEGLQT_LIBNAME@
 Libs: -L${libdir} -l GEGLQT_LIBNAME@
 
diff --git a/gegl-qt/gegl-qt5-0.1.pc.in b/gegl-qt/gegl-qt5-0.1.pc.in
index a663f55..820f5d4 100644
--- a/gegl-qt/gegl-qt5-0.1.pc.in
+++ b/gegl-qt/gegl-qt5-0.1.pc.in
@@ -6,7 +6,7 @@ includedir= GEGLQT_INSTALL_HEADERS@
 Name: GEGL-QT
 Description: Convenience library for using Gegl in Qt applications
 Version: @GEGLQT_VERSION@
-Requires: gegl @GEGLQT_DECLARATIVE_PKGCONFIG@ QtGui
+Requires: @GEGL_PKG@ @GEGLQT_DECLARATIVE_PKGCONFIG@ QtGui
 Cflags: -I${includedir}/@GEGLQT_LIBNAME@
 Libs: -L${libdir} -l GEGLQT_LIBNAME@
 
diff --git a/operations/geglqtdisplay.cpp b/operations/geglqtdisplay.cpp
index af8270b..71d5d64 100644
--- a/operations/geglqtdisplay.cpp
+++ b/operations/geglqtdisplay.cpp
@@ -105,9 +105,17 @@ gegl_chant_class_init (GeglChantClass *klass)
   operation_class->attach = attach;
   G_OBJECT_CLASS (klass)->dispose = dispose;
 
-  operation_class->name        = "gegl-qt4:display";
+#if GEGL_MINOR_VERSION >= 2 && GEGL_MICRO_VERSION >= 0
+  gegl_operation_class_set_keys (operation_class,
+      "name", GEGLQT_OPERATION_PREFIX":display",
+      "categories", "output",
+      "description", "Displays the input buffer in a Qt window .",
+      NULL);
+#else /* GEGL < 0.2.0 */
+  operation_class->name        = GEGLQT_OPERATION_PREFIX":display";
   operation_class->categories  = "output";
   operation_class->description = "Displays the input buffer in a Qt window.";
+#endif
 }
 
 #endif
diff --git a/operations/operations.pro b/operations/operations.pro
index 1462e38..474bef8 100644
--- a/operations/operations.pro
+++ b/operations/operations.pro
@@ -1,4 +1,3 @@
-
 include(../config.pri)
 
 TARGET = $$GEGLQT_BASELIBNAME-display
@@ -13,8 +12,12 @@ contains(HAVE_QT_WIDGETS, yes) {
     QT += $$QT_WIDGETS
 }
 
+GEGLQT_OPERATION_PREFIX = gegl-qt$$QT_MAJOR_VERSION
+
+DEFINES += GEGLQT_OPERATION_PREFIX=\\\"$${GEGLQT_OPERATION_PREFIX}\\\"
+
 CONFIG += link_pkgconfig
-PKGCONFIG += gegl
+PKGCONFIG += $$GEGL_PKG
 
 INCLUDEPATH += ../gegl-qt .. # .. because public include have gegl-qt/ prefix
 LIBS += -L../gegl-qt -l$$GEGLQT_LIBNAME
diff --git a/plugins/qml-plugin/qml-plugin.pro b/plugins/qml-plugin/qml-plugin.pro
index 041676c..90a31c3 100644
--- a/plugins/qml-plugin/qml-plugin.pro
+++ b/plugins/qml-plugin/qml-plugin.pro
@@ -22,7 +22,7 @@ INCLUDEPATH += ../../gegl-qt ../.. # .. because public include have gegl-qt/ pre
 LIBS += -L../../gegl-qt -l$$GEGLQT_LIBNAME
 
 CONFIG += link_pkgconfig
-PKGCONFIG += gegl
+PKGCONFIG += $$GEGL_PKG
 
 OTHER_FILES += \
     $$GEGLQT_QML_API_NAME/qmldir.in
diff --git a/tests/tests-common.pri b/tests/tests-common.pri
index 950964d..864bb56 100644
--- a/tests/tests-common.pri
+++ b/tests/tests-common.pri
@@ -6,7 +6,7 @@ QT -= gui # Not all tests needs UI
 CONFIG += debug
 
 CONFIG += link_pkgconfig
-PKGCONFIG += gegl
+PKGCONFIG += $$GEGL_PKG
 
 isEmpty(USE_EXTERNAL_GEGLQT) {
     INCLUDEPATH += ../../gegl-qt ../.. # ../.. because public includes have gegl-qt/ prefix



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]