summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32/mingw_make.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-09-25 14:21:44 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-10-02 14:01:20 +0000
commitdd9ec15640fb48fc27011b8f9420411a1637a203 (patch)
tree1753ff55bbf9cea1e3e28a62b20a1e5db3334151 /qmake/generators/win32/mingw_make.cpp
parentc00e11d573447c0247f5db4a1141f6c307e0b36d (diff)
rewrite windows library handling
first, store the library's full name in the .prl file, like we do on unix. this is not expected to have any side effects, as QMAKE_PRL_TARGET was entirely unused under windows so far. then, rewrite the mingw library handling: instead of letting the linker resolve the actual libraries, do it ourselves like we do for msvc. we could not do that before due to the partial file names in the .prl files: if the library didn't exist at qmake execution time, we'd have to guess the file extension (the msvc generators never had that problem, as they know about only one possible extension for libraries anyway). make use of processPrlFile()'s ability to replace the reference to the .prl file with the actual library. that way we don't need to re-assemble the file name from pieces, which was fragile and inefficient. QMAKE_*_VERSION_OVERRIDE does not affect libraries coming with .prl files any more. additionally, it is now used literally (not numerically), and values less or equal to zero lost their special meaning as "none" - this isn't a problem, because that's the default anyway, and there is no need to override bogus versions from .prl files any more. no changelog for that, as i found no public traces of that feature outside qtbase. [ChangeLog][qmake][Windows] Libraries coming with .prl files can now have non-standard file extensions and a major version of zero. [ChangeLog][qmake][Windows][Important Behavior Changes] The .prl files written by earlier versions of Qt cannot be used any more. This will affect you if you depend on 3rd party libraries which come with .prl files. Patch up QMAKE_PRL_TARGET to contain the complete file name of the library, and replace any /LIBPATH: in QMAKE_PRL_LIBS with -L. (the part about /LIBPATH: actually refers to the next commit.) Change-Id: I07399341bff0609cb6db9660cbc62b141fb2ad96 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'qmake/generators/win32/mingw_make.cpp')
-rw-r--r--qmake/generators/win32/mingw_make.cpp41
1 files changed, 25 insertions, 16 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index f8b19b3785..fc21dd4dd2 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -71,39 +71,48 @@ bool MingwMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
{
QList<QMakeLocalFileName> dirs;
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
+ static const QLatin1String extens[] =
+ { QLatin1String(".dll.a"), QLatin1String(".a"), QLatin1String(0) };
for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]);
ProStringList::Iterator it = l.begin();
while (it != l.end()) {
if ((*it).startsWith("-l")) {
QString steam = (*it).mid(2).toQString();
- QString out;
+ ProString verovr =
+ project->first(ProKey("QMAKE_" + steam.toUpper() + "_VERSION_OVERRIDE"));
for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
- QString extension;
- int ver = findHighestVersion((*dir_it).local(), steam);
- if (ver > 0)
- extension += QString::number(ver);
- QString libBase = (*dir_it).local() + '/' + steam;
- if ((linkPrl && processPrlFile(libBase))
- || exists(libBase + extension + ".a")
- || exists(libBase + extension + ".dll.a")) {
- out = *it + extension;
- break;
+ QString cand = (*dir_it).real() + Option::dir_sep + steam;
+ if (linkPrl && processPrlFile(cand)) {
+ (*it) = cand;
+ goto found;
+ }
+ QString libBase = (*dir_it).local() + '/' + steam + verovr;
+ for (int e = 0; extens[e].data(); e++) {
+ if (exists(libBase + extens[e])) {
+ (*it) = cand + verovr + extens[e];
+ goto found;
+ }
}
}
- if (!out.isEmpty()) // We assume if it never finds it that its correct
- (*it) = out;
+ // We assume if it never finds it that its correct
+ found: ;
} else if ((*it).startsWith("-L")) {
QMakeLocalFileName f((*it).mid(2).toQString());
dirs.append(f);
*it = "-L" + f.real();
} else if (linkPrl && !(*it).startsWith('-')) {
QString prl = (*it).toQString();
- if (!processPrlFile(prl) && QDir::isRelativePath(prl)) {
+ if (fileInfo(prl).isAbsolute()) {
+ if (processPrlFile(prl))
+ (*it) = prl;
+ } else {
for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
- prl = (*dir_it).local() + '/' + *it;
- if (processPrlFile(prl))
+ QString cand = (*dir_it).real() + Option::dir_sep + prl;
+ if (processPrlFile(cand)) {
+ (*it) = cand;
break;
+ }
}
}
}