aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-10-19 12:50:51 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-10-25 11:52:12 +0000
commit4725008aeea407ae55cfd66de802dd9e06412efc (patch)
tree946d2c8c68d32d9ae72847abb1023ccfb154c5e5
parent5d24c0de2fabbdc2cf5cb8f4938623980aaa655b (diff)
shiboken: Add the c++ header include paths of g++
It seems standard C++ headers are not found by clang when run g++ 6.3.X on RHEL 7.4. Task-number: PYSIDE-431 Task-number: PYSIDE-513 Change-Id: Ibd400cfa854ce3a9f763c593969cd063346f8056 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index 31904c0d..e9af23bc 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
@@ -32,6 +32,7 @@
#include <QtCore/QDebug>
#include <QtCore/QProcess>
#include <QtCore/QStringList>
+#include <QtCore/QVersionNumber>
#include <string.h>
#include <algorithm>
@@ -132,6 +133,16 @@ static void detectVulkan(HeaderPaths *headerPaths)
}
}
+#if defined(Q_CC_GNU)
+static inline bool isRedHat74()
+{
+ if (QSysInfo::productType() != QLatin1String("rhel"))
+ return false;
+ const QVersionNumber osVersion = QVersionNumber::fromString(QSysInfo::productVersion());
+ return osVersion.isNull() || osVersion >= QVersionNumber(7, 4);
+}
+#endif // Q_CC_GNU
+
// For MSVC, we set the MS compatibility version and let Clang figure out its own
// options and include paths.
// For the others, we pass "-nostdinc" since libclang tries to add it's own system
@@ -167,6 +178,16 @@ QByteArrayList emulatedCompilerOptions()
result.append(QByteArrayLiteral("-isystem"));
result.append(clangBuiltinIncludesDir);
}
+ // Append the c++ include paths since Clang is unable to find <list> etc
+ // on RHEL 7.4 with g++ 6.3. A fix for this has been added to Clang 5.0,
+ // so, the code can be removed once Clang 5.0 is the minimum version.
+ if (isRedHat74()) {
+ const HeaderPaths gppPaths = gppInternalIncludePaths(QStringLiteral("g++"));
+ for (const HeaderPath &h : gppPaths) {
+ if (h.path.contains("c++"))
+ headerPaths.append(h);
+ }
+ }
#else
HeaderPaths headerPaths;
#endif