int Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) { QString bd = Option::fixPathToLocalOS(d, TRUE); if(!QFile::exists(bd)) return -1; if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); QDir dir(bd); int biggest=-1; QStringList entries = dir.entryList(); QString dllStem = stem + QTDLL_POSTFIX; QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { if(regx.exactMatch((*it))) biggest = QMAX(biggest, (regx.cap(1) == dllStem || regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); } QMakeMetaInfo libinfo; if(libinfo.readLib(bd + dllStem)) { if(!libinfo.isEmpty("QMAKE_PRL_VERSION")) biggest = QMAX(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); } return biggest; }
int Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext) { QString bd = Option::fixPathToLocalOS(d, true); if(!exists(bd)) return -1; QString dllStem = stem + QTDLL_POSTFIX; QMakeMetaInfo libinfo; bool libInfoRead = libinfo.readLib(bd + Option::dir_sep + dllStem); // If the library, for which we're trying to find the highest version // number, is a static library if (libInfoRead && libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib")) return -1; if(!project->values("QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE").isEmpty()) return project->values("QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE").first().toInt(); int biggest=-1; if(!project->isActiveConfig("no_versionlink")) { static QHash<QString, QStringList> dirEntryListCache; QStringList entries = dirEntryListCache.value(bd); if (entries.isEmpty()) { QDir dir(bd); entries = dir.entryList(); dirEntryListCache.insert(bd, entries); } QRegExp regx(QString("((lib)?%1([0-9]*)).(%2|prl)$").arg(dllStem).arg(ext), Qt::CaseInsensitive); for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { if(regx.exactMatch((*it))) { if (!regx.cap(3).isEmpty()) { bool ok = true; int num = regx.cap(3).toInt(&ok); biggest = qMax(biggest, (!ok ? -1 : num)); } } } } if(libInfoRead && !libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib") && !libinfo.isEmpty("QMAKE_PRL_VERSION")) biggest = qMax(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); return biggest; }