diff options
author | Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> | 2012-04-18 15:57:00 -0700 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-19 16:40:29 +0200 |
commit | 0074cc5d34a8ee314e864ba488dab1f0d0f94995 (patch) | |
tree | e770ac258fbd0f3083021ff3cb4d2c5eedaf39a9 | |
parent | 14ea50598fb7217de5336ba33302a0ed151327a2 (diff) |
Fix detection of default platform plugin.
Let configure generate the QT_QPA_DEFAULT_PLATFORM_NAME in
qconfig.h. This allows us to override the platform name
using a configure argument.
This commit adds -qpa <platform> that lets the user specify
the default platform at configure time. Note that the default
platform is not checked against the tree since plugins are
allowed to exist outside the Qt source tree.
In the absence of -qpa argument, configure checks the mkspec
for a variable named QT_QPA_DEFAULT_PLATFORM. This check is
implemented only in the unix configure because it will be primarily
used in custom mkspecs (devices, boards).
If -qpa argument is absent and the mkspec variable is absent,
the default value is determined based on the OS as below:
Unix - "xcb"
Windows - "windows"
Mac - "cocoa"
QNX - "qnx"
Done-with: Jørgen Lind
Change-Id: I0df31811a1b901a3242bfada1232e596ebda04f4
Reviewed-by: Donald Carr <donald.carr@nokia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
-rwxr-xr-x | configure | 27 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 27 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 2 |
3 files changed, 28 insertions, 28 deletions
@@ -818,6 +818,9 @@ QT_LIBS_GLIB= QT_CFLAGS_GSTREAMER= QT_LIBS_GSTREAMER= +# default qpa platform +QT_QPA_DEFAULT_PLATFORM= + #------------------------------------------------------------------------------- # check SQL drivers available in this package #------------------------------------------------------------------------------- @@ -900,7 +903,7 @@ while [ "$#" -gt 0 ]; do shift VAL=$1 ;; - -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir) + -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -1292,6 +1295,9 @@ while [ "$#" -gt 0 ]; do DEV_VAL=`echo $VAL | sed "s,^.*=\(.*\),\1,"` DeviceVar set $DEV_VAR $DEV_VAL ;; + qpa) + QT_QPA_DEFAULT_PLATFORM="$VAL" + ;; debug-and-release) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_DEBUG_RELEASE="$VAL" @@ -3109,6 +3115,8 @@ Additional options: $DFBN -no-directfb ....... Do not compile DirectFB support. $DFBY -directfb .......... Compile DirectFB support. + -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows). + -xplatform target ... The target platform when cross-compiling. -sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot. @@ -4637,6 +4645,21 @@ if [ "$CFG_EGLFS" != "no" ]; then fi fi +# Determine the default QPA platform +if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then + # check the mkspec + QT_QPA_DEFAULT_PLATFORM=`getXQMakeConf QT_QPA_DEFAULT_PLATFORM` + if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then + if [ "$BUILD_ON_MAC" = "yes" ]; then + QT_QPA_DEFAULT_PLATFORM="cocoa" + elif [ "$UNAME_SYSTEM" = "QNX" ]; then + QT_QPA_DEFAULT_PLATFORM="qnx" + else + QT_QPA_DEFAULT_PLATFORM="xcb" + fi + fi +fi + if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB" QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB" @@ -5657,6 +5680,8 @@ cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF EOF fi +echo "#define QT_QPA_DEFAULT_PLATFORM_NAME \"$QT_QPA_DEFAULT_PLATFORM\"" >>"$outpath/src/corelib/global/qconfig.h.new" + # avoid unecessary rebuilds by copying only if qconfig.h has changed if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then rm -f "$outpath/src/corelib/global/qconfig.h.new" diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 6e54b366b3..fac466b0fd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -624,33 +624,6 @@ static void init_platform(const QString &pluginArgument, const QString &platform } } - if (name.isEmpty()) { - const QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); -#if defined(Q_OS_MAC) - const QString defaultPlatform = QLatin1String("cocoa"); -#elif defined (Q_OS_WIN) - const QString defaultPlatform = QLatin1String("windows"); -#elif defined (Q_OS_QNX) - const QString defaultPlatform = QLatin1String("qnx"); -#elif !defined (QT_NO_XCB) - const QString defaultPlatform = QLatin1String("xcb"); -#elif !defined (QT_NO_WAYLAND) - const QString defaultPlatform = QLatin1String("wayland"); -#elif !defined (QT_NO_EGLFS) - const QString defaultPlatform = QLatin1String("eglfs"); -#else - const QString defaultPlatform = QLatin1String("minimal"); -#endif - if (keys.contains(defaultPlatform)) { - qWarning("No platform plugin argument was specified, defaulting to \"%s\".", - qPrintable(defaultPlatform)); - name = defaultPlatform; - } else { - qFatal("No platform plugin argument was specified and the default plugin \"%s\" is not available", - qPrintable(defaultPlatform)); - } - } - // Create the platform integration. QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath); if (QGuiApplicationPrivate::platform_integration) { diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 23b19ecf6e..27b4fabf09 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2859,6 +2859,8 @@ void Configure::generateConfigfiles() if (dictionary[ "QT_SXE" ] == "no") tmpStream<<"#define QT_NO_SXE"<<endl; + tmpStream<<"#define QT_QPA_DEFAULT_PLATFORM_NAME \"windows\""<<endl; + tmpStream.flush(); tmpFile.flush(); |