aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-29 08:49:33 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-29 15:02:17 +0200
commitf4d1a606a0fe5f15ea89779ca3f1bbb9673c2cc6 (patch)
treeb47eed7947a76b0b931a80408e314968aad5e910 /sources/shiboken2
parent74da3924def36011526c590b0308948f3b635859 (diff)
Fix build on centOS/conda forge
- Check for the OS name case-insensitively - Use the compiler from cmake via a define - Add sysroot header directory to internal include paths - Extend centOS version to 6.10 Change-Id: Ia3977f3331d51f9bc530accb8defa5fcb648bdfe Fixes: PYSIDE-1012 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2')
-rw-r--r--sources/shiboken2/ApiExtractor/CMakeLists.txt2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp24
2 files changed, 21 insertions, 5 deletions
diff --git a/sources/shiboken2/ApiExtractor/CMakeLists.txt b/sources/shiboken2/ApiExtractor/CMakeLists.txt
index 760cc6985..c55dba973 100644
--- a/sources/shiboken2/ApiExtractor/CMakeLists.txt
+++ b/sources/shiboken2/ApiExtractor/CMakeLists.txt
@@ -63,6 +63,8 @@ if (NOT DISABLE_DOCSTRINGS)
endif()
endif()
+target_compile_definitions(apiextractor PRIVATE CMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}")
+
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
if (BUILD_TESTS)
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index d3d5c8da8..3196c824e 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
@@ -189,7 +189,7 @@ static LinuxDistribution linuxDistribution()
const QString &productType = QSysInfo::productType();
if (productType == QLatin1String("rhel"))
return LinuxDistribution::RedHat;
- if (productType == QLatin1String("centos"))
+ if (productType.compare(QLatin1String("centos"), Qt::CaseInsensitive) == 0)
return LinuxDistribution::CentOs;
return LinuxDistribution::Other;
}
@@ -207,7 +207,7 @@ static inline bool needsGppInternalHeaders()
switch (distro) {
case LinuxDistribution::RedHat:
case LinuxDistribution::CentOs:
- return checkProductVersion(QVersionNumber(7), QVersionNumber(8));
+ return checkProductVersion(QVersionNumber(6, 10), QVersionNumber(8));
case LinuxDistribution::Other:
break;
}
@@ -288,6 +288,18 @@ static QString findClangBuiltInIncludesDir()
}
#endif // NEED_CLANG_BUILTIN_INCLUDES
+#if defined(Q_CC_CLANG) || defined(Q_CC_GNU)
+static QString compilerFromCMake(const QString &defaultCompiler)
+{
+# ifdef CMAKE_CXX_COMPILER
+ Q_UNUSED(defaultCompiler)
+ return QString::fromLocal8Bit(CMAKE_CXX_COMPILER);
+#else
+ return defaultCompiler;
+# endif
+}
+#endif // Q_CC_CLANG, Q_CC_GNU
+
// Returns clang options needed for emulating the host compiler
QByteArrayList emulatedCompilerOptions()
{
@@ -297,7 +309,7 @@ QByteArrayList emulatedCompilerOptions()
result.append(QByteArrayLiteral("-fms-compatibility-version=19"));
result.append(QByteArrayLiteral("-Wno-microsoft-enum-value"));
#elif defined(Q_CC_CLANG)
- HeaderPaths headerPaths = gppInternalIncludePaths(QStringLiteral("clang++"));
+ HeaderPaths headerPaths = gppInternalIncludePaths(compilerFromCMake(QStringLiteral("clang++")));
result.append(noStandardIncludeOption());
#elif defined(Q_CC_GNU)
HeaderPaths headerPaths;
@@ -322,10 +334,12 @@ QByteArrayList emulatedCompilerOptions()
// 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++"));
+ const HeaderPaths gppPaths = gppInternalIncludePaths(compilerFromCMake(QStringLiteral("g++")));
for (const HeaderPath &h : gppPaths) {
- if (h.path.contains("c++"))
+ if (h.path.contains("c++")
+ || h.path.contains("sysroot")) { // centOS
headerPaths.append(h);
+ }
}
}
#else