From f71a5c8cde492b41285309b86856b6e82354fa2e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 20 Jul 2012 15:23:01 +0200 Subject: make the windows prl processing more like the unix variant it's more elegant, and more similar code is better. Change-Id: I2b8b036cb70a932fd171e23cf7d3389188401924 Reviewed-by: Friedemann Kleint Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 6 +----- qmake/generators/makefile.h | 2 +- qmake/generators/unix/unixmake.cpp | 9 --------- qmake/generators/unix/unixmake.h | 1 - qmake/generators/win32/winmakefile.cpp | 33 ++++++++++++--------------------- 5 files changed, 14 insertions(+), 37 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 5033bf47b2..497b77b800 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -944,11 +944,7 @@ void MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) { if(var == "QMAKE_PRL_LIBS") { - QStringList &out = project->values("QMAKE_LIBS"); - for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { - if(out.indexOf((*it)) == -1) - out.append((*it)); - } + project->values("QMAKE_CURRENT_PRL_LIBS") += l; } else if(var == "QMAKE_PRL_DEFINES") { QStringList &out = project->values("DEFINES"); for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 3a9bfc17e1..611430a646 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -213,7 +213,7 @@ protected: QString prlFileName(bool fixify=true); void writePrlFile(); bool processPrlFile(QString &); - virtual void processPrlVariable(const QString &, const QStringList &); + void processPrlVariable(const QString &, const QStringList &); virtual void processPrlFiles(); virtual void writePrlFile(QTextStream &); diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index dc991ab9d3..5cd3463769 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -388,15 +388,6 @@ UnixMakefileGenerator::init() } } -void -UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) -{ - if(var == "QMAKE_PRL_LIBS") { - project->values("QMAKE_CURRENT_PRL_LIBS") += l; - } else - MakefileGenerator::processPrlVariable(var, l); -} - QStringList &UnixMakefileGenerator::findDependencies(const QString &file) { diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index 24e8c45264..8fb005200b 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h @@ -61,7 +61,6 @@ protected: virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); } virtual bool doDepends() const { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); } virtual QString defaultInstall(const QString &); - virtual void processPrlVariable(const QString &, const QStringList &); virtual void processPrlFiles(); virtual bool findLibraries(); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index a3c11f1397..5bcd7bb0e1 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -217,24 +217,20 @@ void Win32MakefileGenerator::processPrlFiles() { const QString libArg = project->first("QMAKE_L_FLAG"); - QHash processed; QList libdirs; - for(bool ret = false; true; ret = false) { - //read in any prl files included.. - QStringList l = project->values("QMAKE_LIBS"); - for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - QString opt = (*it).trimmed(); + const QString lflags[] = { "QMAKE_LIBS", QString() }; + for (int i = 0; !lflags[i].isNull(); i++) { + QStringList &l = project->values(lflags[i]); + for (int lit = 0; lit < l.size(); ++lit) { + QString opt = l.at(lit).trimmed(); if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) opt = opt.mid(1, opt.length()-2); if (opt.startsWith(libArg)) { QMakeLocalFileName l(opt.mid(libArg.length())); if (!libdirs.contains(l)) libdirs.append(l); - } else if (!opt.startsWith("/") && !processed.contains(opt)) { - if(processPrlFile(opt)) { - processed.insert(opt, true); - ret = true; - } else if(QDir::isRelativePath(opt) || opt.startsWith("-l")) { + } else if (!opt.startsWith("/")) { + if (!processPrlFile(opt) && (QDir::isRelativePath(opt) || opt.startsWith("-l"))) { QString tmp; if (opt.startsWith("-l")) tmp = opt.mid(2); @@ -242,21 +238,16 @@ Win32MakefileGenerator::processPrlFiles() tmp = opt; for(QList::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) { QString prl = (*it).local() + Option::dir_sep + tmp; - // the original is used as the key - QString orgprl = prl; - if(processed.contains(prl)) { + if (processPrlFile(prl)) break; - } else if(processPrlFile(prl)) { - processed.insert(orgprl, true); - ret = true; - break; - } } } } + QStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS"); + for (int prl = 0; prl < prl_libs.size(); ++prl) + l.insert(lit + prl + 1, prl_libs.at(prl)); + prl_libs.clear(); } - if (!ret) - break; } } -- cgit v1.2.3