summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-15 19:47:57 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-15 19:47:57 +0200
commit40a1f69e8663fb79560c26cfad5ead45b1b3ee5f (patch)
treea8ceb093a098a38b29c0fe27e41af480ae10b876 /qmake
parent446afc10451d5097d7bd20b1b8d20325c4d54fa5 (diff)
parent6b2071c697d4c48f0cd289b28b443ebffc3432e6 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: configure.json mkspecs/macx-tvos-clang/qmake.conf mkspecs/macx-watchos-clang/qmake.conf Change-Id: Iaf32339ace59dff9ed344972472744c55d75025c
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/makefiledeps.cpp13
-rw-r--r--qmake/generators/unix/unixmake.cpp26
-rw-r--r--qmake/generators/unix/unixmake2.cpp59
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp1
4 files changed, 77 insertions, 22 deletions
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp
index 57cb0ea854..67c8219d4b 100644
--- a/qmake/generators/makefiledeps.cpp
+++ b/qmake/generators/makefiledeps.cpp
@@ -911,9 +911,10 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
debug_msg(2, "findMocs: %s", file->file.local().toLatin1().constData());
int line_count = 1;
- bool ignore[2] = { false, false }; // [0] for Q_OBJECT, [1] for Q_GADGET
+ bool ignore[3] = { false, false, false }; // [0] for Q_OBJECT, [1] for Q_GADGET, [2] for Q_NAMESPACE
/* qmake ignore Q_GADGET */
/* qmake ignore Q_OBJECT */
+ /* qmake ignore Q_NAMESPACE */
for(int x = 0; x < buffer_len; x++) {
#define SKIP_BSNL(pos) skipEscapedLineEnds(buffer, buffer_len, (pos), &line_count)
x = SKIP_BSNL(x);
@@ -946,6 +947,12 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
file->file.real().toLatin1().constData(), line_count);
x += 20;
ignore[1] = true;
+ } else if (buffer_len >= (x + 23) &&
+ !strncmp(buffer + x + 1, "make ignore Q_NAMESPACE", 23)) {
+ debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_NAMESPACE\"",
+ file->file.real().toLatin1().constData(), line_count);
+ x += 23;
+ ignore[2] = true;
}
} else if (buffer[x] == '*') {
extralines = 0;
@@ -973,8 +980,8 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
int morelines = 0;
int y = skipEscapedLineEnds(buffer, buffer_len, x + 1, &morelines);
if (buffer[y] == 'Q') {
- static const char interesting[][9] = { "Q_OBJECT", "Q_GADGET" };
- for (int interest = 0; interest < 2; ++interest) {
+ static const char interesting[][12] = { "Q_OBJECT", "Q_GADGET", "Q_NAMESPACE"};
+ for (int interest = 0; interest < 3; ++interest) {
if (ignore[interest])
continue;
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 0e29f469ef..794d04a6e9 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -194,6 +194,18 @@ UnixMakefileGenerator::init()
if (!language.isEmpty()) {
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT}"),
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());
+ 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
+ }
+ pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_") + arch + QLatin1Char('}'),
+ escapeFilePath(pchBaseName + language + suffix));
+ }
}
}
@@ -351,9 +363,17 @@ QStringList
if (!file.endsWith(extension.toQString()))
continue;
- QString precompiledHeader = header_prefix + language + header_suffix;
- if (!ret.contains(precompiledHeader))
- ret += precompiledHeader;
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ 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;
+ if (!ret.contains(precompiledHeader))
+ ret += precompiledHeader;
+ }
goto foundPrecompiledDependency;
}
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 433731cc4b..3d12ffd65c 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1021,7 +1021,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (language.isEmpty())
continue;
- precomp_files += precomph_out_dir + header_prefix + language + header_suffix;
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ if (pchArchs.isEmpty())
+ pchArchs << ProString(); // normal single-arch PCH
+ for (const ProString &arch : qAsConst(pchArchs)) {
+ auto suffix = header_suffix.toQString();
+ if (!arch.isEmpty())
+ suffix.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
+ precomp_files += precomph_out_dir + header_prefix + language + suffix;
+ }
}
}
t << "-$(DEL_FILE) " << escapeFilePaths(precomp_files).join(' ') << "\n\t";
@@ -1077,6 +1085,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString pchInput = project->first("PRECOMPILED_HEADER").toQString();
t << "###### Precompiled headers\n";
for (const ProString &compiler : project->values("QMAKE_BUILTIN_COMPILERS")) {
+ QString pchOutputDir;
QString pchFlags = var(ProKey("QMAKE_" + compiler + "FLAGS_PRECOMPILE"));
if(pchFlags.isEmpty())
continue;
@@ -1087,6 +1096,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
else
cflags += " $(CXXFLAGS)";
+ ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
+ if (pchArchs.isEmpty())
+ pchArchs << ProString(); // normal single-arch PCH
ProString pchBaseName = project->first("QMAKE_ORIG_TARGET");
ProString pchOutput;
if(!project->isEmpty("PRECOMPILED_DIR"))
@@ -1113,30 +1125,47 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
ProString header_suffix = project->isActiveConfig("clang_pch_style")
? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
pchOutput += Option::dir_sep;
- QString pchOutputDir = pchOutput.toQString();
+ pchOutputDir = pchOutput.toQString();
QString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler)).toQString();
if (language.isEmpty())
continue;
pchOutput += header_prefix + language + header_suffix;
-
- t << escapeDependencyPath(pchOutput) << ": " << escapeDependencyPath(pchInput) << ' '
- << escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t")
- << "\n\t" << mkdir_p_asstring(pchOutputDir);
}
pchFlags.replace(QLatin1String("${QMAKE_PCH_INPUT}"), escapeFilePath(pchInput))
- .replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString()))
- .replace(QLatin1String("${QMAKE_PCH_OUTPUT}"), escapeFilePath(pchOutput.toQString()));
+ .replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString()));
+ for (const ProString &arch : qAsConst(pchArchs)) {
+ auto pchArchOutput = pchOutput.toQString();
+ 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);
+ }
- QString compilerExecutable;
- if (compiler == "C" || compiler == "OBJC")
- compilerExecutable = "$(CC)";
- else
- compilerExecutable = "$(CXX)";
+ auto pchArchFlags = pchFlags;
+ pchArchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT}"), escapeFilePath(pchArchOutput));
- // compile command
- t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchFlags << endl << endl;
+ QString compilerExecutable;
+ if (compiler == "C" || compiler == "OBJC")
+ compilerExecutable = "$(CC)";
+ else
+ compilerExecutable = "$(CXX)";
+
+ // compile command
+ t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchArchFlags << endl << endl;
+ }
}
}
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 7e476eaf42..1155e45bd7 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -36,7 +36,6 @@
#include <qhash.h>
#include <quuid.h>
#include <stdlib.h>
-#include <qlinkedlist.h>
//#define DEBUG_SOLUTION_GEN