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>
This commit is contained in:
parent
eca6f5492c
commit
097073fa67
@ -157,13 +157,23 @@ macx-xcode {
|
||||
# Enable precompiled headers for multiple architectures
|
||||
QMAKE_CFLAGS_USE_PRECOMPILE =
|
||||
for (arch, VALID_ARCHS) {
|
||||
icc_pch_style: \
|
||||
use_flag = "-pch-use "
|
||||
else: \
|
||||
use_flag = -include
|
||||
|
||||
QMAKE_CFLAGS_USE_PRECOMPILE += \
|
||||
-Xarch_$${arch} \
|
||||
-include${QMAKE_PCH_OUTPUT_$${arch}}
|
||||
$${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
|
||||
}
|
||||
icc_pch_style {
|
||||
QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
|
||||
QMAKE_CFLAGS_USE_PRECOMPILE =
|
||||
} else {
|
||||
QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
}
|
||||
QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
|
||||
|
||||
QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
|
||||
}
|
||||
|
@ -94,6 +94,8 @@ QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
|
||||
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
|
||||
QMAKE_APPLE_DEVICE_ARCHS = x86_64
|
||||
|
||||
include(../common/macx.conf)
|
||||
|
||||
load(qt_config)
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user