summaryrefslogtreecommitdiffstats
path: root/qmake/generators/unix/unixmake.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@nokia.com>2010-10-18 12:20:56 (GMT)
committerTor Arne Vestbø <tor.arne.vestbo@nokia.com>2010-10-18 15:43:55 (GMT)
commitbe5a6dd0907f2ea635327ea21a01ebea9b894c6b (patch)
tree44831b37824a7223013c19f060beb4b3523ed406 /qmake/generators/unix/unixmake.cpp
parent0290b2aaff20f6c3f80b29d382e21e5dd39a08eb (diff)
downloadQt-be5a6dd0907f2ea635327ea21a01ebea9b894c6b.zip
Qt-be5a6dd0907f2ea635327ea21a01ebea9b894c6b.tar.gz
Qt-be5a6dd0907f2ea635327ea21a01ebea9b894c6b.tar.bz2
qmake: Add support for Clang-style precompiled headers
The config option clang_pch_style will ensure that QMAKE_PCH_OUTPUT_BASE will not have QMAKE_PCH_OUTPUT_EXT appended, but instead the final output file QMAKE_PCH_OUTPUT will have the QMAKE_PCH_OUTPUT_EXT included. Without clang_pch_style: QMAKE_PCH_OUTPUT_BASE = .pch/debug-shared/QtCore.gch QMAKE_PCH_OUTPUT = .pch/debug-shared/QtCore.gch/c++ With clang_pch_style: QMAKE_PCH_OUTPUT_BASE = .pch/debug-shared/QtCore QMAKE_PCH_OUTPUT = .pch/debug-shared/QtCore/c++.gch Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Diffstat (limited to 'qmake/generators/unix/unixmake.cpp')
-rw-r--r--qmake/generators/unix/unixmake.cpp45
1 files changed, 38 insertions, 7 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 71a6061..43543a1 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -206,6 +206,33 @@ UnixMakefileGenerator::init()
// icc style
pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT}",
pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT"));
+ } else {
+ // gcc style (including clang_pch_style)
+ QString headerPrefix = project->first("QMAKE_PRECOMP_PREFIX");
+ QString headerSuffix;
+ if (project->isActiveConfig("clang_pch_style"))
+ headerSuffix = project->first("QMAKE_PCH_OUTPUT_EXT");
+ else
+ pchBaseName += project->first("QMAKE_PCH_OUTPUT_EXT");
+
+ pchBaseName += Option::dir_sep;
+ QString pchOutputFile;
+
+ if(comps[i] == "C") {
+ pchOutputFile = "c";
+ } else if(comps[i] == "CXX") {
+ pchOutputFile = "c++";
+ } else if(project->isActiveConfig("objective_c")) {
+ if(comps[i] == "OBJC")
+ pchOutputFile = "objective-c";
+ else if(comps[i] == "OBJCXX")
+ pchOutputFile = "objective-c++";
+ }
+
+ if(!pchOutputFile.isEmpty()) {
+ pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT}",
+ pchBaseName + pchOutputFile + headerSuffix);
+ }
}
if (!pchFlags.isEmpty())
@@ -379,7 +406,9 @@ QStringList
QString header_prefix;
if(!project->isEmpty("PRECOMPILED_DIR"))
header_prefix = project->first("PRECOMPILED_DIR");
- header_prefix += project->first("QMAKE_ORIG_TARGET") + project->first("QMAKE_PCH_OUTPUT_EXT");
+ header_prefix += project->first("QMAKE_ORIG_TARGET");
+ if (!project->isActiveConfig("clang_pch_style"))
+ header_prefix += project->first("QMAKE_PCH_OUTPUT_EXT");
if (project->isActiveConfig("icc_pch_style")) {
// icc style
for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
@@ -389,23 +418,25 @@ QStringList
}
}
} else {
- // gcc style
+ // gcc style (including clang_pch_style)
+ QString header_suffix = project->isActiveConfig("clang_pch_style")
+ ? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
header_prefix += Option::dir_sep + project->first("QMAKE_PRECOMP_PREFIX");
for(QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
if(file.endsWith(*it)) {
if(!project->isEmpty("QMAKE_CFLAGS_PRECOMPILE")) {
- QString precomp_c_h = header_prefix + "c";
+ QString precomp_c_h = header_prefix + "c" + header_suffix;
if(!ret.contains(precomp_c_h))
ret += precomp_c_h;
}
if(project->isActiveConfig("objective_c")) {
if(!project->isEmpty("QMAKE_OBJCFLAGS_PRECOMPILE")) {
- QString precomp_objc_h = header_prefix + "objective-c";
+ QString precomp_objc_h = header_prefix + "objective-c" + header_suffix;
if(!ret.contains(precomp_objc_h))
ret += precomp_objc_h;
}
if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE")) {
- QString precomp_objcpp_h = header_prefix + "objective-c++";
+ QString precomp_objcpp_h = header_prefix + "objective-c++" + header_suffix;
if(!ret.contains(precomp_objcpp_h))
ret += precomp_objcpp_h;
}
@@ -416,13 +447,13 @@ QStringList
for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
if(file.endsWith(*it)) {
if(!project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE")) {
- QString precomp_cpp_h = header_prefix + "c++";
+ QString precomp_cpp_h = header_prefix + "c++" + header_suffix;
if(!ret.contains(precomp_cpp_h))
ret += precomp_cpp_h;
}
if(project->isActiveConfig("objective_c")) {
if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE")) {
- QString precomp_objcpp_h = header_prefix + "objective-c++";
+ QString precomp_objcpp_h = header_prefix + "objective-c++" + header_suffix;
if(!ret.contains(precomp_objcpp_h))
ret += precomp_objcpp_h;
}