diff options
| -rw-r--r-- | sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp | 23 | ||||
| -rw-r--r-- | sources/shiboken6/ApiExtractor/clangparser/compilersupport.h | 2 |
2 files changed, 18 insertions, 7 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp index 1b4f336bb..1b3c2d7d8 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp @@ -306,17 +306,26 @@ static QString findClangBuiltInIncludesDir() return queryLlvmConfigDir(u"--includedir"_s); } +QString compilerFromCMake() +{ +#ifdef CMAKE_CXX_COMPILER + return QString::fromLocal8Bit(CMAKE_CXX_COMPILER); +#else + return {}; +#endif +} + +// Return a compiler suitable for determining the internal include paths static QString compilerFromCMake(const QString &defaultCompiler) { if (!compilerPath().isEmpty()) return compilerPath(); -// Added !defined(Q_OS_DARWIN) due to PYSIDE-1032 - QString result = defaultCompiler; -#ifdef CMAKE_CXX_COMPILER - if (platform() != Platform::macOS) - result = QString::fromLocal8Bit(CMAKE_CXX_COMPILER); -#endif - return result; + // Exclude macOS since cmakeCompiler returns the full path instead of the + // /usr/bin/clang shim, which results in the default SDK sysroot path + // missing (PYSIDE-1032) + const QString &cmakeCompiler = compilerFromCMake(); + return platform() != Platform::macOS && !cmakeCompiler.isEmpty() + ? cmakeCompiler : defaultCompiler; } static void appendClangBuiltinIncludes(HeaderPaths *p) diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h index 18e87c495..462e8f205 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h @@ -44,6 +44,8 @@ QByteArrayList detectVulkan(); Compiler compiler(); bool setCompiler(const QString &name); +QString compilerFromCMake(); + const QString &compilerPath(); void setCompilerPath(const QString &name); |
