[gegl-qt] Build: Add make intcheck target



commit 9bfce6219bf6fb6b22bf3a69e4d422e2716c1f44
Author: Jon Nordby <jononor gmail com>
Date:   Tue Aug 23 00:55:31 2011 +0200

    Build: Add make intcheck target
    
    This check target goes one step further than make distcheck:
    After having installed the results of a distcheck to a custom prefix,
    the release tarball is extracted to a new build root, where examples
    and tests are built against the version installed by distcheck.
    
    This tests that the install of the library is correct, and that
    consumers can make use of it.

 config.pri                   |    6 ++++++
 examples/examples-common.pri |    9 +++++++--
 gegl-qt.pro                  |   28 ++++++++++++++++++++++++++--
 gegl-qt/gegl-qt.pro          |   23 ++++++++++++++++++-----
 tests/tests-common.pri       |   14 ++++++++++----
 5 files changed, 67 insertions(+), 13 deletions(-)
---
diff --git a/config.pri b/config.pri
index 72b7306..b0f9526 100644
--- a/config.pri
+++ b/config.pri
@@ -14,6 +14,12 @@ isEmpty(GEGLQT_INSTALL_PREFIX) {
     GEGLQT_INSTALL_PREFIX = /usr
 }
 
+!isEmpty(GEGLQT_INTEGRATION_CHECK) {
+    # Build for integration check
+    # Compile examples and tests against an installed gegl-qt version
+    USE_EXTERNAL_GEGLQT = yes
+}
+
 # Paths for installing files
 GEGL_LIBDIR = $$system(pkg-config --variable libdir gegl)
 GEGL_INSTALL_OPERATIONS = $$system(pkg-config --variable pluginsdir gegl)
diff --git a/examples/examples-common.pri b/examples/examples-common.pri
index 3e40fb2..e8f79cf 100644
--- a/examples/examples-common.pri
+++ b/examples/examples-common.pri
@@ -8,8 +8,13 @@ CONFIG += qt
 OBJECTS_DIR = .obj
 MOC_DIR = .moc
 
-INCLUDEPATH += ../../gegl-qt ../.. # ../.. because public includes have gegl-qt/ prefix
-LIBS += -L../../gegl-qt -l$$GEGLQT_LIBNAME
+isEmpty(USE_EXTERNAL_GEGLQT) {
+    INCLUDEPATH += ../../gegl-qt ../.. # ../.. because public includes have gegl-qt/ prefix
+    LIBS += -L../../gegl-qt -l$$GEGLQT_LIBNAME
+} else {
+    CONFIG += link_pkgconfig
+    PKGCONFIG += $$GEGLQT_LIBNAME
+}
 
 CONFIG += link_pkgconfig
 PKGCONFIG += gegl
diff --git a/gegl-qt.pro b/gegl-qt.pro
index 45a5ed6..a31d8a4 100644
--- a/gegl-qt.pro
+++ b/gegl-qt.pro
@@ -3,7 +3,13 @@ isEmpty(GEGLQT_CONFIG):error("config.pri not found")
 
 TEMPLATE = subdirs
 CONFIG += ordered
-SUBDIRS = gegl-qt operations examples tests
+
+isEmpty(USE_EXTERNAL_GEGLQT) {
+    SUBDIRS += gegl-qt operations
+} else {
+    !system(pkg-config --exists $$GEGLQT_LIBNAME):error("Could not find required dependency: GEGL-QT")
+}
+SUBDIRS += examples tests
 
 !system(pkg-config --exists gegl):error("Could not find required dependency: GEGL")
 
@@ -12,6 +18,7 @@ DIST_PATH = $$OUT_PWD/$$DIST_NAME
 TMP_PATH = /tmp/$$GEGLQT_PROJECTNAME-$$GEGLQT_VERSION
 
 # The 'make dist' target
+# Creates a tarball
 QMAKE_EXTRA_TARGETS += dist
 dist.target = dist
 dist.commands += git clone $$IN_PWD $$DIST_PATH;
@@ -19,6 +26,7 @@ dist.commands += cd $$OUT_PWD;
 dist.commands += tar -caf $$DIST_NAME\\.tar.xz $$DIST_NAME;
 
 # The 'make distcheck' target
+# Creates a tarball release, extracts it, builds, runs tests and installs
 QMAKE_EXTRA_TARGETS += distcheck
 distcheck.target = distcheck
 distcheck.depends += dist;
@@ -26,6 +34,22 @@ distcheck.commands += mkdir -p $$OUT_PWD/distcheck-build;
 distcheck.commands += cd $$OUT_PWD/distcheck-build;
 distcheck.commands += tar -xf $$DIST_PATH\\.tar.xz;
 distcheck.commands += cd $$DIST_NAME;
