mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2026-05-08 20:48:04 +02:00
Add build option for headless extension
Adds a build option that provides the ability to build the layer with or without headless extension support Change-Id: Iedefbd38daf80d84f4763ea54117ca18c7fad088 Signed-off-by: Normunds Rieksts <normunds.rieksts@arm.com>
This commit is contained in:
parent
5cc3b2f498
commit
00338d89f5
2 changed files with 28 additions and 4 deletions
|
|
@ -47,6 +47,7 @@ else()
|
|||
endif()
|
||||
|
||||
# Build Configuration options
|
||||
option(BUILD_WSI_HEADLESS "Build with support for VK_EXT_headless_surface" ON)
|
||||
option(BUILD_WSI_WAYLAND "Build with support for VK_KHR_wayland_surface" OFF)
|
||||
set(SELECT_EXTERNAL_ALLOCATOR "none" CACHE STRING "Select an external system allocator (none, ion)")
|
||||
|
||||
|
|
@ -150,6 +151,24 @@ else()
|
|||
list(APPEND JSON_COMMANDS COMMAND sed -i '/VK_KHR_wayland_surface/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
||||
endif()
|
||||
|
||||
# Headless
|
||||
if(BUILD_WSI_HEADLESS)
|
||||
add_library(wsi_headless STATIC
|
||||
wsi/headless/surface_properties.cpp
|
||||
wsi/headless/surface.cpp
|
||||
wsi/headless/swapchain.cpp)
|
||||
|
||||
target_include_directories(wsi_headless PRIVATE
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${VULKAN_CXX_INCLUDE}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
target_compile_options(wsi_headless INTERFACE "-DBUILD_WSI_HEADLESS=1")
|
||||
list(APPEND LINK_WSI_LIBS wsi_headless)
|
||||
else()
|
||||
list(APPEND JSON_COMMANDS COMMAND sed -i '/VK_EXT_headless_surface/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
||||
endif()
|
||||
|
||||
# Layer
|
||||
add_library(${PROJECT_NAME} SHARED
|
||||
layer/layer.cpp
|
||||
|
|
@ -162,10 +181,8 @@ add_library(${PROJECT_NAME} SHARED
|
|||
util/log.cpp
|
||||
wsi/swapchain_base.cpp
|
||||
wsi/synchronization.cpp
|
||||
wsi/wsi_factory.cpp
|
||||
wsi/headless/surface_properties.cpp
|
||||
wsi/headless/surface.cpp
|
||||
wsi/headless/swapchain.cpp)
|
||||
wsi/wsi_factory.cpp)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE ${WSI_DEFINES})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${VULKAN_CXX_INCLUDE})
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@
|
|||
|
||||
#include "wsi_factory.hpp"
|
||||
#include "surface.hpp"
|
||||
|
||||
#if BUILD_WSI_HEADLESS
|
||||
#include "headless/surface_properties.hpp"
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
|
@ -51,7 +54,9 @@ static struct wsi_extension
|
|||
VkExtensionProperties extension;
|
||||
VkIcdWsiPlatform platform;
|
||||
} const supported_wsi_extensions[] = {
|
||||
#if BUILD_WSI_HEADLESS
|
||||
{ { VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, VK_EXT_HEADLESS_SURFACE_SPEC_VERSION }, VK_ICD_WSI_PLATFORM_HEADLESS },
|
||||
#endif
|
||||
#if BUILD_WSI_WAYLAND
|
||||
{ { VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_SPEC_VERSION }, VK_ICD_WSI_PLATFORM_WAYLAND },
|
||||
#endif
|
||||
|
|
@ -61,8 +66,10 @@ static surface_properties *get_surface_properties(VkIcdWsiPlatform platform)
|
|||
{
|
||||
switch (platform)
|
||||
{
|
||||
#if BUILD_WSI_HEADLESS
|
||||
case VK_ICD_WSI_PLATFORM_HEADLESS:
|
||||
return &headless::surface_properties::get_instance();
|
||||
#endif
|
||||
#if BUILD_WSI_WAYLAND
|
||||
case VK_ICD_WSI_PLATFORM_WAYLAND:
|
||||
return &wayland::surface_properties::get_instance();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue