Resolve macOS framework headers for extra compiler depend_command
On macOS, if an extra compiler returns a framework include via its depend_command, we must resolve it properly. For example, the uic extra compiler might return an include "QtQuickWidget/QQuickWidget", but the actual header file is located in "QtQuickWidget.framework/Headers/QQuickWidget". Fixes: QTBUG-72641 Change-Id: I42f11c74d01c88db8a32025b7f04d9ad50b2d08b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>bb10
parent
b95a4bbe84
commit
c6bd9082f4
|
|
@ -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())
|
||||
|
|
@ -1847,6 +1850,21 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &
|
|||
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 {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue