From 9bc802e86698ba2c7752cf04e2f07e0f710ba63c Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sat, 20 Feb 2016 08:13:28 -0800 Subject: [PATCH] cmake: Add options for each of the linux wsi interfaces We default everything except XCB to off since that is the only one that has been well-tested up to now. --- CMakeLists.txt | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80888e98..120bf39a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,21 +19,30 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) set(DisplayServer Android) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - add_definitions(-DVK_USE_PLATFORM_XCB_KHR) + # TODO: Basic support is present for Xlib but is untested. + # Wayland/Mir support is stubbed in but unimplemented and untested. + option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) + option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" OFF) + option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" OFF) + option(BUILD_WSI_MIR_SUPPORT "Build Mir WSI support" OFF) + set(DisplayServer Xcb) -# TODO: Basic support is present for Xlib but is untested. -# Wayland/Mir support is stubbed in but unimplemented and untested. + if (BUILD_WSI_XCB_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_XCB_KHR) + endif() -# add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) -# set(DisplayServer Xlib) + if (BUILD_WSI_XLIB_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) + endif() -# add_definitions(-DVK_USE_PLATFORM_MIR_KHR) -# set(DisplayServer Mir) - -# add_definitions(-DVK_USEPLATFORM_WAYLAND_KHR) -# set(DisplayServer Wayland) + if (BUILD_WSI_WAYLAND_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR) + endif() + if (BUILD_WSI_MIR_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_MIR_KHR) + endif() else() message(FATAL_ERROR "Unsupported Platform!") endif()