Make macdeployqt work with Qt 5 too

This commit is contained in:
Jonas Kvinge 2021-04-10 03:28:38 +02:00
parent 5a58ac2845
commit 6fa331ad06
2 changed files with 22 additions and 1 deletions

View File

@ -254,7 +254,11 @@ int main(int argc, char **argv)
if (plugins) {
if (plugin_dir.isEmpty()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
deploymentInfo.pluginPath = QLibraryInfo::path(QLibraryInfo::PluginsPath);
#else
deploymentInfo.pluginPath = QLibraryInfo::location(QLibraryInfo::PluginsPath);
#endif
}
else {
deploymentInfo.pluginPath = plugin_dir;

View File

@ -992,8 +992,13 @@ DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks,
if (framework.isDebugLibrary())
deploymentInfo.isDebug = true;
if (deploymentInfo.qtPath.isNull())
if (deploymentInfo.qtPath.isNull()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
deploymentInfo.qtPath = QLibraryInfo::path(QLibraryInfo::PrefixPath);
#else
deploymentInfo.qtPath = QLibraryInfo::location(QLibraryInfo::PrefixPath);
#endif
}
if (framework.frameworkDirectory.startsWith(bundlePath)) {
LogError() << framework.frameworkName << "already deployed, skipping.";
@ -1052,7 +1057,11 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, const QStringLis
QStringList allBinaryPaths = QStringList() << applicationBundle.binaryPath << applicationBundle.libraryPaths
<< additionalExecutables;
QSet<QString> allLibraryPaths = getBinaryRPaths(applicationBundle.binaryPath, true);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
allLibraryPaths.insert(QLibraryInfo::path(QLibraryInfo::LibrariesPath));
#else
allLibraryPaths.insert(QLibraryInfo::location(QLibraryInfo::LibrariesPath));
#endif
QList<FrameworkInfo> frameworks = getQtFrameworksForPaths(allBinaryPaths, appBundlePath, allLibraryPaths, useDebugLibs);
if (frameworks.isEmpty() && !alwaysOwerwriteEnabled) {
LogWarning();
@ -1376,7 +1385,11 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
LogNormal() << "QML module search path(s) is" << qmlImportPaths;
// Use qmlimportscanner from QLibraryInfo::BinariesPath
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QString qmlImportScannerPath = QDir::cleanPath(QLibraryInfo::path(QLibraryInfo::BinariesPath) + "/qmlimportscanner");
#else
QString qmlImportScannerPath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlimportscanner");
#endif
// Fallback: Look relative to the macdeployqt binary
if (!QFile(qmlImportScannerPath).exists())
@ -1398,7 +1411,11 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
}
for (const QString &importPath : qmlImportPaths)
argumentList << "-importPath" << importPath;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QString qmlImportsPath = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath);
#else
QString qmlImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
#endif
argumentList.append( "-importPath");
argumentList.append(qmlImportsPath);