summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefile.cpp52
-rw-r--r--qmake/generators/makefile.h2
-rw-r--r--qmake/generators/win32/winmakefile.cpp2
3 files changed, 36 insertions, 20 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 99455e7cb5..f824f12bce 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"
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 0c30e74a1d..0535017ff6 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -55,6 +55,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo
{
QString spec;
bool no_io;
+ bool resolveDependenciesInFrameworks = false;
QHash<QString, bool> init_compiler_already;
QString makedir, chkexists;
QString build_args();
@@ -82,6 +83,7 @@ protected:
void writeExportedVariables(QTextStream &t);
void writeExtraVariables(QTextStream &t);
void writeExtraTargets(QTextStream &t);
+ QString resolveDependency(const QDir &outDir, const QString &file);
void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t);
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 91215c94b1..6046e5791e 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -84,6 +84,8 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
if (impexts.isEmpty())
impexts = project->values("QMAKE_EXTENSION_STATICLIB");
QList<QMakeLocalFileName> dirs;
+ for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS"))
+ dirs.append(QMakeLocalFileName(dlib.toQString()));
static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE",
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; lflags[i]; i++) {