aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-09 11:38:01 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-10 07:43:39 +0000
commit2313b5247def794216acb1afde93f2c33c2b7aa0 (patch)
tree40081948837ce8993d842aa5c19c8b10c9b585ea
parent49bc243b3d681ce302e2f37d44cf2e1bf10b0418 (diff)
shiboken: Provide g++ internal headers for CentOS, too
Extend the check introduced by 4725008aeea407ae55cfd66de802dd9e06412efc to CentOS. Task-number: PYSIDE-733 Change-Id: Iaaf2b8af0fa03684d4a3cbd5c5e70e141d125139 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index 0d98999b1..74cad05ae 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
@@ -182,12 +182,36 @@ static void detectVulkan(HeaderPaths *headerPaths)
}
#if defined(Q_CC_GNU)
-static inline bool isRedHat74()
+enum class LinuxDistribution { RedHat, CentOs, Other };
+
+static LinuxDistribution linuxDistribution()
+{
+ const QString &productType = QSysInfo::productType();
+ if (productType == QLatin1String("rhel"))
+ return LinuxDistribution::RedHat;
+ if (productType == QLatin1String("centos"))
+ return LinuxDistribution::CentOs;
+ return LinuxDistribution::Other;
+}
+
+static bool checkProductVersion(const QVersionNumber &minimum,
+ const QVersionNumber &excludedMaximum)
{
- if (QSysInfo::productType() != QLatin1String("rhel"))
- return false;
const QVersionNumber osVersion = QVersionNumber::fromString(QSysInfo::productVersion());
- return osVersion.isNull() || osVersion >= QVersionNumber(7, 4);
+ return osVersion.isNull() || (osVersion >= minimum && osVersion < excludedMaximum);
+}
+
+static inline bool needsGppInternalHeaders()
+{
+ const LinuxDistribution distro = linuxDistribution();
+ switch (distro) {
+ case LinuxDistribution::RedHat:
+ case LinuxDistribution::CentOs:
+ return checkProductVersion(QVersionNumber(7), QVersionNumber(8));
+ case LinuxDistribution::Other:
+ break;
+ }
+ return false;
}
#endif // Q_CC_GNU
@@ -294,9 +318,10 @@ QByteArrayList emulatedCompilerOptions()
#endif // NEED_CLANG_BUILTIN_INCLUDES
// 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()) {
+ // on RHEL 7 with g++ 6.3 or CentOS 7.2.
+ // 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 (needsGppInternalHeaders()) {
const HeaderPaths gppPaths = gppInternalIncludePaths(QStringLiteral("g++"));
for (const HeaderPath &h : gppPaths) {
if (h.path.contains("c++"))