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 <Friedemann.Kleint@nokia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-07-20 15:23:01 +02:00 committed by Qt by Nokia
parent 202f08dc09
commit f71a5c8cde
5 changed files with 14 additions and 37 deletions

View File

@ -944,11 +944,7 @@ void
MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
{ {
if(var == "QMAKE_PRL_LIBS") { if(var == "QMAKE_PRL_LIBS") {
QStringList &out = project->values("QMAKE_LIBS"); project->values("QMAKE_CURRENT_PRL_LIBS") += l;
for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if(out.indexOf((*it)) == -1)
out.append((*it));
}
} else if(var == "QMAKE_PRL_DEFINES") { } else if(var == "QMAKE_PRL_DEFINES") {
QStringList &out = project->values("DEFINES"); QStringList &out = project->values("DEFINES");
for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {

View File

@ -213,7 +213,7 @@ protected:
QString prlFileName(bool fixify=true); QString prlFileName(bool fixify=true);
void writePrlFile(); void writePrlFile();
bool processPrlFile(QString &); bool processPrlFile(QString &);
virtual void processPrlVariable(const QString &, const QStringList &); void processPrlVariable(const QString &, const QStringList &);
virtual void processPrlFiles(); virtual void processPrlFiles();
virtual void writePrlFile(QTextStream &); virtual void writePrlFile(QTextStream &);

View File

@ -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 QStringList
&UnixMakefileGenerator::findDependencies(const QString &file) &UnixMakefileGenerator::findDependencies(const QString &file)
{ {

View File

@ -61,7 +61,6 @@ protected:
virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); } virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
virtual bool doDepends() const { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); } virtual bool doDepends() const { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); }
virtual QString defaultInstall(const QString &); virtual QString defaultInstall(const QString &);
virtual void processPrlVariable(const QString &, const QStringList &);
virtual void processPrlFiles(); virtual void processPrlFiles();
virtual bool findLibraries(); virtual bool findLibraries();

View File

@ -217,24 +217,20 @@ void
Win32MakefileGenerator::processPrlFiles() Win32MakefileGenerator::processPrlFiles()
{ {
const QString libArg = project->first("QMAKE_L_FLAG"); const QString libArg = project->first("QMAKE_L_FLAG");
QHash<QString, bool> processed;
QList<QMakeLocalFileName> libdirs; QList<QMakeLocalFileName> libdirs;
for(bool ret = false; true; ret = false) { const QString lflags[] = { "QMAKE_LIBS", QString() };
//read in any prl files included.. for (int i = 0; !lflags[i].isNull(); i++) {
QStringList l = project->values("QMAKE_LIBS"); QStringList &l = project->values(lflags[i]);
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (int lit = 0; lit < l.size(); ++lit) {
QString opt = (*it).trimmed(); QString opt = l.at(lit).trimmed();
if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0])
opt = opt.mid(1, opt.length()-2); opt = opt.mid(1, opt.length()-2);
if (opt.startsWith(libArg)) { if (opt.startsWith(libArg)) {
QMakeLocalFileName l(opt.mid(libArg.length())); QMakeLocalFileName l(opt.mid(libArg.length()));
if (!libdirs.contains(l)) if (!libdirs.contains(l))
libdirs.append(l); libdirs.append(l);
} else if (!opt.startsWith("/") && !processed.contains(opt)) { } else if (!opt.startsWith("/")) {
if(processPrlFile(opt)) { if (!processPrlFile(opt) && (QDir::isRelativePath(opt) || opt.startsWith("-l"))) {
processed.insert(opt, true);
ret = true;
} else if(QDir::isRelativePath(opt) || opt.startsWith("-l")) {
QString tmp; QString tmp;
if (opt.startsWith("-l")) if (opt.startsWith("-l"))
tmp = opt.mid(2); tmp = opt.mid(2);
@ -242,22 +238,17 @@ Win32MakefileGenerator::processPrlFiles()
tmp = opt; tmp = opt;
for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) { for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) {
QString prl = (*it).local() + Option::dir_sep + tmp; QString prl = (*it).local() + Option::dir_sep + tmp;
// the original is used as the key if (processPrlFile(prl))
QString orgprl = prl;
if(processed.contains(prl)) {
break;
} else if(processPrlFile(prl)) {
processed.insert(orgprl, true);
ret = true;
break; 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;
}
} }