Make the module not depend on QtBase configure
authorJørgen Lind <jorgen.lind@nokia.com>
Sun, 11 Mar 2012 12:05:08 +0000 (13:05 +0100)
committerJørgen Lind <jorgen.lind@nokia.com>
Mon, 12 Mar 2012 11:00:28 +0000 (12:00 +0100)
This is convenient if we want to reconfigure without reconfiguring
QtBase.

Change-Id: I719ba0d89905287a557e962ed6d804514e44b7f5
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
config.tests/xkbcommon/main.cpp [new file with mode: 0644]
config.tests/xkbcommon/xkbcommon.pro [new file with mode: 0644]
qtwayland.pro
src/compositor/compositor.pri
src/plugins/platforms/wayland/wayland.pro
sync.profile
tests/auto/client/client.pro
tests/auto/compositor/compositor.pro

diff --git a/config.tests/xkbcommon/main.cpp b/config.tests/xkbcommon/main.cpp
new file mode 100644 (file)
index 0000000..9f10f3e
--- /dev/null
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Compositor.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+**     the names of its contributors may be used to endorse or promote
+**     products derived from this software without specific prior written
+**     permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <X11/extensions/XKBcommon.h>
+#include <X11/keysym.h>
+
+#include <QtCore/qnamespace.h>
+
+int main(int argc, char **argv)
+{
+    struct xkb_rule_names names;
+    names.rules = "evdev";
+    names.model = "pc105";
+    names.layout = "us";
+    names.variant = "";
+    names.options = "";
+
+    struct xkb_desc *xkb = xkb_compile_keymap_from_rules(&names);
+    Q_UNUSED(xkb);
+    return 0;
+}
diff --git a/config.tests/xkbcommon/xkbcommon.pro b/config.tests/xkbcommon/xkbcommon.pro
new file mode 100644 (file)
index 0000000..facc28e
--- /dev/null
@@ -0,0 +1,17 @@
+TEMPLATE = app
+TARGET = xkbcommon
+QT = core
+DEPENDPATH += .
+INCLUDEPATH += .
+
+!contains(QT_CONFIG, no-pkg-config) {
+    QMAKE_CFLAGS_XKBCOMMON=$$system(pkg-config --cflags xkbcommon 2>/dev/null)
+    QMAKE_LIBS_XKBCOMMON=$$system(pkg-config --libs xkbcommon 2>/dev/null)
+}
+
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+QMAKE_CFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+LIBS += $$QMAKE_LIBS_XKBCOMMON
+
+# Input
+SOURCES += main.cpp
index 07dea21..377ee24 100644 (file)
@@ -1,15 +1,23 @@
 TEMPLATE=subdirs
+CONFIG += ordered
 
-module_qtcompositor_src.subdir = src
-module_qtcompositor_src.target = module-module_qtcompositor_src
+module_qtwayland_src.subdir = src
+module_qtwayland_src.target = module-qtwayland-src
 
-module_qtcompositor_examples.subdir = examples
-module_qtcompositor_examples.target = module_qtcompositor_examples
-module_qtcompositor_examples.depends = module_qtcompositor_src
+module_qtwayland_examples.subdir = examples
+module_qtwayland_examples.target = module-qtwayland-examples
+module_qtwayland_examples.depends = module_qtwayland_src
 !contains(QT_BUILD_PARTS,examples) {
-    module_qtcompositor_examples.CONFIG = no_default_target no_default_install
+    module_qtwayland_examples.CONFIG = no_default_target no_default_install
 }
 
-SUBDIRS += tests \
-           module_qtcompositor_src \
-           module_qtcompositor_examples \
+module_qtwayland_tests.subdir = tests
+module_qtwayland_tests.target = module-qtwayland-tests
+module_qtwayland_tests.depends = module_qtwayland_src
+!contains(QT_BUILD_PARTS,tests):!with-tests {
+    module_qtwayland_tests.CONFIG += no_default_target
+}
+
+SUBDIRS += module_qtwayland_src \
+           module_qtwayland_examples \
+           module_qtwayland_tests
index 7962b05..77467c2 100644 (file)
@@ -7,24 +7,27 @@ INCLUDEPATH += $$PWD
 DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT
 DEFINES += QT_BUILD_COMPOSITOR_LIB
 
