aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-10-06 16:08:51 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-10-07 13:08:57 +0000
commit7c4f4d8d4e578461d2fc1a586e784df342679562 (patch)
tree7816216c5d027b4d99d07004060470ed52b126c3
parent45e13b1127b6c765b9f6fd3db5f5708dd972af13 (diff)
shiboken: Add Vulkan support
Task-number: PYSIDE-431 Change-Id: I35995213d04a3fb7a6c8399b1397884cf43c09ba Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index 9bdb8a40..31904c0d 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
@@ -120,6 +120,18 @@ static HeaderPaths gppInternalIncludePaths(const QString &compiler)
}
#endif // Q_CC_MSVC
+// Detect Vulkan as supported from Qt 5.10 by checking the environment variables.
+static void detectVulkan(HeaderPaths *headerPaths)
+{
+ static const char *vulkanVariables[] = {"VULKAN_SDK", "VK_SDK_PATH"};
+ for (const char *vulkanVariable : vulkanVariables) {
+ if (qEnvironmentVariableIsSet(vulkanVariable)) {
+ headerPaths->append(HeaderPath(qgetenv(vulkanVariable) + QByteArrayLiteral("/include")));
+ break;
+ }
+ }
+}
+
// For MSVC, we set the MS compatibility version and let Clang figure out its own
// options and include paths.
// For the others, we pass "-nostdinc" since libclang tries to add it's own system
@@ -136,14 +148,14 @@ QByteArrayList emulatedCompilerOptions()
{
QByteArrayList result;
#if defined(Q_CC_MSVC)
- const HeaderPaths headerPaths;
+ HeaderPaths headerPaths;
result.append(QByteArrayLiteral("-fms-compatibility-version=19"));
result.append(QByteArrayLiteral("-Wno-microsoft-enum-value"));
#elif defined(Q_CC_CLANG)
- const HeaderPaths headerPaths = gppInternalIncludePaths(QStringLiteral("clang++"));
+ HeaderPaths headerPaths = gppInternalIncludePaths(QStringLiteral("clang++"));
result.append(noStandardIncludeOption());
#elif defined(Q_CC_GNU)
- const HeaderPaths headerPaths;
+ HeaderPaths headerPaths;
// The clang builtin includes directory is used to find the definitions for intrinsic functions
// and builtin types. It is necessary to use the clang includes to prevent redefinition errors.
@@ -156,8 +168,9 @@ QByteArrayList emulatedCompilerOptions()
result.append(clangBuiltinIncludesDir);
}
#else
- const HeaderPaths headerPaths;
+ HeaderPaths headerPaths;
#endif
+ detectVulkan(&headerPaths);
std::transform(headerPaths.cbegin(), headerPaths.cend(),
std::back_inserter(result), [](const HeaderPath &p) {
return HeaderPath::includeOption(p, true);