diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-02-11 14:41:53 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-02-11 15:18:24 +0100 |
| commit | e330f659c47de880493f9bfd4ba2a000196d00bc (patch) | |
| tree | d4e6d7064bdaa9cf6594306c6dadbe88c91ce7f9 | |
| parent | 9827a47135d8e0ac7262c6c13188e387bf034b3b (diff) | |
shiboken6: Move Vulkan detection out of the emulated compiler options
Task-number: PYSIDE-1812
Change-Id: I304d0c437cda114a865828578dca320c0d2fe45f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
3 files changed, 9 insertions, 5 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp index 8100cab77..9282fc28b 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp @@ -281,6 +281,7 @@ static CXTranslationUnit createTranslationUnit(CXIndex index, clangArgs += emulatedCompilerOptions(); clangArgs += defaultArgs; } + clangArgs += detectVulkan(); clangArgs += args; QScopedArrayPointer<const char *> argv(byteArrayListToFlatArgV(clangArgs)); qDebug().noquote().nospace() << msgCreateTranslationUnit(clangArgs, flags); diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp index fb42b78f0..7d31f17e0 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.cpp @@ -186,16 +186,18 @@ static HeaderPaths gppInternalIncludePaths(const QString &compiler) } // Detect Vulkan as supported from Qt 5.10 by checking the environment variables. -static void detectVulkan(HeaderPaths *headerPaths) +QByteArrayList detectVulkan() { static const char *vulkanVariables[] = {"VULKAN_SDK", "VK_SDK_PATH"}; for (const char *vulkanVariable : vulkanVariables) { if (qEnvironmentVariableIsSet(vulkanVariable)) { - const QByteArray path = qgetenv(vulkanVariable) + QByteArrayLiteral("/include"); - headerPaths->append(HeaderPath{path, HeaderType::System}); - break; + const auto option = QByteArrayLiteral("-isystem") + + qgetenv(vulkanVariable) + + QByteArrayLiteral("/include"); + return {option}; } } + return {}; } // For MSVC, we set the MS compatibility version and let Clang figure out its own @@ -326,7 +328,6 @@ QByteArrayList emulatedCompilerOptions() break; } - detectVulkan(&headerPaths); std::transform(headerPaths.cbegin(), headerPaths.cend(), std::back_inserter(result), HeaderPath::includeOption); return result; diff --git a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h index 479e211ce..168faeff7 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h +++ b/sources/shiboken6/ApiExtractor/clangparser/compilersupport.h @@ -63,6 +63,8 @@ LanguageLevel emulatedCompilerLanguageLevel(); const char *languageLevelOption(LanguageLevel l); LanguageLevel languageLevelFromOption(const char *); +QByteArrayList detectVulkan(); + Compiler compiler(); Platform platform(); } // namespace clang |
