diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-07-09 20:02:27 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-07-16 15:44:27 +0000 |
commit | 93362e26070c2beac16969b58be8349997921fc5 (patch) | |
tree | 7ba0b9602b2fe8b48bb35903b1a16651d6ea25a4 | |
parent | caaceb30e6d998939f13eb6caccef6dbd49b9558 (diff) |
qmake: slightly optimize processPrlFile() calls
add a parameter that indicates whether the passed filename can be only
the basename of a prl file. if so, we can skip the other attempts at
interpreting the file name. that's not only faster, but also clearer.
Change-Id: I6f6da3f4485216021282a08acaefb53e60e7242a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | qmake/generators/makefile.cpp | 6 | ||||
-rw-r--r-- | qmake/generators/makefile.h | 2 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 12 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 6 |
4 files changed, 13 insertions, 13 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index e7b7a7a10e..d422dfe4c2 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -876,19 +876,19 @@ MakefileGenerator::init() } bool -MakefileGenerator::processPrlFile(QString &file) +MakefileGenerator::processPrlFile(QString &file, bool baseOnly) { bool try_replace_file = false; QString f = fileFixify(file, FileFixifyBackwards); QString meta_file; - if (f.endsWith(Option::prl_ext)) { + if (!baseOnly && f.endsWith(Option::prl_ext)) { meta_file = QMakeMetaInfo::checkLib(f); try_replace_file = true; } else { meta_file = QMakeMetaInfo::checkLib(f + Option::prl_ext); if (!meta_file.isEmpty()) { try_replace_file = true; - } else { + } else if (!baseOnly) { int ext = f.lastIndexOf('.'); if (ext != -1) meta_file = QMakeMetaInfo::checkLib(f.left(ext) + Option::prl_ext); diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index f32bec650e..6694a77841 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -198,7 +198,7 @@ protected: //for prl QString prlFileName(bool fixify=true); void writePrlFile(); - bool processPrlFile(QString &); + bool processPrlFile(QString &, bool baseOnly); virtual void writePrlFile(QTextStream &); //make sure libraries are found diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 894020d2bd..52d34ef513 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -443,7 +443,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) dep_it != libdirs.end(); ++dep_it) { QString libBase = (*dep_it).local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + lib; - if (linkPrl && processPrlFile(libBase)) + if (linkPrl && processPrlFile(libBase, true)) goto found; for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { if (exists(libBase + '.' + (*extit))) @@ -471,12 +471,12 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) } for (const QMakeLocalFileName &dir : qAsConst(frameworkdirs)) { QString frameworkDirectory = dir.local() + "/" + frameworkName + + ".framework/"; - QString suffixedPrl = frameworkDirectory + opt + Option::prl_ext; - if (processPrlFile(suffixedPrl)) + QString suffixedPrl = frameworkDirectory + opt; + if (processPrlFile(suffixedPrl, true)) break; if (hasSuffix) { - QString unsuffixedPrl = frameworkDirectory + frameworkName + Option::prl_ext; - if (processPrlFile(unsuffixedPrl)) + QString unsuffixedPrl = frameworkDirectory + frameworkName; + if (processPrlFile(unsuffixedPrl, true)) break; } } @@ -487,7 +487,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) } } } else if (linkPrl) { - processPrlFile(opt); + processPrlFile(opt, false); } ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS"); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index bca27b7044..b7c2719c1f 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -106,7 +106,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { QString cand = (*dir_it).real() + Option::dir_sep + lib; - if (linkPrl && processPrlFile(cand)) { + if (linkPrl && processPrlFile(cand, true)) { (*it) = cand; goto found; } @@ -124,13 +124,13 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) } else if (linkPrl && type == LibFlagFile) { QString lib = opt.toQString(); if (fileInfo(lib).isAbsolute()) { - if (processPrlFile(lib)) + if (processPrlFile(lib, false)) (*it) = lib; } else { for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { QString cand = (*dir_it).real() + Option::dir_sep + lib; - if (processPrlFile(cand)) { + if (processPrlFile(cand, false)) { (*it) = cand; break; } |