summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-04-11 14:54:53 -0700
committerJake Petroules <jake.petroules@qt.io>2017-04-14 00:00:56 +0000
commit097073fa678c6526620f786fbdd6e913a77d54d5 (patch)
treeb0b5abadb7575cb3df616c21e8d0a7e1a2704056 /qmake
parenteca6f5492c4f32ad4e1df25ab923401dc5980c76 (diff)
Fix precompiled headers on Apple platforms, with multiple architectures
The original commit only added support for GCC and Clang, but not ICC. Amends 73331eeb Change-Id: Id7638cf1b538edb1008fb3aa10754c1f517a994f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/unix/unixmake.cpp24
-rw-r--r--qmake/generators/unix/unixmake2.cpp70
2 files changed, 58 insertions, 36 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index b485a7ec84..1073386a82 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -180,6 +180,13 @@ UnixMakefileGenerator::init()
// icc style
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT}"),
escapeFilePath(pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT")));
+ const ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ for (const ProString &arch : pchArchs) {
+ QString suffix = project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
+ suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
+ pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_") + arch + QLatin1Char('}'),
+ escapeFilePath(pchBaseName + suffix));
+ }
} else {
// gcc style (including clang_pch_style)
QString headerSuffix;
@@ -334,10 +341,19 @@ QStringList
header_prefix += project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
if (project->isActiveConfig("icc_pch_style")) {
// icc style
- for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
- if(file.endsWith(*it)) {
- ret += header_prefix;
- break;
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ if (pchArchs.isEmpty())
+ pchArchs << ProString(); // normal single-arch PCH
+ for (const ProString &arch : qAsConst(pchArchs)) {
+ auto pfx = header_prefix;
+ if (!arch.isEmpty())
+ pfx.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
+ for (QStringList::Iterator it = Option::cpp_ext.begin();
+ it != Option::cpp_ext.end(); ++it) {
+ if (file.endsWith(*it)) {
+ ret += pfx;
+ break;
+ }
}
}
} else {
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 5b56cac784..f7097e58dc 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1006,14 +1006,22 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (project->isActiveConfig("icc_pch_style")) {
// icc style
ProString pchBaseName = project->first("QMAKE_ORIG_TARGET");
- ProString pchOutput;
- if(!project->isEmpty("PRECOMPILED_DIR"))
- pchOutput = project->first("PRECOMPILED_DIR");
- pchOutput += pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT");
- ProString sourceFile = pchOutput + Option::cpp_ext.first();
- ProString objectFile = createObjectList(ProStringList(sourceFile)).first();
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ if (pchArchs.isEmpty())
+ pchArchs << ProString(); // normal single-arch PCH
+ for (const ProString &arch : qAsConst(pchArchs)) {
+ ProString pchOutput;
+ if (!project->isEmpty("PRECOMPILED_DIR"))
+ pchOutput = project->first("PRECOMPILED_DIR");
+ pchOutput += pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT");
+ if (!arch.isEmpty())
+ pchOutput = ProString(pchOutput.toQString().replace(
+ QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString()));
- precomp_files << precomph_out_dir << sourceFile << objectFile;
+ ProString sourceFile = pchOutput + Option::cpp_ext.first();
+ ProString objectFile = createObjectList(ProStringList(sourceFile)).first();
+ precomp_files << precomph_out_dir << sourceFile << objectFile;
+ }
} else {
// gcc style (including clang_pch_style)
precomph_out_dir += Option::dir_sep;
@@ -1115,19 +1123,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (!project->isActiveConfig("clang_pch_style"))
pchOutput += project->first("QMAKE_PCH_OUTPUT_EXT");
- if (project->isActiveConfig("icc_pch_style")) {
- // icc style
- QString sourceFile = pchOutput + Option::cpp_ext.first();
- QString sourceFile_f = escapeFilePath(sourceFile);
- QString objectFile = createObjectList(ProStringList(sourceFile)).first().toQString();
- t << escapeDependencyPath(pchOutput) << ": " << escapeDependencyPath(pchInput) << ' '
- << escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t")
- << "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile_f
- << "\n\trm -f " << escapeFilePath(pchOutput);
-
- pchFlags.replace(QLatin1String("${QMAKE_PCH_TEMP_SOURCE}"), sourceFile_f)
- .replace(QLatin1String("${QMAKE_PCH_TEMP_OBJECT}"), escapeFilePath(objectFile));
- } else {
+ if (!project->isActiveConfig("icc_pch_style")) {
// gcc style (including clang_pch_style)
ProString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
ProString header_suffix = project->isActiveConfig("clang_pch_style")
@@ -1148,18 +1144,28 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (!arch.isEmpty())
pchArchOutput.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
- if (!project->isActiveConfig("icc_pch_style")) {
- const auto pchFilePath_d = escapeDependencyPath(pchArchOutput);
- if (!arch.isEmpty()) {
- t << pchFilePath_d << ": " << "EXPORT_ARCH_ARGS = -arch " << arch << "\n\n";
- t << pchFilePath_d << ": "
- << "EXPORT_QMAKE_XARCH_CFLAGS = $(EXPORT_QMAKE_XARCH_CFLAGS_" << arch << ")" << "\n\n";
- t << pchFilePath_d << ": "
- << "EXPORT_QMAKE_XARCH_LFLAGS = $(EXPORT_QMAKE_XARCH_LFLAGS_" << arch << ")" << "\n\n";
- }
- t << pchFilePath_d << ": " << escapeDependencyPath(pchInput) << ' '
- << escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t")
- << "\n\t" << mkdir_p_asstring(pchOutputDir);
+ const auto pchFilePath_d = escapeDependencyPath(pchArchOutput);
+ if (!arch.isEmpty()) {
+ t << pchFilePath_d << ": " << "EXPORT_ARCH_ARGS = -arch " << arch << "\n\n";
+ t << pchFilePath_d << ": "
+ << "EXPORT_QMAKE_XARCH_CFLAGS = $(EXPORT_QMAKE_XARCH_CFLAGS_" << arch << ")" << "\n\n";
+ t << pchFilePath_d << ": "
+ << "EXPORT_QMAKE_XARCH_LFLAGS = $(EXPORT_QMAKE_XARCH_LFLAGS_" << arch << ")" << "\n\n";
+ }
+ t << pchFilePath_d << ": " << escapeDependencyPath(pchInput) << ' '
+ << escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t");
+ if (project->isActiveConfig("icc_pch_style")) {
+ QString sourceFile = pchArchOutput + Option::cpp_ext.first();
+ QString sourceFile_f = escapeFilePath(sourceFile);
+ QString objectFile = createObjectList(ProStringList(sourceFile)).first().toQString();
+
+ pchFlags.replace(QLatin1String("${QMAKE_PCH_TEMP_SOURCE}"), sourceFile_f)
+ .replace(QLatin1String("${QMAKE_PCH_TEMP_OBJECT}"), escapeFilePath(objectFile));
+
+ t << "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile_f
+ << "\n\trm -f " << escapeFilePath(pchArchOutput);
+ } else {
+ t << "\n\t" << mkdir_p_asstring(pchOutputDir);
}
auto pchArchFlags = pchFlags;