merge processPrlFiles() into findLibraries()
seems pointless to tear apart the functions, on the way duplicating some boilerplate. Change-Id: Ide3697ca1c931e8de607ac48c21cecce4781fe13 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
parent
d49169ae89
commit
2677cc47fc
@ -252,10 +252,12 @@ MakefileGenerator::setProjectFile(QMakeProject *p)
|
|||||||
else
|
else
|
||||||
target_mode = TARG_UNIX_MODE;
|
target_mode = TARG_UNIX_MODE;
|
||||||
init();
|
init();
|
||||||
findLibraries();
|
bool linkPrl = (Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE)
|
||||||
if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE &&
|
&& project->isActiveConfig("link_prl");
|
||||||
project->isActiveConfig("link_prl")) //load up prl's'
|
bool mergeLflags = linkPrl
|
||||||
processPrlFiles();
|
&& !project->isActiveConfig("no_smart_library_merge")
|
||||||
|
&& !project->isActiveConfig("no_lflags_merge");
|
||||||
|
findLibraries(linkPrl, mergeLflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProStringList
|
ProStringList
|
||||||
@ -944,12 +946,6 @@ MakefileGenerator::filterIncludedFiles(const char *var)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MakefileGenerator::processPrlFiles()
|
|
||||||
{
|
|
||||||
qFatal("MakefileGenerator::processPrlFiles() called!");
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString
|
static QString
|
||||||
qv(const ProString &val)
|
qv(const ProString &val)
|
||||||
{
|
{
|
||||||
|
@ -197,11 +197,10 @@ protected:
|
|||||||
QString prlFileName(bool fixify=true);
|
QString prlFileName(bool fixify=true);
|
||||||
void writePrlFile();
|
void writePrlFile();
|
||||||
bool processPrlFile(QString &);
|
bool processPrlFile(QString &);
|
||||||
virtual void processPrlFiles();
|
|
||||||
virtual void writePrlFile(QTextStream &);
|
virtual void writePrlFile(QTextStream &);
|
||||||
|
|
||||||
//make sure libraries are found
|
//make sure libraries are found
|
||||||
virtual bool findLibraries();
|
virtual bool findLibraries(bool linkPrl, bool mergeLflags);
|
||||||
|
|
||||||
//for retrieving values and lists of values
|
//for retrieving values and lists of values
|
||||||
virtual QString var(const ProKey &var) const;
|
virtual QString var(const ProKey &var) const;
|
||||||
@ -276,7 +275,7 @@ inline bool MakefileGenerator::noIO() const
|
|||||||
inline QString MakefileGenerator::defaultInstall(const QString &)
|
inline QString MakefileGenerator::defaultInstall(const QString &)
|
||||||
{ return QString(""); }
|
{ return QString(""); }
|
||||||
|
|
||||||
inline bool MakefileGenerator::findLibraries()
|
inline bool MakefileGenerator::findLibraries(bool, bool)
|
||||||
{ return true; }
|
{ return true; }
|
||||||
|
|
||||||
inline MakefileGenerator::~MakefileGenerator()
|
inline MakefileGenerator::~MakefileGenerator()
|
||||||
|
@ -375,12 +375,14 @@ UnixMakefileGenerator::fixLibFlag(const ProString &lib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
UnixMakefileGenerator::findLibraries()
|
UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
||||||
{
|
{
|
||||||
QList<QMakeLocalFileName> libdirs;
|
QList<QMakeLocalFileName> libdirs, frameworkdirs;
|
||||||
int libidx = 0;
|
int libidx = 0, fwidx = 0;
|
||||||
foreach (const ProString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
|
foreach (const ProString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
|
||||||
libdirs.append(QMakeLocalFileName(dlib.toQString()));
|
libdirs.append(QMakeLocalFileName(dlib.toQString()));
|
||||||
|
frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
|
||||||
|
frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
|
||||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||||
for (int i = 0; lflags[i]; i++) {
|
for (int i = 0; lflags[i]; i++) {
|
||||||
ProStringList &l = project->values(lflags[i]);
|
ProStringList &l = project->values(lflags[i]);
|
||||||
@ -398,94 +400,58 @@ UnixMakefileGenerator::findLibraries()
|
|||||||
libdirs.insert(libidx++, f);
|
libdirs.insert(libidx++, f);
|
||||||
} else if(opt.startsWith("-l")) {
|
} else if(opt.startsWith("-l")) {
|
||||||
QString lib = opt.mid(2);
|
QString lib = opt.mid(2);
|
||||||
bool found = false;
|
|
||||||
ProStringList extens;
|
ProStringList extens;
|
||||||
extens << project->first("QMAKE_EXTENSION_SHLIB") << "a";
|
extens << project->first("QMAKE_EXTENSION_SHLIB") << "a";
|
||||||
for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
|
|
||||||
for (QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin();
|
for (QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin();
|
||||||
dep_it != libdirs.end(); ++dep_it) {
|
dep_it != libdirs.end(); ++dep_it) {
|
||||||
QString pathToLib = ((*dep_it).local() + '/'
|
QString libBase = (*dep_it).local() + '/'
|
||||||
+ project->first("QMAKE_PREFIX_SHLIB")
|
+ project->first("QMAKE_PREFIX_SHLIB") + lib;
|
||||||
+ lib + '.' + (*extit));
|
if (linkPrl && processPrlFile(libBase))
|
||||||
if (exists(pathToLib)) {
|
goto found;
|
||||||
found = true;
|
for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
|
||||||
|
if (exists(libBase + '.' + (*extit)))
|
||||||
|
goto found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
found: ;
|
||||||
|
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-F")) {
|
||||||
|
QMakeLocalFileName f(opt.mid(2));
|
||||||
|
if (!frameworkdirs.contains(f))
|
||||||
|
frameworkdirs.insert(fwidx++, f);
|
||||||
|
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
|
||||||
|
if (linkPrl) {
|
||||||
|
if (opt.length() == 10)
|
||||||
|
opt = (*++it).toQString();
|
||||||
|
else
|
||||||
|
opt = opt.mid(10).trimmed();
|
||||||
|
foreach (const QMakeLocalFileName &dir, frameworkdirs) {
|
||||||
|
QString prl = dir.local() + "/" + opt + ".framework/" + opt + Option::prl_ext;
|
||||||
|
if (processPrlFile(prl))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
|
|
||||||
if (opt.length() == 10)
|
if (opt.length() == 10)
|
||||||
++it;
|
++it;
|
||||||
// Skip
|
// Skip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
} else if (linkPrl) {
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
UnixMakefileGenerator::processPrlFiles()
|
|
||||||
{
|
|
||||||
QList<QMakeLocalFileName> libdirs, frameworkdirs;
|
|
||||||
int libidx = 0, fwidx = 0;
|
|
||||||
foreach (const ProString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
|
|
||||||
libdirs.append(QMakeLocalFileName(dlib.toQString()));
|
|
||||||
frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
|
|
||||||
frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
|
|
||||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
|
||||||
for (int i = 0; lflags[i]; i++) {
|
|
||||||
ProStringList &l = project->values(lflags[i]);
|
|
||||||
for(int lit = 0; lit < l.size(); ++lit) {
|
|
||||||
QString opt = l.at(lit).toQString();
|
|
||||||
if(opt.startsWith("-")) {
|
|
||||||
if (opt.startsWith("-L")) {
|
|
||||||
QMakeLocalFileName l(opt.mid(2));
|
|
||||||
if(!libdirs.contains(l))
|
|
||||||
libdirs.insert(libidx++, l);
|
|
||||||
} else if(opt.startsWith("-l")) {
|
|
||||||
QString lib = opt.right(opt.length() - 2);
|
|
||||||
for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
|
|
||||||
QString prl = libdirs[dep_i].local() + '/'
|
|
||||||
+ project->first("QMAKE_PREFIX_SHLIB") + lib;
|
|
||||||
if (processPrlFile(prl))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-F")) {
|
|
||||||
QMakeLocalFileName f(opt.right(opt.length()-2));
|
|
||||||
if(!frameworkdirs.contains(f))
|
|
||||||
frameworkdirs.insert(fwidx++, f);
|
|
||||||
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
|
|
||||||
if(opt.length() > 11)
|
|
||||||
opt = opt.mid(11).trimmed();
|
|
||||||
else
|
|
||||||
opt = l.at(++lit).toQString();
|
|
||||||
foreach (const QMakeLocalFileName &dir, frameworkdirs) {
|
|
||||||
QString prl = dir.local() + "/" + opt + ".framework/" + opt + Option::prl_ext;
|
|
||||||
if(processPrlFile(prl))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(!opt.isNull()) {
|
|
||||||
processPrlFile(opt);
|
processPrlFile(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
|
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
|
||||||
if(!prl_libs.isEmpty()) {
|
for (int prl = 0; prl < prl_libs.size(); ++prl)
|
||||||
for(int prl = 0; prl < prl_libs.size(); ++prl)
|
it = l.insert(++it, prl_libs.at(prl));
|
||||||
l.insert(++lit, prl_libs.at(prl));
|
|
||||||
prl_libs.clear();
|
prl_libs.clear();
|
||||||
}
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
//merge them into a logical order
|
if (mergeLflags) {
|
||||||
if(!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) {
|
|
||||||
QHash<ProKey, ProStringList> lflags;
|
QHash<ProKey, ProStringList> lflags;
|
||||||
for(int lit = 0; lit < l.size(); ++lit) {
|
for(int lit = 0; lit < l.size(); ++lit) {
|
||||||
ProKey arch("default");
|
ProKey arch("default");
|
||||||
ProString opt = l.at(lit);
|
ProString opt = l.at(lit);
|
||||||
if(opt.startsWith("-")) {
|
if (opt.startsWith('-')) {
|
||||||
if (target_mode == TARG_MAC_MODE && opt.startsWith("-Xarch")) {
|
if (target_mode == TARG_MAC_MODE && opt.startsWith("-Xarch")) {
|
||||||
if (opt.length() > 7) {
|
if (opt.length() > 7) {
|
||||||
arch = opt.mid(7).toKey();
|
arch = opt.mid(7).toKey();
|
||||||
@ -493,21 +459,20 @@ UnixMakefileGenerator::processPrlFiles()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.startsWith("-L") ||
|
if (opt.startsWith("-L")
|
||||||
(target_mode == TARG_MAC_MODE && opt.startsWith("-F"))) {
|
|| (target_mode == TARG_MAC_MODE && opt.startsWith("-F"))) {
|
||||||
if(!lflags[arch].contains(opt))
|
if (!lflags[arch].contains(opt))
|
||||||
lflags[arch].append(opt);
|
lflags[arch].append(opt);
|
||||||
} else if(opt.startsWith("-l") || opt == "-pthread") {
|
} else if (opt.startsWith("-l") || opt == "-pthread") {
|
||||||
// Make sure we keep the dependency-order of libraries
|
// Make sure we keep the dependency order of libraries
|
||||||
if (lflags[arch].contains(opt))
|
|
||||||
lflags[arch].removeAll(opt);
|
lflags[arch].removeAll(opt);
|
||||||
lflags[arch].append(opt);
|
lflags[arch].append(opt);
|
||||||
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
|
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
|
||||||
if(opt.length() > 11)
|
if (opt.length() > 10) {
|
||||||
opt = opt.mid(11);
|
opt = opt.mid(10).trimmed();
|
||||||
else {
|
} else {
|
||||||
opt = l.at(++lit);
|
opt = l.at(++lit);
|
||||||
if (target_mode == TARG_MAC_MODE && opt.startsWith("-Xarch"))
|
if (opt.startsWith("-Xarch"))
|
||||||
opt = l.at(++lit); // The user has done the right thing and prefixed each part
|
opt = l.at(++lit); // The user has done the right thing and prefixed each part
|
||||||
}
|
}
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@ -544,6 +509,7 @@ UnixMakefileGenerator::processPrlFiles()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
|
@ -54,9 +54,8 @@ protected:
|
|||||||
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 ProString fixLibFlag(const ProString &lib);
|
virtual ProString fixLibFlag(const ProString &lib);
|
||||||
virtual void processPrlFiles();
|
|
||||||
|
|
||||||
virtual bool findLibraries();
|
virtual bool findLibraries(bool linkPrl, bool mergeLflags);
|
||||||
virtual QString escapeFilePath(const QString &path) const;
|
virtual QString escapeFilePath(const QString &path) const;
|
||||||
ProString escapeFilePath(const ProString &path) const { return MakefileGenerator::escapeFilePath(path); }
|
ProString escapeFilePath(const ProString &path) const { return MakefileGenerator::escapeFilePath(path); }
|
||||||
virtual QStringList &findDependencies(const QString &);
|
virtual QStringList &findDependencies(const QString &);
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "mingw_make.h"
|
#include "mingw_make.h"
|
||||||
#include "option.h"
|
#include "option.h"
|
||||||
#include "meta.h"
|
|
||||||
|
|
||||||
#include <proitems.h>
|
#include <proitems.h>
|
||||||
|
|
||||||
@ -68,7 +67,7 @@ ProString MingwMakefileGenerator::fixLibFlag(const ProString &lib)
|
|||||||
return escapeFilePath(lib);
|
return escapeFilePath(lib);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MingwMakefileGenerator::findLibraries()
|
bool MingwMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
||||||
{
|
{
|
||||||
QList<QMakeLocalFileName> dirs;
|
QList<QMakeLocalFileName> dirs;
|
||||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||||
@ -78,15 +77,16 @@ bool MingwMakefileGenerator::findLibraries()
|
|||||||
while (it != l.end()) {
|
while (it != l.end()) {
|
||||||
if ((*it).startsWith("-l")) {
|
if ((*it).startsWith("-l")) {
|
||||||
QString steam = (*it).mid(2).toQString();
|
QString steam = (*it).mid(2).toQString();
|
||||||
ProString out;
|
QString out;
|
||||||
for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
|
for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
|
||||||
QString extension;
|
QString extension;
|
||||||
int ver = findHighestVersion((*dir_it).local(), steam);
|
int ver = findHighestVersion((*dir_it).local(), steam);
|
||||||
if (ver > 0)
|
if (ver > 0)
|
||||||
extension += QString::number(ver);
|
extension += QString::number(ver);
|
||||||
if (QMakeMetaInfo::libExists((*dir_it).local() + '/' + steam)
|
QString libBase = (*dir_it).local() + '/' + steam;
|
||||||
|| exists((*dir_it).local() + '/' + steam + extension + ".a")
|
if ((linkPrl && processPrlFile(libBase))
|
||||||
|| exists((*dir_it).local() + '/' + steam + extension + ".dll.a")) {
|
|| exists(libBase + extension + ".a")
|
||||||
|
|| exists(libBase + extension + ".dll.a")) {
|
||||||
out = *it + extension;
|
out = *it + extension;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -97,10 +97,38 @@ bool MingwMakefileGenerator::findLibraries()
|
|||||||
QMakeLocalFileName f((*it).mid(2).toQString());
|
QMakeLocalFileName f((*it).mid(2).toQString());
|
||||||
dirs.append(f);
|
dirs.append(f);
|
||||||
*it = "-L" + f.real();
|
*it = "-L" + f.real();
|
||||||
|
} else if (linkPrl && !(*it).startsWith('-')) {
|
||||||
|
QString prl = (*it).toQString();
|
||||||
|
if (!processPrlFile(prl) && QDir::isRelativePath(prl)) {
|
||||||
|
for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
|
||||||
|
prl = (*dir_it).local() + '/' + *it;
|
||||||
|
if (processPrlFile(prl))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
|
||||||
|
for (int prl = 0; prl < prl_libs.size(); ++prl)
|
||||||
|
it = l.insert(++it, prl_libs.at(prl));
|
||||||
|
prl_libs.clear();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
if (mergeLflags) {
|
||||||
|
ProStringList lopts;
|
||||||
|
for (int lit = 0; lit < l.size(); ++lit) {
|
||||||
|
ProString opt = l.at(lit);
|
||||||
|
if (opt.startsWith("-L")) {
|
||||||
|
if (!lopts.contains(opt))
|
||||||
|
lopts.append(opt);
|
||||||
|
} else {
|
||||||
|
// Make sure we keep the dependency order of libraries
|
||||||
|
lopts.removeAll(opt);
|
||||||
|
lopts.append(opt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l = lopts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ private:
|
|||||||
|
|
||||||
QString preCompHeaderOut;
|
QString preCompHeaderOut;
|
||||||
|
|
||||||
virtual bool findLibraries();
|
virtual bool findLibraries(bool linkPrl, bool mergeLflags);
|
||||||
|
|
||||||
QString objectsLinkLine;
|
QString objectsLinkLine;
|
||||||
};
|
};
|
||||||
|
@ -87,7 +87,7 @@ ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Win32MakefileGenerator::findLibraries()
|
Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
||||||
{
|
{
|
||||||
QList<QMakeLocalFileName> dirs;
|
QList<QMakeLocalFileName> dirs;
|
||||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
||||||
@ -123,8 +123,9 @@ Win32MakefileGenerator::findLibraries()
|
|||||||
if(ver > 0)
|
if(ver > 0)
|
||||||
extension += QString::number(ver);
|
extension += QString::number(ver);
|
||||||
extension += ".lib";
|
extension += ".lib";
|
||||||
if (QMakeMetaInfo::libExists((*it).local() + '/' + lib)
|
QString libBase = (*it).local() + '/' + lib;
|
||||||
|| exists((*it).local() + '/' + lib + extension)) {
|
if ((linkPrl && processPrlFile(libBase))
|
||||||
|
|| exists(libBase + extension)) {
|
||||||
out = (*it).real() + Option::dir_sep + lib + extension;
|
out = (*it).real() + Option::dir_sep + lib + extension;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -133,67 +134,39 @@ Win32MakefileGenerator::findLibraries()
|
|||||||
if(out.isEmpty())
|
if(out.isEmpty())
|
||||||
out = lib + ".lib";
|
out = lib + ".lib";
|
||||||
(*it) = out;
|
(*it) = out;
|
||||||
}
|
} else if (linkPrl && !processPrlFile(opt) && QDir::isRelativePath(opt)) {
|
||||||
++it;
|
for (QList<QMakeLocalFileName>::Iterator it = dirs.begin(); it != dirs.end(); ++it) {
|
||||||
}
|
QString prl = (*it).local() + '/' + opt;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Win32MakefileGenerator::processPrlFiles()
|
|
||||||
{
|
|
||||||
const QString libArg = project->first("QMAKE_L_FLAG").toQString();
|
|
||||||
QList<QMakeLocalFileName> libdirs;
|
|
||||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
|
|
||||||
for (int i = 0; lflags[i]; i++) {
|
|
||||||
ProStringList &l = project->values(lflags[i]);
|
|
||||||
for (int lit = 0; lit < l.size(); ++lit) {
|
|
||||||
QString opt = l.at(lit).toQString();
|
|
||||||
if (opt.startsWith(libArg)) {
|
|
||||||
QMakeLocalFileName l(opt.mid(libArg.length()));
|
|
||||||
if (!libdirs.contains(l))
|
|
||||||
libdirs.append(l);
|
|
||||||
} else {
|
|
||||||
if (!processPrlFile(opt) && (QDir::isRelativePath(opt) || opt.startsWith("-l"))) {
|
|
||||||
QString tmp;
|
|
||||||
if (opt.startsWith("-l"))
|
|
||||||
tmp = opt.mid(2);
|
|
||||||
else
|
|
||||||
tmp = opt;
|
|
||||||
for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) {
|
|
||||||
QString prl = (*it).local() + '/' + tmp;
|
|
||||||
if (processPrlFile(prl))
|
if (processPrlFile(prl))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
|
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
|
||||||
for (int prl = 0; prl < prl_libs.size(); ++prl)
|
for (int prl = 0; prl < prl_libs.size(); ++prl)
|
||||||
l.insert(++lit, prl_libs.at(prl));
|
it = l.insert(++it, prl_libs.at(prl));
|
||||||
prl_libs.clear();
|
prl_libs.clear();
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
|
if (mergeLflags) {
|
||||||
// Merge them into a logical order
|
ProStringList lopts;
|
||||||
if (!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) {
|
|
||||||
ProStringList lflags;
|
|
||||||
for (int lit = 0; lit < l.size(); ++lit) {
|
for (int lit = 0; lit < l.size(); ++lit) {
|
||||||
ProString opt = l.at(lit);
|
ProString opt = l.at(lit);
|
||||||
if (opt.startsWith(libArg)) {
|
if (opt.startsWith("/LIBPATH:")) {
|
||||||
if (!lflags.contains(opt))
|
if (!lopts.contains(opt))
|
||||||
lflags.append(opt);
|
lopts.append(opt);
|
||||||
} else {
|
} else {
|
||||||
// Make sure we keep the dependency-order of libraries
|
// Make sure we keep the dependency order of libraries
|
||||||
lflags.removeAll(opt);
|
lopts.removeAll(opt);
|
||||||
lflags.append(opt);
|
lopts.append(opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l = lflags;
|
l = lopts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Win32MakefileGenerator::processVars()
|
void Win32MakefileGenerator::processVars()
|
||||||
{
|
{
|
||||||
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
|
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
|
||||||
|
@ -58,11 +58,10 @@ protected:
|
|||||||
virtual void writeRcFilePart(QTextStream &t);
|
virtual void writeRcFilePart(QTextStream &t);
|
||||||
|
|
||||||
int findHighestVersion(const QString &dir, const QString &stem);
|
int findHighestVersion(const QString &dir, const QString &stem);
|
||||||
virtual bool findLibraries();
|
virtual bool findLibraries(bool linkPrl, bool mergeLflags);
|
||||||
|
|
||||||
virtual ProString fixLibFlag(const ProString &lib);
|
virtual ProString fixLibFlag(const ProString &lib);
|
||||||
|
|
||||||
virtual void processPrlFiles();
|
|
||||||
void processVars();
|
void processVars();
|
||||||
void fixTargetExt();
|
void fixTargetExt();
|
||||||
void processRcFileVar();
|
void processRcFileVar();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user