aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-10-09 14:33:48 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-10-12 07:58:23 +0000
commitfa5e42f915211637da0d6461c9764962ee47f923 (patch)
treefd19d1326e941260fccde41e2c4668fbeb8b80a9
parent74a49d8b570acf8db4a2d619d9d25d61af3b7cc5 (diff)
libqtprofilesetup: Try to find the library when .prl file is missing
Task-number: QBS-1399 Change-Id: Icf2cf11cf50560cc2229240a592d477a39b69d7a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/lib/qtprofilesetup/qtmoduleinfo.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/lib/qtprofilesetup/qtmoduleinfo.cpp b/src/lib/qtprofilesetup/qtmoduleinfo.cpp
index 8511a6cac..56827a458 100644
--- a/src/lib/qtprofilesetup/qtmoduleinfo.cpp
+++ b/src/lib/qtprofilesetup/qtmoduleinfo.cpp
@@ -280,6 +280,25 @@ static QStringList makeList(const QByteArray &s)
return QString::fromLatin1(s).split(QLatin1Char(' '), QString::SkipEmptyParts);
}
+static QString guessLibraryFilePath(const QString &prlFilePath, const QString &libDir,
+ const QtEnvironment &qtEnv)
+{
+ const QString baseName = QFileInfo(prlFilePath).baseName();
+ const QStringList prefixCandidates{QString(), QLatin1String("lib")};
+ const QStringList suffixCandidates{QLatin1String("so.") + qtEnv.qtVersion,
+ QLatin1String("so"), QLatin1String("a"), QLatin1String("lib"),
+ QLatin1String("dll.a")};
+ for (const QString &prefix : prefixCandidates) {
+ for (const QString &suffix : suffixCandidates) {
+ const QString candidate = libDir + QLatin1Char('/') + prefix + baseName
+ + QLatin1Char('.') + suffix;
+ if (QFile::exists(candidate))
+ return candidate;
+ }
+ }
+ return QString();
+}
+
void QtModuleInfo::setupLibraries(const QtEnvironment &qtEnv, bool debugBuild,
Internal::Set<QString> *nonExistingPrlFiles)
{
@@ -337,19 +356,17 @@ void QtModuleInfo::setupLibraries(const QtEnvironment &qtEnv, bool debugBuild,
if (isNonStaticQt4OnWindows)
prlFilePath.chop(1); // The prl file base name does *not* contain the version number...
prlFilePath.append(QLatin1String(".prl"));
- if (nonExistingPrlFiles->contains(prlFilePath))
- return;
QFile prlFile(prlFilePath);
if (!prlFile.open(QIODevice::ReadOnly)) {
- // We can't error out here, as some modules in a self-built Qt don't have the expected
- // file names. Real-life example: "libQt0Feedback.prl". This is just too stupid
- // to work around, so let's ignore it.
- if (mustExist) {
- qDebug("Skipping prl file '%s', because it cannot be opened (%s).",
- qPrintable(prlFilePath),
- qPrintable(prlFile.errorString()));
+ libFilePath = guessLibraryFilePath(prlFilePath, libDir, qtEnv);
+ if (nonExistingPrlFiles->insert(prlFilePath).second) {
+ if (mustExist && libFilePath.isEmpty()) {
+ qDebug("Could not open prl file '%s' for module '%s' (%s), and failed to deduce "
+ "the library file path. This module will likely not be usable by qbs.",
+ qPrintable(prlFilePath), qPrintable(name),
+ qPrintable(prlFile.errorString()));
+ }
}
- nonExistingPrlFiles->insert(prlFilePath);
return;
}
const QList<QByteArray> prlLines = prlFile.readAll().split('\n');