GN Build: Add a way to skip xlib includes

Xlib headers `#define` really common names and are problematic when
included in various places.

0f0cfd88d7 added VK_USE_PLATFORM_XLIB_KHR
when vulkan_use_x11=true, alongside the pre-existing
VK_USE_PLATFORM_XCB_KHR.  In this change, VK_USE_PLATFORM_XLIB_KHR is
only added if vulkan_no_xlib_headers=false, so projects can opt out of
xlib includes.
This commit is contained in:
Shahbaz Youssefi 2025-08-17 22:48:37 -04:00 committed by Charles Giessen
parent 2e0a6e699e
commit 2efaa559ff

View file

@ -13,10 +13,10 @@ config("vulkan_headers_config") {
defines += [ "VK_USE_PLATFORM_WIN32_KHR" ] defines += [ "VK_USE_PLATFORM_WIN32_KHR" ]
} }
if (defined(vulkan_use_x11) && vulkan_use_x11) { if (defined(vulkan_use_x11) && vulkan_use_x11) {
defines += [ defines += [ "VK_USE_PLATFORM_XCB_KHR" ]
"VK_USE_PLATFORM_XCB_KHR", if (!defined(vulkan_no_xlib_headers) || !vulkan_no_xlib_headers) {
"VK_USE_PLATFORM_XLIB_KHR", defines += [ "VK_USE_PLATFORM_XLIB_KHR" ]
] }
} }
if (defined(vulkan_use_wayland) && vulkan_use_wayland) { if (defined(vulkan_use_wayland) && vulkan_use_wayland) {
defines += [ "VK_USE_PLATFORM_WAYLAND_KHR" ] defines += [ "VK_USE_PLATFORM_WAYLAND_KHR" ]