diff options
author | Andy Shaw <andy.shaw@qt.io> | 2016-10-26 12:02:50 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2016-10-26 10:42:52 +0000 |
commit | b5cb222357841b8dad6fc80aa8e6e88047f20c00 (patch) | |
tree | dc6262fa9a9484a74fbc938cdf6eb39e01651765 | |
parent | f2ebd51d96ad49eb826a4e37e67d506fffcbd40c (diff) |
macOS: Handle -qtlibinfix correctly in macdeployqt
When Qt is configured with -qtlibinfix then it will insert
the specified setting inside the framework names. Therefore
QtCore.framework can be called QtCoreLibInfix.framework. This
means that we have to account for this in macdeployqt when
determining which plugins should be deployed.
Change-Id: I30fc7434fa87d1b41c2cacfbc9f76d4ce5491329
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
-rw-r--r-- | src/macdeployqt/shared/shared.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index cb4599df3..23817ef05 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -994,6 +994,22 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, const QStringLis } } +QString getLibInfix(const QStringList &deployedFrameworks) +{ + QString libInfix; + foreach (const QString &framework, deployedFrameworks) { + if (framework.startsWith(QStringLiteral("QtCore"))) { + Q_ASSERT(framework.length() >= 16); + // 16 == "QtCore" + ".framework" + const int lengthOfLibInfix = framework.length() - 16; + if (lengthOfLibInfix) + libInfix = framework.mid(6, lengthOfLibInfix); + break; + } + } + return libInfix; +} + void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pluginSourcePath, const QString pluginDestinationPath, DeploymentInfo deploymentInfo, bool useDebugLibs) { @@ -1011,8 +1027,11 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl // Cocoa print support pluginList.append("printsupport/libcocoaprintersupport.dylib"); + // Check if Qt was configured with -libinfix + const QString libInfixWithFramework = getLibInfix(deploymentInfo.deployedFrameworks) + QStringLiteral(".framework"); + // Network - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtNetwork.framework"))) { + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtNetwork") + libInfixWithFramework)) { QStringList bearerPlugins = QDir(pluginSourcePath + QStringLiteral("/bearer")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, bearerPlugins) { if (!plugin.endsWith(QStringLiteral("_debug.dylib"))) @@ -1024,7 +1043,7 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl QStringList imagePlugins = QDir(pluginSourcePath + QStringLiteral("/imageformats")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, imagePlugins) { if (plugin.contains(QStringLiteral("qsvg"))) { - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSvg.framework"))) + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSvg") + libInfixWithFramework)) pluginList.append(QStringLiteral("imageformats/") + plugin); } else if (!plugin.endsWith(QStringLiteral("_debug.dylib"))) { pluginList.append(QStringLiteral("imageformats/") + plugin); @@ -1032,7 +1051,7 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl } // Sql plugins if QtSql.framework is in use - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSql.framework"))) { + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSql") + libInfixWithFramework)) { QStringList sqlPlugins = QDir(pluginSourcePath + QStringLiteral("/sqldrivers")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, sqlPlugins) { if (plugin.endsWith(QStringLiteral("_debug.dylib"))) @@ -1052,7 +1071,7 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl } // multimedia plugins if QtMultimedia.framework is in use - if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtMultimedia.framework"))) { + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtMultimedia") + libInfixWithFramework)) { QStringList plugins = QDir(pluginSourcePath + QStringLiteral("/mediaservice")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, plugins) { if (!plugin.endsWith(QStringLiteral("_debug.dylib"))) @@ -1250,7 +1269,12 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf // 2) QtQuick.Controls is used // The intended failure mode is that libwidgetsplugin.dylib will be present // in the app bundle but not used at run-time. - if (deploymentInfo.deployedFrameworks.contains("QtWidgets.framework") && qtQuickContolsInUse) { + + // Check if Qt was configured with -libinfix + const QString libInfixWithFramework = getLibInfix(deploymentInfo.deployedFrameworks) + QStringLiteral(".framework"); + + if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtWidgets") + libInfixWithFramework) + && qtQuickContolsInUse) { LogNormal() << "Deploying QML import QtQuick.PrivateWidgets"; QString name = "QtQuick/PrivateWidgets"; QString path = qmlImportsPath + QLatin1Char('/') + name; |