summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32/mingw_make.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-09-23 14:57:05 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-10-02 14:01:24 +0000
commit4bb004de94380304d8950e860d1823975927ec59 (patch)
treeac60a500a31aab3993808f15c1731d740170dc51 /qmake/generators/win32/mingw_make.cpp
parentdd9ec15640fb48fc27011b8f9420411a1637a203 (diff)
merge MingwMakefileGenerator::findLibraries() into Win32MakefileGenerator
as a side effect, this makes the extensions used for searching libraries configurable under windows (QMAKE_LIB_EXTENSIONS). Change-Id: I3e64304fcadbfe74d601b50a70a73180c894503e Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'qmake/generators/win32/mingw_make.cpp')
-rw-r--r--qmake/generators/win32/mingw_make.cpp89
1 files changed, 12 insertions, 77 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index fc21dd4dd2..97bfef88a4 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -62,84 +62,21 @@ QString MingwMakefileGenerator::getManifestFileForRcFile() const
ProString MingwMakefileGenerator::fixLibFlag(const ProString &lib)
{
- if (lib.startsWith("lib"))
- return QStringLiteral("-l") + escapeFilePath(lib.mid(3));
- return escapeFilePath(lib);
+ if (lib.startsWith("-l")) // Fallback for unresolved -l libs.
+ return QLatin1String("-l") + escapeFilePath(lib.mid(2));
+ if (lib.startsWith("-L")) // Lib search path. Needed only by -l above.
+ return QLatin1String("-L")
+ + escapeFilePath(Option::fixPathToTargetOS(lib.mid(2).toQString(), false));
+ if (lib.startsWith("lib")) // Fallback for unresolved MSVC-style libs.
+ return QLatin1String("-l") + escapeFilePath(lib.mid(3).toQString());
+ return escapeFilePath(Option::fixPathToTargetOS(lib.toQString(), false));
}
-bool MingwMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
+MakefileGenerator::LibFlagType
+MingwMakefileGenerator::parseLibFlag(const ProString &flag, ProString *arg)
{
- QList<QMakeLocalFileName> dirs;
- static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
- static const QLatin1String extens[] =
- { QLatin1String(".dll.a"), QLatin1String(".a"), QLatin1String(0) };
- for (int i = 0; lflags[i]; i++) {
- ProStringList &l = project->values(lflags[i]);
- ProStringList::Iterator it = l.begin();
- while (it != l.end()) {
- if ((*it).startsWith("-l")) {
- QString steam = (*it).mid(2).toQString();
- ProString verovr =
- project->first(ProKey("QMAKE_" + steam.toUpper() + "_VERSION_OVERRIDE"));
- for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
- QString cand = (*dir_it).real() + Option::dir_sep + steam;
- if (linkPrl && processPrlFile(cand)) {
- (*it) = cand;
- goto found;
- }
- QString libBase = (*dir_it).local() + '/' + steam + verovr;
- for (int e = 0; extens[e].data(); e++) {
- if (exists(libBase + extens[e])) {
- (*it) = cand + verovr + extens[e];
- goto found;
- }
- }
- }
- // We assume if it never finds it that its correct
- found: ;
- } else if ((*it).startsWith("-L")) {
- QMakeLocalFileName f((*it).mid(2).toQString());
- dirs.append(f);
- *it = "-L" + f.real();
- } else if (linkPrl && !(*it).startsWith('-')) {
- QString prl = (*it).toQString();
- if (fileInfo(prl).isAbsolute()) {
- if (processPrlFile(prl))
- (*it) = prl;
- } else {
- for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
- QString cand = (*dir_it).real() + Option::dir_sep + prl;
- if (processPrlFile(cand)) {
- (*it) = cand;
- 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;
- }
- 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;
+ // Skip MSVC handling from Win32MakefileGenerator
+ return MakefileGenerator::parseLibFlag(flag, arg);
}
bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
@@ -250,8 +187,6 @@ void MingwMakefileGenerator::init()
project->values("TARGET_PRL").append(project->first("TARGET"));
- project->values("QMAKE_L_FLAG") << "-L";
-
processVars();
project->values("QMAKE_LIBS") += project->values("RES_FILE");