-distcheck.commands += qmake;
+distcheck.commands += qmake -r GEGLQT_INSTALL_PRIVATE_HEADERS=yes GEGLQT_INSTALL_PREFIX=$$OUT_PWD/distcheck-install;
 distcheck.commands += make -j4;
 distcheck.commands += make check;
+distcheck.commands += make install;
+
+# The 'make intcheck' target
+# Creates a tarball release, extracts it, builds, runs tests and installs,
+# then extracts the tarball release again, and builds and runs test against the installed version
+QMAKE_EXTRA_TARGETS += intcheck
+intcheck.target = intcheck
+intcheck.depends += distcheck;
+intcheck.commands += mkdir -p $$OUT_PWD/intcheck-build;
+intcheck.commands += cd $$OUT_PWD/intcheck-build;
+intcheck.commands += tar -xf $$DIST_PATH\\.tar.xz;
+intcheck.commands += cd $$DIST_NAME;
+intcheck.commands += PKG_CONFIG_PATH=$$OUT_PWD/distcheck-install/lib/pkgconfig \
+    qmake -r GEGLQT_INTEGRATION_CHECK=yes;
+intcheck.commands += make -j4;
+intcheck.commands += make check;
diff --git a/gegl-qt/gegl-qt.pro b/gegl-qt/gegl-qt.pro
index 32a0323..5aa526a 100644
--- a/gegl-qt/gegl-qt.pro
+++ b/gegl-qt/gegl-qt.pro
@@ -1,4 +1,3 @@
-
 include(../config.pri)
 
 TARGET = $$GEGLQT_LIBNAME
@@ -22,26 +21,40 @@ PUBLIC_SOURCES += \
     nodeviewdeclarativeitem.cpp \
     nodeviewoptions.cpp \
 
-PUBLIC_HEADERS = gegl-qt.h \
+TOP_HEADER += gegl-qt.h
+
+PUBLIC_HEADERS = \
     nodeviewwidget.h \
     nodeviewgraphicswidget.h \
     nodeviewdeclarativeitem.h \
     nodeviewoptions.h
 
+PRIVATE_HEADERS = \
+    internal/nodeviewimplementation.h \
+
 SOURCES += $$PUBLIC_SOURCES \
     internal/nodeviewimplementation.cpp \
 
 HEADERS += $$PUBLIC_HEADERS \
-    internal/nodeviewimplementation.h \
+    $$PRIVATE_HEADERS \
 
 INCLUDEPATH += .. # Public includes have gegl-qt/ prefix
 
-headers.path = $$GEGLQT_INSTALL_HEADERS/$$GEGLQT_LIBNAME
+headers.path = $$GEGLQT_INSTALL_HEADERS/$$GEGLQT_LIBNAME/$$GEGLQT_PROJECTNAME
 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
+
 outputFiles(gegl-qt4-0.1.pc)
 
 pkgconfig.path = $$GEGLQT_INSTALL_LIBS/pkgconfig
 pkgconfig.files = gegl-qt4-0.1.pc
 
-INSTALLS += target headers pkgconfig
+INSTALLS += target headers top_header pkgconfig
+!isEmpty(GEGLQT_INSTALL_PRIVATE_HEADERS) {
+    INSTALLS += private_headers
+}
diff --git a/tests/tests-common.pri b/tests/tests-common.pri
index dafe569..e0177b2 100644
--- a/tests/tests-common.pri
+++ b/tests/tests-common.pri
@@ -7,10 +7,16 @@ CONFIG += debug
 CONFIG += link_pkgconfig
 PKGCONFIG += gegl
 
-INCLUDEPATH += ../../gegl-qt ../.. # ../.. because public includes have gegl-qt/ prefix
-LIBS += -l$$GEGLQT_LIBNAME -L$$OUT_PWD/../../gegl-qt
-
-TEST_ENVIRONMENT = LD_LIBRARY_PATH=$$OUT_PWD/../../gegl-qt:$(LD_LIBRARY_PATH)
+isEmpty(USE_EXTERNAL_GEGLQT) {
+    INCLUDEPATH += ../../gegl-qt ../.. # ../.. because public includes have gegl-qt/ prefix
+    LIBS += -l$$GEGLQT_LIBNAME -L$$OUT_PWD/../../gegl-qt
+    TEST_ENVIRONMENT = LD_LIBRARY_PATH=$$OUT_PWD/../../gegl-qt:$(LD_LIBRARY_PATH)
+} else {
+    CONFIG += link_pkgconfig
+    PKGCONFIG += $$GEGLQT_LIBNAME
+    INSTALLED_GEGLQT_LIBDIR=$$system(pkg-config $$GEGLQT_LIBNAME --libdir)
+    TEST_ENVIRONMENT = LD_LIBRARY_PATH=$$INSTALLED_GEGLQT_LIBDIR:$(LD_LIBRARY_PATH)
+}
 
 QMAKE_EXTRA_TARGETS += check
 check.target = check



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