From 5bf290776c74f64ecb48944cb96d626daab715ed Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 31 Jul 2023 11:23:24 +0200 Subject: [PATCH] rhi: Guard QRhiVulkan more in qrhi_platform.h Replicate qvulkaninstance.h's logic. The idea being to allow to compile code that uses QRhi (so includes qrhi.h) with a pre-built Qt that was built with Vulkan support, but there is no Vulkan SDK (and so vulkan.h) on the developer's system. Normally this is not something we care about, e.g. compiling an application using QVulkanInstance or any other Vulkan functionality implies one has to have the SDK installed or at least the headers available in one way or another. However, including qrhi.h (and so qrhi_platform.h) happens in some cases in applications that do not themselves initialize a QRhi, i.e. they do not care about the QRhiVulkan* structs, because they only ever use a QRhi retrieved e.g. from the QQuickWindow. Design Studio is one example. To allow building DS against a Qt that is Vulkan-enabled (e.g. the official Qt releases) but in an environment that has no Vulkan headers, we skip the QRhiVulkan* stuff when there is no vulkan.h available. Change-Id: Ic81250e6c90939a38f79cab1438fbb9f483f56df Reviewed-by: Miikka Heikkinen (cherry picked from commit c6fce818db7e56f659ea88784d2f9278f9ce1436) Reviewed-by: Qt Cherry-pick Bot --- src/gui/rhi/qrhi_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/rhi/qrhi_platform.h b/src/gui/rhi/qrhi_platform.h index 30676d0da6a..e5069738c17 100644 --- a/src/gui/rhi/qrhi_platform.h +++ b/src/gui/rhi/qrhi_platform.h @@ -66,7 +66,7 @@ struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles #endif // opengl/qdoc -#if QT_CONFIG(vulkan) || defined(Q_QDOC) +#if (QT_CONFIG(vulkan) && __has_include()) || defined(Q_QDOC) struct Q_GUI_EXPORT QRhiVulkanInitParams : public QRhiInitParams {