aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2024-03-22 17:51:12 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2024-03-25 13:10:42 +0100
commit6785dc5fbfb99d08f32c6f28f3d5470cd7d5cec2 (patch)
treecd4a46a72e3340d4ae26de3d33b6e7bb7a1a845a /sources/shiboken6
parent47d6abbd727d193158cdc1747cb18241267409c1 (diff)
shiboken6: Handle CMAKE_CXX_COMPILER in non-standard locations
CMAKE_CXX_COMPILER on the build machine may point to a non-standard location. Add a patch search to handle this. Task-number: PYSIDE-2648 Pick-to: 6.7 6.6 Change-Id: I049aa1a9c5ac086d381912be1af5f166f1e54608 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/shiboken6')
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp
index 1b3c2d7d8..1f40f0a82 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp
@@ -323,9 +323,22 @@ static QString compilerFromCMake(const QString &defaultCompiler)
// 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;
+ if (platform() == Platform::macOS)
+ return defaultCompiler;
+ QString cmakeCompiler = compilerFromCMake();
+ if (cmakeCompiler.isEmpty())
+ return defaultCompiler;
+ QFileInfo fi(cmakeCompiler);
+ // Should be absolute by default, but a user may specify -DCMAKE_CXX_COMPILER=cl.exe
+ if (fi.isRelative())
+ return cmakeCompiler;
+ if (fi.exists())
+ return fi.absoluteFilePath();
+ // The compiler may not exist in case something like icecream or
+ // a non-standard-path was used on the build machine. Check
+ // the executable.
+ cmakeCompiler = QStandardPaths::findExecutable(fi.fileName());
+ return cmakeCompiler.isEmpty() ? defaultCompiler : cmakeCompiler;
}
static void appendClangBuiltinIncludes(HeaderPaths *p)