From e5b203dbc7da249e89cc800a7b6a41af8b913ecc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 12 Jul 2012 21:46:53 +0200 Subject: [PATCH] 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 --- qmake/generators/makefile.cpp | 10 ++-------- qmake/generators/win32/mingw_make.cpp | 11 ++++------- qmake/generators/win32/mingw_make.h | 1 - qmake/generators/win32/msvc_vcproj.cpp | 10 +++------- qmake/generators/win32/msvc_vcproj.h | 6 ------ qmake/generators/win32/winmakefile.cpp | 12 ++++++------ qmake/generators/win32/winmakefile.h | 4 ---- 7 files changed, 15 insertions(+), 39 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index c961528a5c..5a53e9227e 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -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)) { diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index bbb9dc2bac..6e0f41f479 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -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 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; } diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index ac65bbb4a9..d76295c3df 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -70,7 +70,6 @@ private: QString preCompHeaderOut; virtual bool findLibraries(); - bool findLibraries(const QString &where); void fixTargetExt(); bool init_flag; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index f3a1e5ad73..e7ad0bc10b 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -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(); } diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 416e233614..fe5bfa4b71 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -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 diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 2aafa0a3d6..2af7b811dd 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -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 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]) diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index c0ea52c4ee..e46b511a7b 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -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