-!mac:use_pkgconfig {
-    CONFIG += link_pkgconfig
-    PKGCONFIG += wayland-server
+!contains(QT_CONFIG, no-pkg-config) {
+    #If Qt uses pkg-config then override pkgconfig from mkspec
+    QMAKE_CFLAGS_WAYLAND=$$system(pkg-config --cflags wayland-server 2>/dev/null)
+    QMAKE_LIBS_WAYLAND_SERVER=$$system(pkg-config --libs-only-l wayland-server 2>/dev/null)
+    QMAKE_INCDIR_WAYLAND=$$system("pkg-config --cflags-only-I wayland-server 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'")
+    QMAKE_LIBDIR_WAYLAND=$$system("pkg-config --libs-only-L wayland-server 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'")
+    QMAKE_DEFINES_WAYLAND=""
+}
 
-    #set the rpath
-    !isEmpty(QMAKE_LFLAGS_RPATH) {
-        WAYLAND_NEEDS_RPATH = $$system(pkg-config --libs-only-L wayland-server)
-        !isEmpty(WAYLAND_NEEDS_RPATH) {
-            WAYLAND_LIBDIR = $$system(pkg-config --variable=libdir wayland-server)
-            !isEmpty(WAYLAND_LIBDIR):QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${WAYLAND_LIBDIR}
-        }
-    }
-} else {
-    INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND
+QMAKE_CFLAGS += $$QMAKE_CFLAGS_WAYLAND
+DEFINES += $$QMAKE_DEFINES_WAYLAND
+LIBS += $$QMAKE_LIBS_WAYLAND_SERVER
+!isEmpty(QMAKE_LIBDIR_WAYLAND) {
+    LIBS += -L$$QMAKE_LIBDIR_WAYLAND
+}
+
+!isEmpty(QMAKE_LFLAGS_RPATH) {
     !isEmpty(QMAKE_LIBDIR_WAYLAND) {
-        LIBS += -L$$QMAKE_LIBDIR_WAYLAND
+        QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${QMAKE_LIBS_WAYLAND}
     }
-    LIBS += -lwayland-server -lffi
 }
 
 HEADERS += qtcompositorversion.h
index 9d43c87..73909bf 100644 (file)
@@ -6,21 +6,8 @@ CONFIG += qpa/genericunixfontdatabase
 
 DESTDIR = $$QT.gui.plugins/platforms
 
-DEFINES += Q_PLATFORM_WAYLAND
-DEFINES += $$QMAKE_DEFINES_WAYLAND
-
-mac {
-    DEFINES += QT_NO_WAYLAND_XKB
-}
-
 QT += core-private gui-private platformsupport-private
 
-WAYLANDSOURCES += \
-            $$PWD/../../../../extensions/surface-extension.xml \
-            $$PWD/../../../../extensions/sub-surface-extension.xml \
-            $$PWD/../../../../extensions/output-extension.xml \
-            $$PWD/../../../../extensions/touch-extension.xml
-
 SOURCES =   main.cpp \
             qwaylandintegration.cpp \
             qwaylandnativeinterface.cpp \
@@ -66,18 +53,54 @@ HEADERS =   qwaylandintegration.h \
             qwaylandtouch.h \
             $$PWD/../../../shared/qwaylandmimehelper.h
 
+DEFINES += Q_PLATFORM_WAYLAND
+
+contains(config_test_xkbcommon,yes) {
+    !contains(QT_CONFIG, no-pkg-config) {
+        QMAKE_CFLAGS_XKBCOMMON=$$system(pkg-config --cflags xkbcommon 2>/dev/null)
+        QMAKE_LIBS_XKBCOMMON=$$system(pkg-config --libs xkbcommon 2>/dev/null)
+    }
+
+    QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+    QMAKE_CFLAGS += $$QMAKE_CFLAGS_XKBCOMMON
+    LIBS += $$QMAKE_LIBS_XKBCOMMON
+} else {
+    DEFINES += QT_NO_WAYLAND_XKB
+}
+
+WAYLANDSOURCES += \
+            $$PWD/../../../../extensions/surface-extension.xml \
+            $$PWD/../../../../extensions/sub-surface-extension.xml \
+            $$PWD/../../../../extensions/output-extension.xml \
+            $$PWD/../../../../extensions/touch-extension.xml
+
+
 OTHER_FILES += wayland.json
 
 INCLUDEPATH += $$PWD/../../../shared
 
-INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
-
-LIBS += $$QMAKE_LIBS_WAYLAND
-mac {
-    LIBS += -lwayland-client
+!contains(QT_CONFIG, no-pkg-config) {
+    #If Qt uses pkg-config then override pkgconfig from mkspec
+    QMAKE_CFLAGS_WAYLAND=$$system(pkg-config --cflags wayland-client 2>/dev/null)
+    QMAKE_LIBS_WAYLAND_CLIENT=$$system(pkg-config --libs-only-l wayland-client 2>/dev/null)
+    QMAKE_INCDIR_WAYLAND=$$system("pkg-config --cflags-only-I wayland-client 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'")
+    QMAKE_LIBDIR_WAYLAND=$$system("pkg-config --libs-only-L wayland-client 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'")
+    QMAKE_DEFINES_WAYLAND=""
 }
 
 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND
+QMAKE_CFLAGS += $$QMAKE_CFLAGS_WAYLAND
+DEFINES += $$QMAKE_DEFINES_WAYLAND
+LIBS += $$QMAKE_LIBS_WAYLAND_CLIENT
+!isEmpty(QMAKE_LIBDIR_WAYLAND) {
+    LIBS += -L$$QMAKE_LIBDIR_WAYLAND
+}
+
+!isEmpty(QMAKE_LFLAGS_RPATH) {
+    !isEmpty(QMAKE_LIBDIR_WAYLAND) {
+        QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${QMAKE_LIBS_WAYLAND}
+    }
+}
 
 target.path += $$[QT_INSTALL_PLUGINS]/platforms
 INSTALLS += target
index 27887ee..e964999 100644 (file)
@@ -22,3 +22,8 @@
 %dependencies = (
         "qtbase" => "refs/heads/master",
 );
+
+# Compile tests
+%configtests = (
+    "xkbcommon" => {}
+);
index 12dad35..6bfe82b 100644 (file)
@@ -4,24 +4,29 @@ TARGET = tst_client
 QT += testlib
 QT += core-private gui-private
 
-use_pkgconfig {
-    CONFIG += link_pkgconfig
-    PKGCONFIG += wayland-server
+!contains(QT_CONFIG, no-pkg-config) {
+    #If Qt uses pkg-config then override pkgconfig from mkspec
+    QMAKE_CFLAGS_WAYLAND=$$system(pkg-config --cflags wayland-client 2>/dev/null)
+    QMAKE_LIBS_WAYLAND_CLIENT=$$system(pkg-config --libs-only-l wayland-client 2>/dev/null)
+    QMAKE_LIBS_WAYLAND_SERVER=$$system(pkg-config --libs-only-l wayland-server 2>/dev/null)
+    QMAKE_INCDIR_WAYLAND=$$system("pkg-config --cflags-only-I wayland-client 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'")
+    QMAKE_LIBDIR_WAYLAND=$$system("pkg-config --libs-only-L wayland-client 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'")
+    QMAKE_DEFINES_WAYLAND=""
+}
 
-    #set the rpath
-    !isEmpty(QMAKE_LFLAGS_RPATH) {
-        WAYLAND_NEEDS_RPATH = $$system(pkg-config --libs-only-L wayland-server)
-        !isEmpty(WAYLAND_NEEDS_RPATH) {
-            WAYLAND_LIBDIR = $$system(pkg-config --variable=libdir wayland-server)
-            !isEmpty(WAYLAND_LIBDIR):QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${WAYLAND_LIBDIR}
-        }
-    }
-} else {
-    INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND
+QMAKE_CFLAGS += $$QMAKE_CFLAGS_WAYLAND
+DEFINES += $$QMAKE_DEFINES_WAYLAND
+LIBS += $$QMAKE_LIBS_WAYLAND_CLIENT
+LIBS += $$QMAKE_LIBS_WAYLAND_SERVER
+!isEmpty(QMAKE_LIBDIR_WAYLAND) {
+    LIBS += -L$$QMAKE_LIBDIR_WAYLAND
+}
+
+!isEmpty(QMAKE_LFLAGS_RPATH) {
     !isEmpty(QMAKE_LIBDIR_WAYLAND) {
-        LIBS += -L$$QMAKE_LIBDIR_WAYLAND
+        QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${QMAKE_LIBS_WAYLAND}
     }
-    LIBS += -lwayland-server -lffi
 }
 
 SOURCES += tst_client.cpp \
index 26a3cb8..68524f6 100644 (file)
@@ -4,11 +4,29 @@ TARGET = tst_compositor
 QT += testlib
 QT += core-private gui-private compositor
 
-INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND
+!contains(QT_CONFIG, no-pkg-config) {
+    #If Qt uses pkg-config then override pkgconfig from mkspec
+    QMAKE_CFLAGS_WAYLAND=$$system(pkg-config --cflags wayland-server 2>/dev/null)
+    QMAKE_LIBS_WAYLAND_SERVER=$$system(pkg-config --libs-only-l wayland-server 2>/dev/null)
+    QMAKE_LIBS_WAYLAND_CLIENT=$$system(pkg-config --libs-only-l wayland-client 2>/dev/null)
+    QMAKE_INCDIR_WAYLAND=$$system("pkg-config --cflags-only-I wayland-server 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'")
+    QMAKE_LIBDIR_WAYLAND=$$system("pkg-config --libs-only-L wayland-server 2>/dev/null | sed -e 's,^-L,,g' -e 's, -L, ,g'")
+    QMAKE_DEFINES_WAYLAND=""
+}
+
+QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND
+QMAKE_CFLAGS += $$QMAKE_CFLAGS_WAYLAND
+DEFINES += $$QMAKE_DEFINES_WAYLAND
+LIBS += $$QMAKE_LIBS_WAYLAND_SERVER
+LIBS += $$QMAKE_LIBS_WAYLAND_CLIENT
+!isEmpty(QMAKE_LIBDIR_WAYLAND) {
+    LIBS += -L$$QMAKE_LIBDIR_WAYLAND
+}
 
-LIBS += $$QMAKE_LIBS_WAYLAND
-mac {
-    LIBS += -lwayland-client
+!isEmpty(QMAKE_LFLAGS_RPATH) {
+    !isEmpty(QMAKE_LIBDIR_WAYLAND) {
+        QMAKE_LFLAGS += $${QMAKE_LFLAGS_RPATH}$${QMAKE_LIBS_WAYLAND}
+    }
 }
 
 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND