From 3bc89f3d1c2f0355fed05884a6d62ef8a36d0292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 6 Nov 2018 10:59:22 +0100 Subject: [PATCH] CMake: Allow disabling Wayland support with USE_WAYLAND_WSI This change means that USE_WAYLAND_WSI=ON no longer triggers a fatal error if Wayland libraries are missing though, it will just show a message and continue building without Wayand WSI support. Closes #11536. --- CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c15cba0d074..b572ba7817d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,6 +122,7 @@ option(USING_FBDEV "Set to ON if target environment uses fbdev (eg. Pandora)" ${ option(USING_GLES2 "Set to ON if target device uses OpenGL ES 2.0" ${USING_GLES2}) option(RASPBIAN "Set to ON to workaround threading issues when building for ARMV7 on Raspbian" ${RASPBIAN}) option(USING_X11_VULKAN "Set to OFF if target environment doesn't use X11 for Vulkan" ON) +option(USE_WAYLAND_WSI "Enable or disable Wayland WSI support for Vulkan" ON) # :: Frontends option(USING_QT_UI "Set to ON if you wish to use the Qt frontend wrapper" ${USING_QT_UI}) option(MOBILE_DEVICE "Set to ON when targeting a mobile device" ${MOBILE_DEVICE}) @@ -134,7 +135,6 @@ option(USE_FFMPEG "Build with FFMPEG support" ${USE_FFMPEG}) option(USE_SYSTEM_SNAPPY "Dynamically link against system snappy" ${USE_SYSTEM_SNAPPY}) option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG}) option(USE_SYSTEM_LIBZIP "Dynamically link against system libzip" ${USE_SYSTEM_LIBZIP}) -option(USE_WAYLAND_WSI "Set to ON to require Wayland support for Vulkan" ${USE_WAYLAND_WSI}) option(USE_ADDRESS_SANITIZER "Use Clang memory sanitizer" ${USE_ADDRESS_SANITIZER}) if(UNIX AND NOT (APPLE OR ANDROID) AND VULKAN) @@ -145,13 +145,14 @@ if(UNIX AND NOT (APPLE OR ANDROID) AND VULKAN) message("NOT using X11 for Vulkan") endif() # add_definitions(-DVK_USE_PLATFORM_XCB_KHR) - find_package(Wayland) - if(USE_WAYLAND_WSI AND NOT WAYLAND_FOUND) - message(FATAL_ERROR "Could not find libwayland, but USE_WAYLAND_WSI was enabled. Failing.") - endif() - if(WAYLAND_FOUND) - include_directories(${WAYLAND_INCLUDE_DIR}) - add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR) + if(USE_WAYLAND_WSI) + find_package(Wayland) + if(NOT WAYLAND_FOUND) + message(STATUS "Could not find Wayland libraries, disabling Wayland WSI support for Vulkan.") + else() + include_directories(${WAYLAND_INCLUDE_DIR}) + add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR) + endif() endif() endif()