diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-24 11:17:59 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-24 13:28:24 +0000 |
commit | 1993bf253f663e12572fc12b6d0d9100241d352a (patch) | |
tree | 7fb28a81470fea4b0ef7ef73dbd05626344a224d | |
parent | 2890f2d0c7dd01c975f78120ac327c8895db4671 (diff) | |
download | qttools-1993bf253f663e12572fc12b6d0d9100241d352a.tar.gz qttools-1993bf253f663e12572fc12b6d0d9100241d352a.tar.bz2 qttools-1993bf253f663e12572fc12b6d0d9100241d352a.zip |
windeployqt: Deploy MSVC debug runtime dlls instead of redist package.
The redistributable package only contains the release mode DLLs, so
it does not make sense for debug builds. Deploy DLLs instead for
debug builds.
[ChangeLog][windeployqt] windeployqt now deploys the MSVC debug mode runtime
dlls instead of the redistributable package for debug builds.
Change-Id: I84e0ec784c3dde72f206ce69dcaf1169d0fe0fef
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | src/windeployqt/main.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp index 023f0dc4..f111df93 100644 --- a/src/windeployqt/main.cpp +++ b/src/windeployqt/main.cpp @@ -927,7 +927,7 @@ static QString libraryPath(const QString &libraryLocation, const char *name, return result; } -static QStringList compilerRunTimeLibs(Platform platform, unsigned wordSize) +static QStringList compilerRunTimeLibs(Platform platform, bool isDebug, unsigned wordSize) { QStringList result; switch (platform) { @@ -966,21 +966,33 @@ static QStringList compilerRunTimeLibs(Platform platform, unsigned wordSize) << QDir::toNativeSeparators(vcRedistDirName).toStdWString() << ".\n"; break; } - const QStringList countryCodes = vcRedistDir.entryList(QStringList(QStringLiteral("[0-9]*")), QDir::Dirs); - QString redist; - if (!countryCodes.isEmpty()) { - const QFileInfo fi(vcRedistDirName + slash + countryCodes.first() + slash - + QStringLiteral("vcredist_x") + QLatin1String(wordSize > 32 ? "64" : "86") - + QStringLiteral(".exe")); - if (fi.isFile()) - redist = fi.absoluteFilePath(); + QStringList redistFiles; + const QString wordSizeString(QLatin1String(wordSize > 32 ? "x64" : "x86")); + if (isDebug) { + // Append DLLs from Debug_NonRedist\x??\Microsoft.VC<version>.DebugCRT. + if (vcRedistDir.cd(QLatin1String("Debug_NonRedist")) && vcRedistDir.cd(wordSizeString)) { + const QStringList names = vcRedistDir.entryList(QStringList(QStringLiteral("Microsoft.VC*.DebugCRT")), QDir::Dirs); + if (!names.isEmpty() && vcRedistDir.cd(names.first())) { + foreach (const QFileInfo &dll, vcRedistDir.entryInfoList(QStringList(QLatin1String("*.dll")))) + redistFiles.append(dll.absoluteFilePath()); + } + } + } else { // release: Bundle vcredist<>.exe + const QStringList countryCodes = vcRedistDir.entryList(QStringList(QStringLiteral("[0-9]*")), QDir::Dirs); + if (!countryCodes.isEmpty()) { + const QFileInfo fi(vcRedistDirName + slash + countryCodes.first() + slash + + QStringLiteral("vcredist_") + wordSizeString + + QStringLiteral(".exe")); + if (fi.isFile()) + redistFiles.append(fi.absoluteFilePath()); + } } - if (redist.isEmpty()) { - std::wcerr << "Warning: Cannot find Visual Studio redistributable in " - << QDir::toNativeSeparators(vcRedistDirName).toStdWString() << ".\n"; + if (redistFiles.isEmpty()) { + std::wcerr << "Warning: Cannot find Visual Studio " << (isDebug ? "debug" : "release") + << " redistributable files in " << QDir::toNativeSeparators(vcRedistDirName).toStdWString() << ".\n"; break; } - result.append(redist); + result.append(redistFiles); } default: break; @@ -1229,7 +1241,7 @@ static DeployResult deploy(const Options &options, options.directory : options.libraryDirectory; QStringList libraries = deployedQtLibraries; if (options.compilerRunTime) - libraries.append(compilerRunTimeLibs(options.platform, wordSize)); + libraries.append(compilerRunTimeLibs(options.platform, isDebug, wordSize)); foreach (const QString &qtLib, libraries) { if (!updateFile(qtLib, targetPath, options.updateFileFlags, options.json, errorMessage)) return result; |