aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-12-05 15:10:38 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-12-05 21:38:46 +0000
commit39e551d3d6d18abdf993d1936e7ae9a55584c86f (patch)
tree65c7df83db20438b1985fa057abf7924e6fbee2f /sources
parentcab2bd2bcb7c5638b018560bbe3fb61ce96bb028 (diff)
shiboken: Fix finding of the Clang lib dir
Query llvm-config for the lib dir instead of constructing the path from the prefix in case the Clang location is obtained via llvm-config. Assume a standard build in case the Clang location is obtained via environment variables. Change-Id: I7628d90706100a61f8a605e931bd023b27f1f442 Fixes: PYSIDE-867 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index 74cad05ae..d3d5c8da8 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
@@ -239,11 +239,11 @@ static QByteArray noStandardIncludeOption() { return QByteArrayLiteral("-nostdin
#endif
#if NEED_CLANG_BUILTIN_INCLUDES
-static QString findClang()
+static QString findClangLibDir()
{
for (const char *envVar : {"LLVM_INSTALL_DIR", "CLANG_INSTALL_DIR"}) {
if (qEnvironmentVariableIsSet(envVar)) {
- const QString path = QFile::decodeName(qgetenv(envVar));
+ const QString path = QFile::decodeName(qgetenv(envVar)) + QLatin1String("/lib");
if (QFileInfo::exists(path))
return path;
}
@@ -252,7 +252,7 @@ static QString findClang()
QStandardPaths::findExecutable(QLatin1String("llvm-config"));
if (!llvmConfig.isEmpty()) {
QByteArray stdOut;
- if (runProcess(llvmConfig, QStringList{QLatin1String("--prefix")}, &stdOut)) {
+ if (runProcess(llvmConfig, QStringList{QLatin1String("--libdir")}, &stdOut)) {
const QString path = QFile::decodeName(stdOut.trimmed());
if (QFileInfo::exists(path))
return path;
@@ -264,11 +264,11 @@ static QString findClang()
static QString findClangBuiltInIncludesDir()
{
// Find the include directory of the highest version.
- const QString clangPath = findClang();
- if (!clangPath.isEmpty()) {
+ const QString clangPathLibDir = findClangLibDir();
+ if (!clangPathLibDir.isEmpty()) {
QString candidate;
QVersionNumber lastVersionNumber(1, 0, 0);
- QDir clangDir(clangPath + QLatin1String("/lib/clang"));
+ QDir clangDir(clangPathLibDir + QLatin1String("/clang"));
const QFileInfoList versionDirs =
clangDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (const QFileInfo &fi : versionDirs) {