summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-06-28 17:57:53 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-07-16 15:44:37 +0000
commit7a33f49e15fd5bd1e5f599f85179b15a90a1684d (patch)
tree418a20b55719c6e717fe03ddf0d5e09072a3d957 /qmake/generators/win32
parentdcb3a13fa037897322c3905903db9e4c98717501 (diff)
qmake: fix lookup of .prl files for libs specified by full filename
under windows, libraries can have a numeric suffix derived from VERSION, and (under MinGW) a unix-like "lib" prefix - neither of which .prl files have. therefore, we had to make the back-mapping from the library to the .prl file reverse-engineer the original TARGET's name. we verify whether we actually got the right file by comparing the target specified inside the .prl file with what we started from. this fixes linking of transitive deps of static deps. the alternative of changing the .prl naming pattern to avoid the back-mapping was discarded, as a) it would be backwards incompatible and b) it would break project-internal -lfoo references to versioned libs. Change-Id: Ia9b899fe6a5700fee528bd1dacf130caf083cdd6 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r--qmake/generators/win32/mingw_make.cpp13
-rw-r--r--qmake/generators/win32/mingw_make.h2
-rw-r--r--qmake/generators/win32/winmakefile.cpp17
-rw-r--r--qmake/generators/win32/winmakefile.h2
4 files changed, 34 insertions, 0 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 6fcfe96380..25e50305e6 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -73,6 +73,19 @@ MingwMakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
return MakefileGenerator::parseLibFlag(flag, arg);
}
+bool MingwMakefileGenerator::processPrlFileBase(QString &origFile, const QStringRef &origName,
+ const QStringRef &fixedBase, int slashOff)
+{
+ if (origName.startsWith("lib")) {
+ QString newFixedBase = fixedBase.left(slashOff) + fixedBase.mid(slashOff + 3);
+ if (Win32MakefileGenerator::processPrlFileBase(origFile, origName,
+ QStringRef(&newFixedBase), slashOff)) {
+ return true;
+ }
+ }
+ return Win32MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff);
+}
+
bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h
index 6f041cfd4a..934d28456d 100644
--- a/qmake/generators/win32/mingw_make.h
+++ b/qmake/generators/win32/mingw_make.h
@@ -42,6 +42,8 @@ protected:
using MakefileGenerator::escapeDependencyPath;
virtual QString escapeDependencyPath(const QString &path) const;
virtual ProString fixLibFlag(const ProString &lib);
+ virtual bool processPrlFileBase(QString &origFile, const QStringRef &origName,
+ const QStringRef &fixedBase, int slashOff);
virtual QString getManifestFileForRcFile() const;
bool writeMakefile(QTextStream &);
void init();
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index b7c2719c1f..a1adc2de58 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -163,6 +163,23 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
return true;
}
+bool Win32MakefileGenerator::processPrlFileBase(QString &origFile, const QStringRef &origName,
+ const QStringRef &fixedBase, int slashOff)
+{
+ if (MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff))
+ return true;
+ for (int off = fixedBase.length(); off > slashOff; off--) {
+ if (!fixedBase.at(off - 1).isDigit()) {
+ if (off != fixedBase.length()) {
+ return MakefileGenerator::processPrlFileBase(
+ origFile, origName, fixedBase.left(off), slashOff);
+ }
+ break;
+ }
+ }
+ return false;
+}
+
void Win32MakefileGenerator::processVars()
{
if (project->first("TEMPLATE").endsWith("aux"))
diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h
index b85a6b67df..a2a0c9a63c 100644
--- a/qmake/generators/win32/winmakefile.h
+++ b/qmake/generators/win32/winmakefile.h
@@ -58,6 +58,8 @@ protected:
virtual LibFlagType parseLibFlag(const ProString &flag, ProString *arg);
virtual ProString fixLibFlag(const ProString &lib);
+ virtual bool processPrlFileBase(QString &origFile, const QStringRef &origName,
+ const QStringRef &fixedBase, int slashOff);
void processVars();
void fixTargetExt();