diff options
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r-- | qmake/generators/makefile.cpp | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 3a71f9d3de..9ea0fe3a22 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -424,6 +424,9 @@ MakefileGenerator::init() } incs.append(project->specDir()); + const auto platform = v["QMAKE_PLATFORM"]; + resolveDependenciesInFrameworks = platform.contains("darwin"); + const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", nullptr }; for (int i = 0; cacheKeys[i]; ++i) { if (v[cacheKeys[i]].isEmpty()) @@ -1839,6 +1842,33 @@ static QStringList splitDeps(const QString &indeps, bool lineMode) return deps; } +QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &file) +{ + const QList<QMakeLocalFileName> &depdirs = QMakeSourceFileInfo::dependencyPaths(); + for (const auto &depdir : depdirs) { + const QString &local = depdir.local(); + QString lf = outDir.absoluteFilePath(local + '/' + file); + if (exists(lf)) + return lf; + + if (resolveDependenciesInFrameworks) { + // Given a file like "QtWidgets/QWidget", try to resolve it + // as framework header "QtWidgets.framework/Headers/QWidget". + int cut = file.indexOf('/'); + if (cut < 0 || cut + 1 >= file.size()) + continue; + QStringRef framework = file.leftRef(cut); + QStringRef include = file.midRef(cut + 1); + if (local.endsWith('/' + framework + ".framework/Headers")) { + lf = outDir.absoluteFilePath(local + '/' + include); + if (exists(lf)) + return lf; + } + } + } + return {}; +} + void MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) { @@ -1991,16 +2021,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } else if (exists(absFile)) { file = absFile; } else { - QString localFile; - QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths(); - for (QList<QMakeLocalFileName>::Iterator dit = depdirs.begin(); - dit != depdirs.end(); ++dit) { - QString lf = outDir.absoluteFilePath((*dit).local() + '/' + file); - if (exists(lf)) { - localFile = lf; - break; - } - } + QString localFile = resolveDependency(outDir, file); if (localFile.isEmpty()) { if (exists(file)) warn_msg(WarnDeprecated, ".depend_command for extra compiler %s" @@ -2088,16 +2109,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } else if (exists(absFile)) { file = absFile; } else { - QString localFile; - QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths(); - for (QList<QMakeLocalFileName>::Iterator dit = depdirs.begin(); - dit != depdirs.end(); ++dit) { - QString lf = outDir.absoluteFilePath((*dit).local() + '/' + file); - if (exists(lf)) { - localFile = lf; - break; - } - } + QString localFile = resolveDependency(outDir, file); if (localFile.isEmpty()) { if (exists(file)) warn_msg(WarnDeprecated, ".depend_command for extra compiler %s" |