dispose of MSVCPROJ_LIBS

this way QMAKE_LIBS{,_PRIVATE} can be treated the same as in all other
generators, which allows us to:
- make the windows generators' findLibraries() be more like the unix
  version
- dispose of QMAKE_INTERNAL_PRL_LIBS handling while reading prl files
  (because the output always goes to QMAKE_LIBS)
- as a side effect, QMAKE_LIBS_PRIVATE are not subjected to prl file
  resolution any more, which is again consistent with unix - the
  correctness of that needs to be assessed separately.

Change-Id: Ie9bc04d117eff6a7cde846677f98acf3c64aa6ee
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-07-12 21:46:53 +02:00 committed by Qt by Nokia
parent c1056c80fb
commit e5b203dbc7
7 changed files with 15 additions and 39 deletions

View File

@ -944,10 +944,7 @@ void
MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
{
if(var == "QMAKE_PRL_LIBS") {
QString where = "QMAKE_LIBS";
if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
where = project->first("QMAKE_INTERNAL_PRL_LIBS");
QStringList &out = project->values(where);
QStringList &out = project->values("QMAKE_LIBS");
for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if(out.indexOf((*it)) == -1)
out.append((*it));
@ -969,10 +966,7 @@ MakefileGenerator::processPrlFiles()
for(bool ret = false; true; ret = false) {
//read in any prl files included..
QStringList l_out;
QString where = "QMAKE_LIBS";
if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
where = project->first("QMAKE_INTERNAL_PRL_LIBS");
QStringList &l = project->values(where);
QStringList &l = project->values("QMAKE_LIBS");
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
QString file = (*it);
if(!processed.contains(file) && processPrlFile(file)) {

View File

@ -73,13 +73,6 @@ QString MingwMakefileGenerator::getLibTarget()
bool MingwMakefileGenerator::findLibraries()
{
return findLibraries("QMAKE_LIBS") && findLibraries("QMAKE_LIBS_PRIVATE");
}
bool MingwMakefileGenerator::findLibraries(const QString &where)
{
QStringList &l = project->values(where);
QList<QMakeLocalFileName> dirs;
{
const QStringList &libpaths = project->values("QMAKE_LIBDIR");
@ -88,6 +81,9 @@ bool MingwMakefileGenerator::findLibraries(const QString &where)
dirs.append(QMakeLocalFileName((*libpathit)));
}
const QString lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
for (int i = 0; !lflags[i].isNull(); i++) {
QStringList &l = project->values(lflags[i]);
QStringList::Iterator it = l.begin();
while (it != l.end()) {
if ((*it).startsWith("-l")) {
@ -116,6 +112,7 @@ bool MingwMakefileGenerator::findLibraries(const QString &where)
++it;
}
}
return true;
}

View File

@ -70,7 +70,6 @@ private:
QString preCompHeaderOut;
virtual bool findLibraries();
bool findLibraries(const QString &where);
void fixTargetExt();
bool init_flag;

View File

@ -720,7 +720,7 @@ void VcprojGenerator::init()
} else if(project->first("TEMPLATE") == "vclib") {
if(project->isActiveConfig("staticlib")) {
if (!project->values("RES_FILE").isEmpty())
project->values("MSVCPROJ_LIBS") += escapeFilePaths(project->values("RES_FILE"));
project->values("QMAKE_LIBS") += escapeFilePaths(project->values("RES_FILE"));
projectTarget = StaticLib;
} else
projectTarget = SharedLib;
@ -1021,7 +1021,7 @@ void VcprojGenerator::initLinkerTool()
if (!project->values("DEF_FILE").isEmpty())
conf.linker.ModuleDefinitionFile = project->first("DEF_FILE");
foreach(QString libs, project->values("MSVCPROJ_LIBS")) {
foreach (QString libs, project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE")) {
if (libs.left(9).toUpper() == "/LIBPATH:") {
QStringList l = QStringList(libs);
conf.linker.parseOptions(l);
@ -1104,7 +1104,7 @@ void VcprojGenerator::initDeploymentTool()
// FIXME: This code should actually resolve the libraries from all Qt modules.
const QString &qtdir = QLibraryInfo::rawLocation(QLibraryInfo::LibrariesPath,
QLibraryInfo::EffectivePaths);
const QStringList &arg = project->values("MSVCPROJ_LIBS");
QStringList arg = project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE");
for (QStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) {
if (it->contains(qtdir)) {
QString dllName = *it;
@ -1460,8 +1460,6 @@ void VcprojGenerator::initExtraCompilerOutputs()
void VcprojGenerator::initOld()
{
// $$QMAKE.. -> $$MSVCPROJ.. -------------------------------------
project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS");
project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS_PRIVATE");
const QStringList &incs = project->values("INCLUDEPATH");
for (QStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit);
@ -1500,8 +1498,6 @@ void VcprojGenerator::initOld()
project->values("MSVCPROJ_COPY_DLL_DESC").append(deststr);
}
project->values("QMAKE_INTERNAL_PRL_LIBS") << "MSVCPROJ_LIBS";
// Verbose output if "-d -d"...
outputVariables();
}

View File

@ -92,7 +92,6 @@ protected:
virtual bool mergeBuildProject(MakefileGenerator *other);
virtual bool openOutput(QFile &file, const QString &build) const;
virtual bool findLibraries();
virtual void outputVariables();
QString fixFilename(QString ofile) const;
@ -141,11 +140,6 @@ inline QString VcprojGenerator::defaultMakefile() const
return project->first("TARGET") + project->first("VCPROJ_EXTENSION");
}
inline bool VcprojGenerator::findLibraries()
{
return Win32MakefileGenerator::findLibraries("MSVCPROJ_LIBS");
}
QT_END_NAMESPACE
#endif // MSVC_VCPROJ_H

View File

@ -104,9 +104,8 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem
}
bool
Win32MakefileGenerator::findLibraries(const QString &where)
Win32MakefileGenerator::findLibraries()
{
QStringList &l = project->values(where);
QList<QMakeLocalFileName> dirs;
{
const QStringList &libpaths = project->values("QMAKE_LIBDIR");
@ -114,6 +113,9 @@ Win32MakefileGenerator::findLibraries(const QString &where)
libpathit != libpaths.end(); ++libpathit)
dirs.append(QMakeLocalFileName((*libpathit)));
}
const QString lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
for (int i = 0; !lflags[i].isNull(); i++) {
QStringList &l = project->values(lflags[i]);
for(QStringList::Iterator it = l.begin(); it != l.end();) {
QChar quote;
bool modified_opt = false, remove = false;
@ -213,6 +215,7 @@ Win32MakefileGenerator::findLibraries(const QString &where)
++it;
}
}
}
return true;
}
@ -229,10 +232,7 @@ Win32MakefileGenerator::processPrlFiles()
for(bool ret = false; true; ret = false) {
//read in any prl files included..
QStringList l_out;
QString where = "QMAKE_LIBS";
if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
where = project->first("QMAKE_INTERNAL_PRL_LIBS");
QStringList l = project->values(where);
QStringList l = project->values("QMAKE_LIBS");
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
QString opt = (*it).trimmed();
if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0])

View File

@ -66,7 +66,6 @@ protected:
virtual void writeRcFilePart(QTextStream &t);
int findHighestVersion(const QString &dir, const QString &stem, const QString &ext = QLatin1String("lib"));
bool findLibraries(const QString &);
virtual bool findLibraries();
virtual void processPrlFiles();
@ -80,9 +79,6 @@ protected:
inline Win32MakefileGenerator::~Win32MakefileGenerator()
{ }
inline bool Win32MakefileGenerator::findLibraries()
{ return findLibraries("QMAKE_LIBS") && findLibraries("QMAKE_LIBS_PRIVATE"); }
QT_END_NAMESPACE
#endif // WINMAKEFILE_H