From: Tony Barbour Date: Wed, 7 Dec 2016 18:18:19 +0000 (-0700) Subject: Cmake: Move WSI compile decision to subdirectories X-Git-Tag: upstream/1.1.92~1974 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f7ed016c6c2abb832b46baa927ca794c531601a;p=platform%2Fupstream%2FVulkan-Tools.git Cmake: Move WSI compile decision to subdirectories Change-Id: I61ac8910200a1751a23aa92fe0e7d955ee9e03e5 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b5e7266..2ba397b 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/demos/CMakeLists.txt b/demos/CMakeLists.txt index 802e85b..a07ddd3 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -1,13 +1,30 @@ -if(NOT WIN32) - if (BUILD_WSI_XCB_SUPPORT) +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) find_package(XCB REQUIRED) + include_directories(${XCB_INCLUDE_DIRS}) + link_libraries(${XCB_LIBRARIES}) endif() - if (BUILD_WSI_XLIB_SUPPORT) + if(BUILD_WSI_XLIB_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_XLIB_KHR) find_package(X11 REQUIRED) + include_directories(${X11_INCLUDE_DIR}) + link_libraries(${X11_LIBRARIES}) endif() - if (BUILD_WSI_WAYLAND_SUPPORT) + if(BUILD_WSI_WAYLAND_SUPPORT) + add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR) find_package(Wayland REQUIRED) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + link_libraries(${WAYLAND_CLIENT_LIBRARIES}) endif() + + include_directories ("${PROJECT_SOURCE_DIR}/icd/common") + link_libraries(${API_LOWERCASE} m) endif() file(GLOB TEXTURES @@ -66,23 +83,6 @@ else() endif() endif() -if(NOT WIN32) - if(BUILD_WSI_XCB_SUPPORT) - include_directories(${XCB_INCLUDE_DIRS}) - link_libraries(${XCB_LIBRARIES}) - endif() - if(BUILD_WSI_XLIB_SUPPORT) - include_directories(${X11_INCLUDE_DIR}) - link_libraries(${X11_LIBRARIES}) - endif() - if(BUILD_WSI_WAYLAND_SUPPORT) - include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) - link_libraries(${WAYLAND_CLIENT_LIBRARIES}) - endif() - - include_directories ("${PROJECT_SOURCE_DIR}/icd/common") - link_libraries(${API_LOWERCASE} m) -endif() if(WIN32) include_directories ( "${PROJECT_SOURCE_DIR}/icd/common" diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index 722c99e..029a51c 100644 --- a/layers/CMakeLists.txt +++ b/layers/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() + macro(run_vk_helper subcmd) add_custom_command(OUTPUT ${ARGN} COMMAND ${PYTHON_CMD} ${SCRIPTS_DIR}/vk_helper.py --${subcmd} ${PROJECT_SOURCE_DIR}/include/vulkan/vulkan.h --abs_out_dir ${CMAKE_CURRENT_BINARY_DIR} diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 070c14a..ea5f556 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)