summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@theqtcompany.com>2015-03-16 14:15:27 +0100
committerOliver Wolff <oliver.wolff@theqtcompany.com>2015-04-07 12:55:24 +0000
commit32849f4997e13f540a6c99c9a644239e19839d73 (patch)
tree65d8bd3f72b81d5e7768e9ec1e1cbb95c4e3f6ab /qmake
parentf8cb4ee31026049de4af341d2341eaa4accdf75b (diff)
qmake: Rework dll deployment
QT_INSTALL_LIBS is not the right place to check for Qt dlls, as they cannot be found there in a non-developer build. In order to be able to find the dlls and make adding dll locations easier for the user, QMAKE_DLLS_PATHS was added. On Windows, the variable points to Qt's bin directory by default. Task-number: QTBUG-44960 Change-Id: Ie4e5beeaadee798a055599387e842d7c0502c27a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp52
1 files changed, 32 insertions, 20 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 4822bcf22a..3222030018 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1267,31 +1267,43 @@ void VcprojGenerator::initDeploymentTool()
if (targetPath.endsWith("/") || targetPath.endsWith("\\"))
targetPath.chop(1);
}
-
+ ProStringList dllPaths = project->values("QMAKE_DLL_PATHS");
// Only deploy Qt libs for shared build
- if (!project->values("QMAKE_QT_DLL").isEmpty()) {
+ if (!dllPaths.isEmpty()) {
// FIXME: This code should actually resolve the libraries from all Qt modules.
- const QString &qtdir = project->propertyValue(ProKey("QT_INSTALL_LIBS/get")).toQString();
ProStringList arg = project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE");
for (ProStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) {
- if (it->contains(qtdir)) {
- QString dllName = (*it).toQString();
+ QString dllName = (*it).toQString();
+ dllName.replace(QLatin1Char('\\'), QLatin1Char('/'));
+ // LIBPATH isn't relevant for deployment
+ if (dllName.startsWith(QLatin1String("/LIBPATH:")))
+ continue;
+ // We want to deploy .dlls not .libs
+ if (dllName.endsWith(QLatin1String(".lib")))
+ dllName.replace(dllName.length() - 3, 3, QLatin1String("dll"));
+ // Use only the file name and check in Qt's install path and LIBPATHs to check for existence
+ dllName.remove(0, dllName.lastIndexOf(QLatin1Char('/')) + 1);
+ QFileInfo info;
+ foreach (const ProString &dllPath, dllPaths) {
+ QString absoluteDllFilePath = dllPath.toQString();
+ if (!absoluteDllFilePath.endsWith(QLatin1Char('/')))
+ absoluteDllFilePath += QLatin1Char('/');
+ absoluteDllFilePath += dllName;
+ info = QFileInfo(absoluteDllFilePath);
+ if (info.exists())
+ break;
+ }
- if (dllName.contains(QLatin1String("QAxContainer"))
- || dllName.contains(QLatin1String("qtmain"))
- || dllName.contains(QLatin1String("QtUiTools")))
- continue;
- dllName.replace(QLatin1String(".lib") , QLatin1String(".dll"));
- QFileInfo info(dllName);
- if (conf.WinRT) {
- QString absoluteFilePath(QDir::toNativeSeparators(info.absoluteFilePath()));
- vcProject.DeploymentFiles.addFile(absoluteFilePath);
- } else {
- conf.deployment.AdditionalFiles += info.fileName()
- + "|" + QDir::toNativeSeparators(info.absolutePath())
- + "|" + targetPath
- + "|0;";
- }
+ if (!info.exists())
+ continue;
+ if (conf.WinRT) {
+ QString absoluteFilePath(QDir::toNativeSeparators(info.absoluteFilePath()));
+ vcProject.DeploymentFiles.addFile(absoluteFilePath);
+ } else {
+ conf.deployment.AdditionalFiles += info.fileName()
+ + "|" + QDir::toNativeSeparators(info.absolutePath())
+ + "|" + targetPath
+ + "|0;";
}
}
}