summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <[email protected]>2019-11-12 21:56:09 +0100
committerJoerg Bornemann <[email protected]>2019-11-18 10:46:56 +0100
commit52c8e9dc99b9405502d1a37b6406a55e5e156142 (patch)
tree387f2bfe8ee9ac9be480d8d74ac202efca176ea8
parent4218c3044d19d4f94de0bd673c83fa043f5604ae (diff)
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 <[email protected]> Reviewed-by: BogDan Vatra <[email protected]> Reviewed-by: Kai Koehne <[email protected]>
-rw-r--r--qmake/generators/unix/unixmake.cpp21
-rw-r--r--qmake/generators/unix/unixmake2.cpp11
2 files changed, 18 insertions, 14 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index e56e8c41b6c..f7bd6dc6634 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -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;
}
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 20f2c884449..550fa9d834c 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -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;