diff --git a/CMakeLists.txt b/CMakeLists.txt index b5e7266d..2ba397bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,45 +14,11 @@ string(TOLOWER ${API_NAME} API_LOWERCASE) find_package(PythonInterp 3 REQUIRED) -if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN) - set(DisplayServer Win32) -elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") - add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) - set(DisplayServer Android) -elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # Note: Supported configurations are XCB, XCB + Xlib, Wayland. - # MIR is stubbed and untested +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON) option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON) option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" OFF) option(BUILD_WSI_MIR_SUPPORT "Build Mir WSI support" OFF) - - if (BUILD_WSI_XCB_SUPPORT) - add_definitions(-DVK_USE_PLATFORM_XCB_KHR) - set(DisplayServer Xcb) - endif() - - if (BUILD_WSI_XLIB_SUPPORT) - add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) - set(DisplayServer Xlib) - endif() - - if (BUILD_WSI_WAYLAND_SUPPORT) - add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR) - set(DisplayServer Wayland) - endif() - - if (BUILD_WSI_MIR_SUPPORT) - add_definitions(-DVK_USE_PLATFORM_MIR_KHR) - set(DisplayServer Mir) - endif() - - if (NOT BUILD_WSI_XCB_SUPPORT AND NOT BUILD_WSI_XLIB_SUPPORT AND NOT BUILD_WSI_WAYLAND_SUPPORT AND NOT BUILD_WSI_MIR_SUPPORT) - set(DisplayServer Display) - endif() -else() - message(FATAL_ERROR "Unsupported Platform!") endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 070c14ae..ea5f5565 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -2,6 +2,30 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN) + set(DisplayServer Win32) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") + add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + if (BUILD_WSI_XCB_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_XCB_KHR) + endif() + + if (BUILD_WSI_XLIB_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) + endif() + + 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() if (WIN32) FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${API_LOWERCASE}-${MAJOR}.def DEF_FILE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b1b83a5f..021ea1ae 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,30 @@ cmake_minimum_required(VERSION 2.8.11) +if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN) + set(DisplayServer Win32) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") + add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + if (BUILD_WSI_XCB_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_XCB_KHR) + endif() + + if (BUILD_WSI_XLIB_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) + endif() + + 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() + # On Windows, we must pair Debug and Release appropriately if (WIN32) # For Windows, since 32-bit and 64-bit items can co-exist, we build each in its own build directory.