aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Barbour <tony@LunarG.com>2016-12-07 12:12:45 -0700
committerTony Barbour <tony@LunarG.com>2016-12-09 11:48:58 -0700
commit6af0b532da332df2af073614025a6bbf900c2598 (patch)
tree91fc7e42495b351a74fa36ca3ce8fa35f552644c
parent61e9b870c88fa3af43663697ef98960ff97053e5 (diff)
downloadusermoji-6af0b532da332df2af073614025a6bbf900c2598.tar.xz
Demos: Add DEMOS_WSI_SELECTION to pick Linux wsi to use
Change-Id: Ic1fcc6cf888d94b84a43661aa33815948d85b701
-rw-r--r--BUILD.md15
-rw-r--r--CMakeLists.txt1
-rw-r--r--demos/CMakeLists.txt30
3 files changed, 35 insertions, 11 deletions
diff --git a/BUILD.md b/BUILD.md
index 3d3f7ef8..3358d136 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -23,12 +23,12 @@ git clone https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers
The build process uses CMake to generate makefiles for this project.
The build generates the loader, layers, and tests.
-This repo has been built and tested on Ubuntu 14.04.3 LTS, 14.10, 15.04, 15.10, and 16.04 LTS.
+This repo has been built and tested on the two most recent Ubuntu LTS versions.
It should be straightforward to use it on other Linux distros.
These packages are needed to build this repository:
```
-sudo apt-get install git cmake build-essential bison libx11-dev libxcb1-dev libxkbcommon-dev
+sudo apt-get install git cmake build-essential bison libx11-dev libxcb1-dev libxkbcommon-dev libmirclient-dev libwayland-dev
```
Example debug build (Note that the update\_external\_sources script used below builds external tools into predefined locations. See **Loader and Validation Layer Dependencies** for more information and other options):
@@ -54,6 +54,11 @@ The `LoaderAndLayerInterface` document in the `loader` folder in this repository
describes both how ICDs and layers should be properly
packaged, and how developers can point to ICDs and layers within their builds.
+### WSI Support Build Options
+By default, the Vulkan Loader and Validation Layers are built with support for all 4 Vulkan-defined WSI display systems, Xcb, Xlib, Wayland, and Mir. It is recommended to build these modules with support for these
+display systems to maximize their usability across Linux platforms.
+If it is necessary to build these modules without support for one of the display systems, the appropriate CMake option of the form BUILD_WSI_xxx_SUPPORT can be set to OFF. See the top-level CMakeLists.txt file for more info.
+
### Linux Install to System Directories
Installing the files resulting from your build to the systems directories is optional since
@@ -169,6 +174,12 @@ Some demos that can be found in the dbuild/demos directory are:
- cube: a textured spinning cube
- smoke/smoke: A "smoke" test using a more complex Vulkan demo
+You can select which WSI subsystem is used to build the demos using a cmake option called DEMOS_WSI_SELECTION.
+Supported options are XCB (default), XLIB, WAYLAND, and MIR. Note that you must build using the corresponding BUILD_WSI_*_SUPPORT enabled at the base repo level (all SUPPORT options are ON by default).
+For instance, creating a build that will use Xlib to build the demos, your cmake command line might look like:
+
+cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DDEMOS_WSI_SELECTION=XLIB
+
## Windows System Requirements
Windows 7+ with additional required software packages:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e20fd7e..34aa8e5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON)
option(BUILD_WSI_MIR_SUPPORT "Build Mir WSI support" ON)
+ option(DEMOS_WSI_SELECTION "Select WSI to use to build demos" XCB)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt
index 565253ea..eff654bc 100644
--- a/demos/CMakeLists.txt
+++ b/demos/CMakeLists.txt
@@ -4,20 +4,30 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
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)
+ if (NOT DEMOS_WSI_SELECTION)
+ set(DEMOS_WSI_SELECTION "XCB")
+ endif()
+
+ if (DEMOS_WSI_SELECTION STREQUAL "XCB")
+ if (NOT BUILD_WSI_XCB_SUPPORT)
+ message( FATAL_ERROR "Selected XCB for demos build but not building Xcb support" )
+ endif()
find_package(XCB REQUIRED)
include_directories(${XCB_INCLUDE_DIRS})
link_libraries(${XCB_LIBRARIES})
- endif()
- if(BUILD_WSI_XLIB_SUPPORT)
- add_definitions(-DVK_USE_PLATFORM_XLIB_KHR)
+ add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
+ elseif(DEMOS_WSI_SELECTION STREQUAL "XLIB")
+ if (NOT BUILD_WSI_XLIB_SUPPORT)
+ message( FATAL_ERROR "Selected XLIB for demos build but not building Xlib support" )
+ endif()
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
link_libraries(${X11_LIBRARIES})
- endif()
- if(BUILD_WSI_WAYLAND_SUPPORT)
- add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR)
+ add_definitions(-DVK_USE_PLATFORM_XLIB_KHR)
+ elseif(DEMOS_WSI_SELECTION STREQUAL "WAYLAND")
+ if (NOT BUILD_WSI_WAYLAND_SUPPORT)
+ message( FATAL_ERROR "Selected Wayland for demos build but not building Wayland support" )
+ endif()
find_package(Wayland REQUIRED)
include_directories(${WAYLAND_CLIENT_INCLUDE_DIR})
link_libraries(${WAYLAND_CLIENT_LIBRARIES})
@@ -35,6 +45,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
include_directories ("${PROJECT_SOURCE_DIR}/icd/common")
link_libraries(${API_LOWERCASE} m)
+else()
+ message(FATAL_ERROR "Unsupported Platform!")
endif()
file(GLOB TEXTURES
@@ -138,7 +150,7 @@ else()
endif()
if ((${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}))
- if (BUILD_WSI_XCB_SUPPORT OR BUILD_WSI_WAYLAND_SUPPORT OR WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Android"))
+ if ((DEMOS_WSI_SELECTION STREQUAL "XCB") OR (DEMOS_WSI_SELECTION STREQUAL "WAYLAND") OR WIN32 OR (CMAKE_SYSTEM_NAME STREQUAL "Android"))
add_subdirectory(smoke)
endif()
endif()