diff options
-rw-r--r-- | mkspecs/features/qt.prf | 11 | ||||
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 31 |
2 files changed, 22 insertions, 20 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index b57afcf72d..90e318e2a4 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -230,7 +230,16 @@ for(ever) { QMAKE_FRAMEWORKPATH *= $$MODULE_FRAMEWORKS !isEmpty(MODULE_MODULE) { contains(MODULE_CONFIG, lib_bundle) { - LIBS$$var_sfx += -framework $$MODULE_MODULE + framework = $$MODULE_MODULE + qtConfig(debug_and_release):!macx-xcode { + platform_target_suffix = $$qtPlatformTargetSuffix() + !isEmpty(platform_target_suffix): \ + # The -framework linker argument supports a name[,suffix] version, + # where if the suffix is specified the framework is first searched + # for the library with the suffix and then without. + framework = $$framework,$$platform_target_suffix + } + LIBS$$var_sfx += -framework $$framework } else { !isEmpty(MODULE_LIBS_ADD): \ LIBS$$var_sfx += -L$$MODULE_LIBS_ADD diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index a4be18a67f..deea7a7d17 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -117,29 +117,22 @@ void QFactoryLoader::update() QDir::Files); QLibraryPrivate *library = 0; -#ifdef Q_OS_MAC - // Loading both the debug and release version of the cocoa plugins causes the objective-c runtime - // to print "duplicate class definitions" warnings. Detect if QFactoryLoader is about to load both, - // skip one of them (below). - // - // ### FIXME find a proper solution - // - const bool isLoadingDebugAndReleaseCocoa = plugins.contains(QLatin1String("libqcocoa_debug.dylib")) - && plugins.contains(QLatin1String("libqcocoa.dylib")); -#endif for (int j = 0; j < plugins.count(); ++j) { QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j)); #ifdef Q_OS_MAC - if (isLoadingDebugAndReleaseCocoa) { -#ifdef QT_DEBUG - if (fileName.contains(QLatin1String("libqcocoa.dylib"))) - continue; // Skip release plugin in debug mode -#else - if (fileName.contains(QLatin1String("libqcocoa_debug.dylib"))) - continue; // Skip debug plugin in release mode -#endif - } + const bool isDebugPlugin = fileName.endsWith(QLatin1String("_debug.dylib")); + const bool isDebugLibrary = + #ifdef QT_DEBUG + true; + #else + false; + #endif + + // Skip mismatching plugins so that we don't end up loading both debug and release + // versions of the same Qt libraries (due to the plugin's dependencies). + if (isDebugPlugin != isDebugLibrary) + continue; #endif if (qt_debug_component()) { qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName; |