Fix precompiled headers on macOS
Since commit 059172c6 precompiled headers did not work anymore on macOS, because the ${QMAKE_PCH_ARCH} string was suddenly appearing in locations where it was not replaced with the actual architecture, e.g. the directory where the PCH files are written. Fix this by replacing the whole file path and not just portions of it. Fixes: QTBUG-79694 Change-Id: I925d4ee8980a0de3205a0e387a516a5c6f8cfa4b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
parent
4218c3044d
commit
52c8e9dc99
@ -208,15 +208,15 @@ UnixMakefileGenerator::init()
|
||||
escapeFilePath(pchBaseName + language + headerSuffix));
|
||||
const ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
||||
for (const ProString &arch : pchArchs) {
|
||||
QString suffix = headerSuffix;
|
||||
suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||
QString file = pchBaseName + language + headerSuffix;
|
||||
file.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||
if (project->isActiveConfig("clang_pch_style")
|
||||
&& (suffix.endsWith(QLatin1String(".pch"))
|
||||
|| suffix.endsWith(QLatin1String(".gch")))) {
|
||||
suffix.chop(4); // must omit header suffix for -include to recognize the PCH
|
||||
&& (file.endsWith(QLatin1String(".pch"))
|
||||
|| file.endsWith(QLatin1String(".gch")))) {
|
||||
file.chop(4); // must omit header suffix for -include to recognize the PCH
|
||||
}
|
||||
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_") + arch + QLatin1Char('}'),
|
||||
escapeFilePath(pchBaseName + language + suffix));
|
||||
escapeFilePath(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -363,10 +363,11 @@ QStringList
|
||||
if (pchArchs.isEmpty())
|
||||
pchArchs << ProString(); // normal single-arch PCH
|
||||
for (const ProString &arch : qAsConst(pchArchs)) {
|
||||
QString suffix = header_suffix;
|
||||
if (!arch.isEmpty())
|
||||
suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||
QString precompiledHeader = header_prefix + language + suffix;
|
||||
QString precompiledHeader = header_prefix + language + header_suffix;
|
||||
if (!arch.isEmpty()) {
|
||||
precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"),
|
||||
arch.toQString());
|
||||
}
|
||||
if (!ret.contains(precompiledHeader))
|
||||
ret += precompiledHeader;
|
||||
}
|
||||
|
@ -1017,10 +1017,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
if (pchArchs.isEmpty())
|
||||
pchArchs << ProString(); // normal single-arch PCH
|
||||
for (const ProString &arch : qAsConst(pchArchs)) {
|
||||
auto suffix = header_suffix.toQString();
|
||||
QString file = precomph_out_dir + header_prefix + language + header_suffix;
|
||||
if (!arch.isEmpty())
|
||||
suffix.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||
precomp_files += precomph_out_dir + header_prefix + language + suffix;
|
||||
file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||
precomp_files += file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1140,7 +1140,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile_f
|
||||
<< "\n\trm -f " << escapeFilePath(pchArchOutput);
|
||||
} else {
|
||||
t << "\n\t" << mkdir_p_asstring(pchOutputDir);
|
||||
QString outDir = pchOutputDir;
|
||||
if (!arch.isEmpty())
|
||||
outDir.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||
t << "\n\t" << mkdir_p_asstring(outDir);
|
||||
}
|
||||
|
||||
auto pchArchFlags = pchFlags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user