diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-05-27 13:28:24 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-28 15:30:45 +0200 |
commit | eaf069902111533f0e675ab32279bb57a5916169 (patch) | |
tree | 6c51546cc0b7ba1b910868ca6676bbad65b91f7f | |
parent | 47c834f073b6564da2baa39aa59177cc5e85f6bf (diff) | |
download | qttools-eaf069902111533f0e675ab32279bb57a5916169.tar.gz |
windeployqt: Observe qtlibinfix.
Determine qtlibinfix by checking on the Qt5Core library name
and re-apply that when building the module names.
Task-number: QTBUG-39297
Change-Id: I73d1253ddd803071f90199fa9aaee7328c7aae8c
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r-- | src/windeployqt/main.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp index 57df71fb1..e9883a151 100644 --- a/src/windeployqt/main.cpp +++ b/src/windeployqt/main.cpp @@ -764,16 +764,19 @@ struct DeployResult unsigned deployedQtLibraries; }; -static QString libraryPath(const QString &libraryLocation, const char *name, Platform platform, bool debug) +static QString libraryPath(const QString &libraryLocation, const char *name, + const QString &qtLibInfix, Platform platform, bool debug) { QString result = libraryLocation + QLatin1Char('/'); if (platform & WindowsBased) { result += QLatin1String(name); + result += qtLibInfix; if (debug) result += QLatin1Char('d'); } else if (platform & UnixBased) { result += QStringLiteral("lib"); result += QLatin1String(name); + result += qtLibInfix; } result += sharedLibrarySuffix(platform); return result; @@ -848,6 +851,16 @@ static inline int qtVersion(const QMap<QString, QString> &qmakeVariables) return (majorVersion << 16) | (minorVersion << 8) | patchVersion; } +// Determine the Qt lib infix from the library path of "Qt5Core<qtblibinfix>[d].dll". +static inline QString qtlibInfixFromCoreLibName(const QString &path, bool isDebug, Platform platform) +{ + const int startPos = path.lastIndexOf(QLatin1Char('/')) + 8; + int endPos = path.lastIndexOf(QLatin1Char('.')); + if (isDebug && (platform & WindowsBased)) + endPos--; + return endPos > startPos ? path.mid(startPos, endPos - startPos) : QString(); +} + static DeployResult deploy(const Options &options, const QMap<QString, QString> &qmakeVariables, QString *errorMessage) @@ -875,8 +888,14 @@ static DeployResult deploy(const Options &options, // Determine application type, check Quick2 is used by looking at the // direct dependencies (do not be fooled by QtWebKit depending on it). - for (int m = 0; m < directDependencyCount; ++m) - result.directlyUsedQtLibraries |= qtModule(dependentQtLibs.at(m)); + QString qtLibInfix; + for (int m = 0; m < directDependencyCount; ++m) { + const unsigned module = qtModule(dependentQtLibs.at(m)); + result.directlyUsedQtLibraries |= module; + if (module == QtCoreModule) + qtLibInfix = qtlibInfixFromCoreLibName(dependentQtLibs.at(m), isDebug, options.platform); + } + const bool usesQml2 = !(options.disabledLibraries & QtQmlModule) && ((result.directlyUsedQtLibraries & QtQmlModule) || (options.additionalLibraries & QtQmlModule)); @@ -984,7 +1003,7 @@ static DeployResult deploy(const Options &options, const size_t qtModulesCount = sizeof(qtModuleEntries)/sizeof(QtModuleEntry); for (size_t i = 0; i < qtModulesCount; ++i) if (result.deployedQtLibraries & qtModuleEntries[i].module) - deployedQtLibraries.push_back(libraryPath(libraryLocation, qtModuleEntries[i].libraryName, options.platform, isDebug)); + deployedQtLibraries.push_back(libraryPath(libraryLocation, qtModuleEntries[i].libraryName, qtLibInfix, options.platform, isDebug)); if (optVerboseLevel >= 1) { std::wcout << "Direct dependencies: " << formatQtModules(result.directlyUsedQtLibraries).constData() |