[gegl-qt] Python: Handle building without QtDeclarative



commit a4324c380410fe9b1376845957ce143600887afd
Author: Jon Nordby <jononor gmail com>
Date:   Thu Sep 22 22:31:34 2011 +0200

    Python: Handle building without QtDeclarative

 config.pri                                         |    8 ++++++++
 pygegl-qt/.gitignore                               |    2 ++
 pygegl-qt/{global.h => global.h.in}                |    6 +++---
 pygegl-qt/pygegl-qt.pro                            |   19 +++++++++++++------
 ...ystem_gegl-qt.xml => typesystem_gegl-qt.xml.in} |    2 +-
 5 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/config.pri b/config.pri
index 2aa97ba..1184d7f 100644
--- a/config.pri
+++ b/config.pri
@@ -52,6 +52,12 @@ GEGLQT_INSTALL_HEADERS = $$GEGLQT_INSTALL_PREFIX/include
 GEGLQT_INSTALL_LIBS = $$GEGLQT_INSTALL_PREFIX/lib
 GEGLQT_INSTALL_DATA = $$GEGLQT_INSTALL_PREFIX/share
 
+contains(HAVE_QT_DECLARATIVE, yes) {
+    # Need to be conditionally included in python binding generation
+    GEGLQT_DECLARATIVE_INCLUDE = "$$LITERAL_HASH\\include <GeglQtDeclarative>"
+    GEGLQT_DECLARATIVE_TYPESYSTEM = "<object-type name=\\\"NodeViewDeclarativeItem\\\"/>"
+}
+
 # Variables that can be substituted in .in files
 SUBST_VARIABLES += \
     GEGLQT_API_VERSION \
@@ -63,6 +69,8 @@ SUBST_VARIABLES += \
     GEGLQT_INSTALL_HEADERS \
     GEGLQT_INSTALL_LIBS \
     GEGLQT_INSTALL_DATA \
+    GEGLQT_DECLARATIVE_INCLUDE \
+    GEGLQT_DECLARATIVE_TYPESYSTEM \
 
 # 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/pygegl-qt/.gitignore b/pygegl-qt/.gitignore
index 45c6ce6..1eb2a47 100644
--- a/pygegl-qt/.gitignore
+++ b/pygegl-qt/.gitignore
@@ -1,3 +1,5 @@
 geglqt
 Makefile
 mjb_rejected_*.log
+global.h
+typesystem_gegl-qt.xml
diff --git a/pygegl-qt/global.h b/pygegl-qt/global.h.in
similarity index 68%
rename from pygegl-qt/global.h
rename to pygegl-qt/global.h.in
index 192a5d2..921b58a 100644
--- a/pygegl-qt/global.h
+++ b/pygegl-qt/global.h.in
@@ -2,10 +2,10 @@
 #undef QT_NO_STL_WCHAR
 
 #ifndef NULL
-#define NULLÂÂÂ 0
+#define NULL 0
 #endif
 
 #include "pyside_global.h"
-#include <GeglQt>
-#include <GeglQtDeclarative>
 
+#include <GeglQt>
+ GEGLQT_DECLARATIVE_INCLUDE@
diff --git a/pygegl-qt/pygegl-qt.pro b/pygegl-qt/pygegl-qt.pro
index 1af8b16..1a3d834 100644
--- a/pygegl-qt/pygegl-qt.pro
+++ b/pygegl-qt/pygegl-qt.pro
@@ -17,12 +17,16 @@ INCLUDES += \
     -I$$LIBGEGLQT_SRC_DIR \
     -I$$PYSIDE_INCLUDE_DIR/QtCore \
     -I$$PYSIDE_INCLUDE_DIR/QtGui \
-    -I$$PYSIDE_INCLUDE_DIR/QtDeclarative \
-    -I$$PYSIDE_INCLUDE_DIR/QtNetwork \
     -I$$[QT_INSTALL_HEADERS]/QtCore \
-    -I$$[QT_INSTALL_HEADERS]/QtGui \
-    -I$$[QT_INSTALL_HEADERS]/QtDeclarative \
-    -I$$[QT_INSTALL_HEADERS]/QtNetwork \
+    -I$$[QT_INSTALL_HEADERS]/QtGui
+
+contains(HAVE_QT_DECLARATIVE, yes) {
+    INCLUDES += \
+        -I$$PYSIDE_INCLUDE_DIR/QtDeclarative \
+        -I$$PYSIDE_INCLUDE_DIR/QtNetwork \
+        -I$$[QT_INSTALL_HEADERS]/QtDeclarative \
+        -I$$[QT_INSTALL_HEADERS]/QtNetwork
+}
 
 INCLUDES += $$system(pkg-config --cflags gegl pygobject-2.0 gobject-2.0 pyside)
 
@@ -33,6 +37,10 @@ INCLUDES += $$system(pkg-config --cflags gegl pygobject-2.0 gobject-2.0 pyside)
 LIBRARIES += -L../gegl-qt -l$$GEGLQT_LIBNAME
 LIBRARIES += $$system(pkg-config --libs gegl pygobject-2.0 gobject-2.0 pyside)
 
+outputFiles(global.h typesystem_gegl-qt.xml)
+
+OTHER_FILES += global.h.in typesystem_gegl-qt.xml.in
+
 # Generate
 QMAKE_EXTRA_TARGETS += generate
 generate.target = generate
@@ -71,6 +79,5 @@ install.path = $$PYTHON_SITE_PACKAGES
 INSTALLS += install
 
 OTHER_FILES += \
-    typesystem_gegl-qt.xml \
     geglnode_conversions.h \
 
diff --git a/pygegl-qt/typesystem_gegl-qt.xml b/pygegl-qt/typesystem_gegl-qt.xml.in
similarity index 92%
rename from pygegl-qt/typesystem_gegl-qt.xml
rename to pygegl-qt/typesystem_gegl-qt.xml.in
index 231a76e..81aac0c 100644
--- a/pygegl-qt/typesystem_gegl-qt.xml
+++ b/pygegl-qt/typesystem_gegl-qt.xml.in
@@ -11,11 +11,11 @@
     <namespace-type name="GeglQt">
         <object-type name="NodeViewWidget" />
         <object-type name="NodeViewGraphicsWidget" />
-        <object-type name="NodeViewDeclarativeItem" />
         <object-type name="NodeViewOptions" >
             <enum-type name="AutoScale"/>
             <enum-type name="AutoCenter"/>
         </object-type>
+        @GEGLQT_DECLARATIVE_TYPESYSTEM@
     </namespace-type>
 </typesystem>
 



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