Skip to content

Commit

Permalink
make QMakeMetaInfo a little less inefficient with libtool .la files
Browse files Browse the repository at this point in the history
don't read the spec from scratch for every library just to get
QMAKE_LFLAGS_RPATH. we can perfectly use our current project for that
purpose.

Change-Id: I4e408b3fd5de81652181df032aa53cd8f2f8f806
Reviewed-by: Joerg Bornemann <[email protected]>
  • Loading branch information
ossilator authored and Qt by Nokia committed Sep 5, 2012
1 parent 09df6be commit 791cb02
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion qmake/generators/mac/pbuilder_pbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
*/
QString lib_file = (*lit) + Option::dir_sep + lib;
if(QMakeMetaInfo::libExists(lib_file)) {
QMakeMetaInfo libinfo;
QMakeMetaInfo libinfo(project);
if(libinfo.readLib(lib_file)) {
if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
Expand Down
2 changes: 1 addition & 1 deletion qmake/generators/makefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ MakefileGenerator::processPrlFile(QString &file)
if(!meta_file.isEmpty()) {
QString f = fileFixify(real_meta_file, qmake_getpwd(), Option::output_dir);
if(QMakeMetaInfo::libExists(f)) {
QMakeMetaInfo libinfo;
QMakeMetaInfo libinfo(project);
debug_msg(1, "Processing PRL file: %s", real_meta_file.toLatin1().constData());
if(!libinfo.readLib(f)) {
fprintf(stderr, "Error processing meta file: %s\n", real_meta_file.toLatin1().constData());
Expand Down
2 changes: 1 addition & 1 deletion qmake/generators/unix/unixmake2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
const QStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
QStringList::ConstIterator it;
for(it = l.begin(); it != l.end(); ++it) {
QMakeMetaInfo libinfo;
QMakeMetaInfo libinfo(project);
if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
QString dir;
int slsh = (*it).lastIndexOf(Option::dir_sep);
Expand Down
2 changes: 1 addition & 1 deletion qmake/generators/win32/winmakefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem
if(!exists(bd))
return -1;

QMakeMetaInfo libinfo;
QMakeMetaInfo libinfo(project);
bool libInfoRead = libinfo.readLib(bd + Option::dir_sep + stem);

// If the library, for which we're trying to find the highest version
Expand Down
10 changes: 2 additions & 8 deletions qmake/meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ QT_BEGIN_NAMESPACE

QHash<QString, QHash<QString, QStringList> > QMakeMetaInfo::cache_vars;

QMakeMetaInfo::QMakeMetaInfo()
QMakeMetaInfo::QMakeMetaInfo(QMakeProject *_conf)
: conf(_conf)
{

}
Expand Down Expand Up @@ -180,19 +181,12 @@ QMakeMetaInfo::readLibtoolFile(const QString &f)
dep = dep.mid(1, dep.length() - 2);
lst = dep.trimmed().split(" ");
}
QMakeProject *conf = NULL;
for(QStringList::Iterator lit = lst.begin(); lit != lst.end(); ++lit) {
if((*lit).startsWith("-R")) {
if(!conf) {
conf = new QMakeProject;
conf->read(QMakeProject::ReadAll ^ QMakeProject::ReadProFile);
}
if(!conf->isEmpty("QMAKE_LFLAGS_RPATH"))
(*lit) = conf->first("QMAKE_LFLAGS_RPATH") + (*lit).mid(2);
}
}
if(conf)
delete conf;
vars["QMAKE_PRL_LIBS"] += lst;
}
}
Expand Down
5 changes: 4 additions & 1 deletion qmake/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@

QT_BEGIN_NAMESPACE

class QMakeProject;

class QMakeMetaInfo
{
bool readLibtoolFile(const QString &f);
bool readPkgCfgFile(const QString &f);
QMakeProject *conf;
QHash<QString, QStringList> vars;
QString meta_type;
static QHash<QString, QHash<QString, QStringList> > cache_vars;
void clear();
public:
QMakeMetaInfo();
QMakeMetaInfo(QMakeProject *_conf);

bool readLib(QString lib);
static QString findLib(QString lib);
Expand Down

0 comments on commit 791cb02

Please sign in to comment.