[gegl-qt] Build: QtDeclarative/QML now optional, no longer requires Qt 4.7.0+



commit 06b093e9c0655c7caf7abcad53bc7fb978bb8ed4
Author: Jon Nordby <jononor gmail com>
Date:   Fri Aug 26 11:21:24 2011 +0200

    Build: QtDeclarative/QML now optional, no longer requires Qt 4.7.0+
    
    If QtDeclarative is not available, disable the parts that
    depend on it automatically.

 config.pri                       |    7 +++++++
 examples/examples-common.pri     |    5 ++++-
 examples/examples.pro            |   12 +++++++++---
 examples/qml-basic/qml-basic.cpp |    1 +
 examples/qml-paint/qml-paint.cpp |    1 +
 gegl-qt/gegl-qt.h                |    1 -
 gegl-qt/gegl-qt.pro              |   24 ++++++++++++++++--------
 operations/operations.pro        |    2 +-
 8 files changed, 39 insertions(+), 14 deletions(-)
---
diff --git a/config.pri b/config.pri
index b0f9526..e44816a 100644
--- a/config.pri
+++ b/config.pri
@@ -27,6 +27,13 @@ isEmpty(GEGL_INSTALL_OPERATIONS) {
     GEGL_INSTALL_OPERATIONS = $$GEGL_LIBDIR/gegl-0.1/
 }
 
+# Optional deps
+HAVE_QT_DECLARATIVE = yes
+!system(pkg-config QtDeclarative){
+    !build_pass:system(echo "QtDeclarative not found - no QML support")
+    HAVE_QT_DECLARATIVE = no
+}
+
 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/examples-common.pri b/examples/examples-common.pri
index e8f79cf..f87feac 100644
--- a/examples/examples-common.pri
+++ b/examples/examples-common.pri
@@ -1,7 +1,10 @@
 isEmpty(GEGLQT_CONFIG):error("config.pri not found")
 # This file uses variables from config.pri, so users must include config.pri before including this file
 
-QT += core gui declarative
+QT += core gui
+contains(HAVE_QT_DECLARATIVE, yes) {
+    QT += declarative
+}
 
 CONFIG += qt
 
diff --git a/examples/examples.pro b/examples/examples.pro
index c6c68c3..49e451d 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,12 +1,18 @@
-
+include(../config.pri)
 # TODO: install examples
 
 TEMPLATE = subdirs
 SUBDIRS = \
     qwidget-basic \
     qgv-basic \
-    qml-basic \
-    qml-paint \
     qwidget-transformations \
     qwidget-autotransform \
     display-operation \
+
+# Examples that depend on Qt Declarative (optional)
+contains(HAVE_QT_DECLARATIVE, yes) {
+    SUBDIRS += \
+        qml-basic \
+        qml-paint \
+
+}
diff --git a/examples/qml-basic/qml-basic.cpp b/examples/qml-basic/qml-basic.cpp
index a8a563e..7fdcef1 100644
--- a/examples/qml-basic/qml-basic.cpp
+++ b/examples/qml-basic/qml-basic.cpp
@@ -17,6 +17,7 @@
  */
 
 #include <gegl-qt.h>
+#include <gegl-qt-declarative.h>
 
 #include <QtGui>
 #include <QtCore>
diff --git a/examples/qml-paint/qml-paint.cpp b/examples/qml-paint/qml-paint.cpp
index 82b8667..ce4f4f9 100644
--- a/examples/qml-paint/qml-paint.cpp
+++ b/examples/qml-paint/qml-paint.cpp
@@ -19,6 +19,7 @@
 #include "qml-paint-engine.h"
 
 #include <gegl-qt.h>
+#include <gegl-qt-declarative.h>
 
 #include <QtGui>
 #include <QtCore>
diff --git a/gegl-qt/gegl-qt.h b/gegl-qt/gegl-qt.h
index 5160dff..d811b86 100644
--- a/gegl-qt/gegl-qt.h
+++ b/gegl-qt/gegl-qt.h
@@ -6,6 +6,5 @@
 
 #include <gegl-qt/nodeviewwidget.h>
 #include <gegl-qt/nodeviewgraphicswidget.h>
-#include <gegl-qt/nodeviewdeclarativeitem.h>
 
 #endif // GEGLQT_H
diff --git a/gegl-qt/gegl-qt.pro b/gegl-qt/gegl-qt.pro
index 5aa526a..e2bd1c7 100644
--- a/gegl-qt/gegl-qt.pro
+++ b/gegl-qt/gegl-qt.pro
@@ -7,7 +7,10 @@ CONFIG += qt no_keywords
 
 VERSION = $$GEGLQT_VERSION
 
-QT += core gui declarative
+QT += core gui
+contains(HAVE_QT_DECLARATIVE, yes) {
+    QT += declarative
+}
 
 CONFIG += link_pkgconfig
 PKGCONFIG += gegl
@@ -18,16 +21,21 @@ MOC_DIR = .moc
 PUBLIC_SOURCES += \
     nodeviewwidget.cpp \
     nodeviewgraphicswidget.cpp \
-    nodeviewdeclarativeitem.cpp \
     nodeviewoptions.cpp \
 
-TOP_HEADER += gegl-qt.h
+TOP_HEADERS += gegl-qt.h
 
 PUBLIC_HEADERS = \
     nodeviewwidget.h \
     nodeviewgraphicswidget.h \
-    nodeviewdeclarativeitem.h \
-    nodeviewoptions.h
+    nodeviewoptions.h \
+
+# 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
+}
 
 PRIVATE_HEADERS = \
     internal/nodeviewimplementation.h \
@@ -46,15 +54,15 @@ headers.files = $$PUBLIC_HEADERS
 private_headers.files = $$PRIVATE_HEADERS
 private_headers.path = $$GEGLQT_INSTALL_HEADERS/$$GEGLQT_LIBNAME/$$GEGLQT_PROJECTNAME/internal
 
-top_header.path = $$GEGLQT_INSTALL_HEADERS/$$GEGLQT_LIBNAME
-top_header.files = $$TOP_HEADER
+top_headers.path = $$GEGLQT_INSTALL_HEADERS/$$GEGLQT_LIBNAME
+top_headers.files = $$TOP_HEADERS
 
 outputFiles(gegl-qt4-0.1.pc)
 
 pkgconfig.path = $$GEGLQT_INSTALL_LIBS/pkgconfig
 pkgconfig.files = gegl-qt4-0.1.pc
 
-INSTALLS += target headers top_header pkgconfig
+INSTALLS += target headers top_headers pkgconfig
 !isEmpty(GEGLQT_INSTALL_PRIVATE_HEADERS) {
     INSTALLS += private_headers
 }
diff --git a/operations/operations.pro b/operations/operations.pro
index 5ea7528..edce86d 100644
--- a/operations/operations.pro
+++ b/operations/operations.pro
@@ -8,7 +8,7 @@ CONFIG += qt no_keywords plugin
 
 VERSION = $$GEGLQT_VERSION
 
-QT += core gui declarative
+QT += core gui
 
 CONFIG += link_pkgconfig
 PKGCONFIG += gegl



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