2025-01-15 16:05:05 +00:00
|
|
|
# Copyright (c) 2019-2025 Arm Limited.
|
2019-05-24 15:57:50 +01:00
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
#
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
# of this software and associated documentation files (the "Software"), to
|
|
|
|
|
# deal in the Software without restriction, including without limitation the
|
|
|
|
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
|
# sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
#
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in all
|
|
|
|
|
# copies or substantial portions of the Software.
|
|
|
|
|
#
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
|
# SOFTWARE.
|
|
|
|
|
|
2025-06-17 10:33:44 +00:00
|
|
|
cmake_minimum_required(VERSION 3.4.3...4.0)
|
2021-01-31 20:09:53 +00:00
|
|
|
project(VkLayer_window_system_integration)
|
2019-05-24 15:57:50 +01:00
|
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
|
pkg_check_modules(VULKAN_PKG_CONFIG vulkan)
|
|
|
|
|
|
2021-10-12 15:06:40 +01:00
|
|
|
find_program(CLANG_TIDY clang-tidy-8)
|
|
|
|
|
|
|
|
|
|
if (NOT CLANG_TIDY STREQUAL "CLANG_TIDY-NOTFOUND")
|
|
|
|
|
message(STATUS "Using clang-tidy: ${CLANG_TIDY}")
|
|
|
|
|
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY} -checks=bugprone-*,modernize-*)
|
|
|
|
|
endif()
|
|
|
|
|
|
2025-08-05 12:34:59 +00:00
|
|
|
string(APPEND CMAKE_CXX_FLAGS
|
|
|
|
|
" -Wall -Werror -Wextra"
|
2025-12-17 09:55:55 +00:00
|
|
|
" -Wshadow -Wconversion"
|
2025-08-05 12:34:59 +00:00
|
|
|
" -Wdouble-promotion -Wnon-virtual-dtor -Wdelete-non-virtual-dtor"
|
2025-12-17 09:55:55 +00:00
|
|
|
" -Wcast-qual -Wmissing-format-attribute"
|
2025-08-05 12:34:59 +00:00
|
|
|
" -pthread -fPIC"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
string(APPEND CMAKE_C_FLAGS
|
|
|
|
|
" -Wall -Werror -Wextra"
|
2025-12-17 09:55:55 +00:00
|
|
|
" -Wshadow -Wconversion"
|
2025-08-05 12:34:59 +00:00
|
|
|
" -Wstrict-prototypes"
|
|
|
|
|
" -fPIC"
|
|
|
|
|
)
|
|
|
|
|
|
2022-08-19 08:56:59 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2019-05-24 15:57:50 +01:00
|
|
|
|
2020-08-04 12:25:34 +01:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
|
2021-11-03 11:25:48 +00:00
|
|
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
|
|
|
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
2025-11-04 12:20:24 +00:00
|
|
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
|
2020-08-04 12:25:34 +01:00
|
|
|
|
2019-05-24 15:57:50 +01:00
|
|
|
if(NOT DEFINED VULKAN_CXX_INCLUDE)
|
|
|
|
|
set(VULKAN_CXX_INCLUDE ${VULKAN_PKG_CONFIG_INCLUDEDIR})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(DEFINED VULKAN_CXX_INCLUDE)
|
|
|
|
|
message(STATUS "Using Vulkan include directories: ${VULKAN_CXX_INCLUDE}")
|
|
|
|
|
separate_arguments(VULKAN_CXX_INCLUDE)
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Either vulkan.pc must be available or VULKAN_CXX_INCLUDE must be defined")
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-01-31 20:09:53 +00:00
|
|
|
# Build Configuration options
|
2024-10-01 15:18:22 +00:00
|
|
|
|
|
|
|
|
# Backend support
|
2021-10-26 10:07:14 +00:00
|
|
|
option(BUILD_WSI_HEADLESS "Build with support for VK_EXT_headless_surface" ON)
|
2021-01-31 20:09:53 +00:00
|
|
|
option(BUILD_WSI_WAYLAND "Build with support for VK_KHR_wayland_surface" OFF)
|
2024-01-31 12:48:32 +01:00
|
|
|
option(BUILD_WSI_DISPLAY "Build with support for VK_KHR_display" OFF)
|
2024-10-01 15:18:22 +00:00
|
|
|
|
2025-11-10 13:48:24 +00:00
|
|
|
set(SELECT_EXTERNAL_ALLOCATOR "none" CACHE STRING "Select an external system allocator (none, dma_buf_heaps)")
|
2024-10-01 15:18:22 +00:00
|
|
|
set(EXTERNAL_WSIALLOC_LIBRARY "" CACHE STRING "External implementation of the wsialloc interface to use")
|
2024-10-28 16:58:52 +00:00
|
|
|
set(WSIALLOC_MEMORY_HEAP_NAME "linux,cma" CACHE STRING "Heap name used by the dma_buf_heaps allocator")
|
2024-10-01 15:18:22 +00:00
|
|
|
|
|
|
|
|
# Optional features
|
2024-04-11 10:05:24 +02:00
|
|
|
option(BUILD_WSI_DISPLAY_SUPPORT_FORMAT_MODIFIERS "Build with support for format modifiers in VK_KHR_display" ON)
|
2024-08-21 12:59:49 +01:00
|
|
|
option(VULKAN_WSI_LAYER_EXPERIMENTAL "Enable the Vulkan WSI Experimental features" OFF)
|
2024-10-15 13:41:21 +01:00
|
|
|
option(ENABLE_WAYLAND_FIFO_PRESENTATION_THREAD "Enable the non-conformant FIFO presentation thread implementation in the Wayland backend" OFF)
|
2024-10-01 15:18:22 +00:00
|
|
|
|
|
|
|
|
# Enables the layer to pass frame boundary events if the ICD or layers below have support for it by
|
|
|
|
|
# making use of the VK_EXT_frame_boundary extension. If the application itself makes use of the
|
|
|
|
|
# VK_EXT_frame_boundary then the layer will not pass its own frame boundary events.
|
|
|
|
|
option(ENABLE_INSTRUMENTATION "Pass frame boundary events by using VK_EXT_frame_boundary" OFF)
|
2021-01-31 20:09:53 +00:00
|
|
|
|
2024-03-06 09:39:05 +01:00
|
|
|
if(BUILD_WSI_WAYLAND OR BUILD_WSI_DISPLAY)
|
2022-03-18 12:05:46 +00:00
|
|
|
set(BUILD_DRM_UTILS true)
|
2025-03-26 17:15:21 +00:00
|
|
|
set(BUILD_WSIALLOC_UTILS true)
|
2021-01-31 20:09:53 +00:00
|
|
|
if(SELECT_EXTERNAL_ALLOCATOR STREQUAL "none")
|
2024-03-06 09:39:05 +01:00
|
|
|
message(FATAL_ERROR "WSI only supported with an external allocator.")
|
2021-01-31 20:09:53 +00:00
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(BUILD_DRM_UTILS)
|
|
|
|
|
add_library(drm_utils STATIC util/drm/drm_utils.cpp)
|
|
|
|
|
|
|
|
|
|
pkg_check_modules(LIBDRM REQUIRED libdrm)
|
|
|
|
|
message(STATUS "Using libdrm include directories: ${LIBDRM_INCLUDE_DIRS}")
|
|
|
|
|
message(STATUS "Using libdrm cflags: ${LIBDRM_CFLAGS}")
|
|
|
|
|
|
|
|
|
|
target_sources(drm_utils PRIVATE util/drm/format_table.c)
|
|
|
|
|
target_include_directories(drm_utils PRIVATE ${VULKAN_CXX_INCLUDE})
|
|
|
|
|
target_include_directories(drm_utils PUBLIC ${LIBDRM_INCLUDE_DIRS})
|
2021-11-15 13:59:10 +00:00
|
|
|
target_include_directories(drm_utils PUBLIC util/wsialloc)
|
2021-01-31 20:09:53 +00:00
|
|
|
target_compile_options(drm_utils PUBLIC ${LIBDRM_CFLAGS})
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-11-15 13:59:10 +00:00
|
|
|
# External WSI Allocator
|
2021-10-04 12:30:14 +01:00
|
|
|
if(NOT SELECT_EXTERNAL_ALLOCATOR STREQUAL "none" AND EXTERNAL_WSIALLOC_LIBRARY STREQUAL "")
|
2021-01-31 20:09:53 +00:00
|
|
|
add_library(wsialloc STATIC)
|
|
|
|
|
set_target_properties(wsialloc PROPERTIES C_STANDARD 99)
|
|
|
|
|
|
2025-11-10 13:48:24 +00:00
|
|
|
if(SELECT_EXTERNAL_ALLOCATOR STREQUAL "dma_buf_heaps")
|
2024-10-28 16:58:52 +00:00
|
|
|
target_sources(wsialloc PRIVATE util/wsialloc/wsialloc_dma_buf_heaps.c util/wsialloc/wsialloc_helpers.c)
|
|
|
|
|
target_link_libraries(wsialloc drm_utils)
|
2024-10-30 15:11:52 +00:00
|
|
|
if(DEFINED KERNEL_HEADER_DIR)
|
|
|
|
|
target_include_directories(wsialloc PRIVATE "${KERNEL_HEADER_DIR}")
|
2024-10-28 16:58:52 +00:00
|
|
|
else()
|
2024-10-30 15:11:52 +00:00
|
|
|
message(FATAL_ERROR "KERNEL_HEADER_DIR must be defined as the directory that includes the kernel headers.")
|
2024-10-28 16:58:52 +00:00
|
|
|
endif()
|
|
|
|
|
add_definitions(-Ulinux -DWSIALLOC_MEMORY_HEAP_NAME=${WSIALLOC_MEMORY_HEAP_NAME})
|
2021-01-31 20:09:53 +00:00
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "Invalid external allocator selected: ${SELECT_EXTERNAL_ALLOCATOR}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
target_include_directories(wsialloc PRIVATE ${VULKAN_CXX_INCLUDE})
|
|
|
|
|
target_include_directories(wsialloc PRIVATE util/drm)
|
2024-10-28 16:58:52 +00:00
|
|
|
target_include_directories(wsialloc PRIVATE util/)
|
2021-01-31 20:09:53 +00:00
|
|
|
endif()
|
|
|
|
|
|
2025-03-26 17:15:21 +00:00
|
|
|
if(BUILD_WSIALLOC_UTILS)
|
|
|
|
|
add_library(wsi_utils STATIC wsi/wsi_alloc_utils.cpp)
|
|
|
|
|
|
|
|
|
|
target_include_directories(wsi_utils PRIVATE
|
|
|
|
|
${PROJECT_SOURCE_DIR}
|
|
|
|
|
${VULKAN_CXX_INCLUDE}
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
target_link_libraries(wsi_utils drm_utils)
|
|
|
|
|
target_include_directories(wsi_utils PRIVATE util/wsialloc)
|
|
|
|
|
target_compile_definitions(wsi_utils PRIVATE ${WSI_DEFINES})
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-01-31 20:09:53 +00:00
|
|
|
# Wayland WSI
|
|
|
|
|
if(BUILD_WSI_WAYLAND)
|
|
|
|
|
add_library(wayland_wsi STATIC
|
|
|
|
|
wsi/wayland/surface_properties.cpp
|
2021-07-21 20:19:52 +01:00
|
|
|
wsi/wayland/surface.cpp
|
2021-03-03 15:06:41 +00:00
|
|
|
wsi/wayland/wl_helpers.cpp
|
2025-03-27 18:06:44 +00:00
|
|
|
wsi/wayland/swapchain.cpp
|
2025-06-06 16:41:12 +00:00
|
|
|
wsi/wayland/present_wait_wayland.cpp
|
2025-11-20 13:55:45 +00:00
|
|
|
wsi/extensions/external_memory_extension.cpp
|
|
|
|
|
wsi/image_backing_memory_external.cpp)
|
2021-01-31 20:09:53 +00:00
|
|
|
|
2024-11-29 17:22:59 +00:00
|
|
|
if(VULKAN_WSI_LAYER_EXPERIMENTAL)
|
2025-04-01 09:27:18 +00:00
|
|
|
target_sources(wayland_wsi PRIVATE wsi/wayland/present_id_wayland.cpp)
|
2024-11-29 17:22:59 +00:00
|
|
|
target_sources(wayland_wsi PRIVATE wsi/wayland/present_timing_handler.cpp)
|
2025-04-01 09:27:18 +00:00
|
|
|
target_sources(wayland_wsi PRIVATE wsi/wayland/wp_presentation_feedback.cpp)
|
2024-11-29 17:22:59 +00:00
|
|
|
endif()
|
|
|
|
|
|
2021-01-31 20:09:53 +00:00
|
|
|
pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
|
|
|
|
|
message(STATUS "Using Wayland client include directories: ${WAYLAND_CLIENT_INCLUDE_DIRS}")
|
|
|
|
|
message(STATUS "Using Wayland client cflags: ${WAYLAND_CLIENT_CFLAGS}")
|
|
|
|
|
message(STATUS "Using Wayland client ldflags: ${WAYLAND_CLIENT_LDFLAGS}")
|
|
|
|
|
|
2023-10-31 08:49:27 +00:00
|
|
|
find_program(WAYLAND_SCANNER_EXEC wayland-scanner REQUIRED)
|
2021-01-31 20:09:53 +00:00
|
|
|
message(STATUS "Using wayland-scanner : ${WAYLAND_SCANNER_EXEC}")
|
|
|
|
|
|
|
|
|
|
pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols)
|
|
|
|
|
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
|
|
|
|
message(STATUS "Using wayland protocols dir : ${WAYLAND_PROTOCOLS_DIR}")
|
|
|
|
|
|
|
|
|
|
add_custom_target(wayland_generated_files
|
|
|
|
|
COMMAND ${WAYLAND_SCANNER_EXEC} client-header
|
|
|
|
|
${WAYLAND_PROTOCOLS_DIR}/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-client-protocol.h
|
2023-10-31 08:52:32 +00:00
|
|
|
COMMAND ${WAYLAND_SCANNER_EXEC} public-code
|
2021-01-31 20:09:53 +00:00
|
|
|
${WAYLAND_PROTOCOLS_DIR}/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-protocol.c
|
2021-08-16 11:01:11 +01:00
|
|
|
COMMAND ${WAYLAND_SCANNER_EXEC} client-header
|
|
|
|
|
${WAYLAND_PROTOCOLS_DIR}/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.h
|
2023-10-31 08:52:32 +00:00
|
|
|
COMMAND ${WAYLAND_SCANNER_EXEC} public-code
|
2021-08-16 11:01:11 +01:00
|
|
|
${WAYLAND_PROTOCOLS_DIR}/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.c
|
2024-09-17 18:27:34 +01:00
|
|
|
COMMAND ${WAYLAND_SCANNER_EXEC} client-header
|
|
|
|
|
${WAYLAND_PROTOCOLS_DIR}/stable/presentation-time/presentation-time.xml
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.h
|
|
|
|
|
COMMAND ${WAYLAND_SCANNER_EXEC} public-code
|
|
|
|
|
${WAYLAND_PROTOCOLS_DIR}/stable/presentation-time/presentation-time.xml
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.c
|
2021-08-16 11:01:11 +01:00
|
|
|
BYPRODUCTS linux-dmabuf-unstable-v1-protocol.c linux-dmabuf-unstable-v1-client-protocol.h
|
2024-09-17 18:27:34 +01:00
|
|
|
linux-explicit-synchronization-unstable-v1-protocol.c linux-explicit-synchronization-unstable-v1-protocol.h
|
|
|
|
|
presentation-time-client-protocol.c presentation-time-client-protocol.h)
|
2021-01-31 20:09:53 +00:00
|
|
|
|
|
|
|
|
target_sources(wayland_wsi PRIVATE
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-protocol.c
|
2021-08-16 11:01:11 +01:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-dmabuf-unstable-v1-client-protocol.h
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.c
|
2024-09-17 18:27:34 +01:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/linux-explicit-synchronization-unstable-v1-protocol.h
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.c
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/presentation-time-client-protocol.h)
|
2021-01-31 20:09:53 +00:00
|
|
|
add_dependencies(wayland_wsi wayland_generated_files)
|
|
|
|
|
|
2025-08-05 12:34:59 +00:00
|
|
|
# Mark Wayland headers as system to suppress third-party warnings like -Wcast-qual
|
|
|
|
|
target_include_directories(wayland_wsi SYSTEM PRIVATE
|
2021-01-31 20:09:53 +00:00
|
|
|
${WAYLAND_CLIENT_INCLUDE_DIRS}
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
2025-08-05 12:34:59 +00:00
|
|
|
# Keep project and Vulkan includes normal for full warnings
|
|
|
|
|
target_include_directories(wayland_wsi PRIVATE
|
|
|
|
|
${PROJECT_SOURCE_DIR}
|
|
|
|
|
${VULKAN_CXX_INCLUDE})
|
|
|
|
|
|
|
|
|
|
# Suppress cast-qual warnings coming from Wayland headers
|
2021-01-31 20:09:53 +00:00
|
|
|
target_compile_options(wayland_wsi PRIVATE ${WAYLAND_CLIENT_CFLAGS})
|
|
|
|
|
target_compile_options(wayland_wsi INTERFACE "-DBUILD_WSI_WAYLAND=1")
|
2021-10-04 12:30:14 +01:00
|
|
|
if(NOT EXTERNAL_WSIALLOC_LIBRARY STREQUAL "")
|
|
|
|
|
target_link_libraries(wayland_wsi ${EXTERNAL_WSIALLOC_LIBRARY})
|
|
|
|
|
else()
|
|
|
|
|
target_link_libraries(wayland_wsi wsialloc)
|
|
|
|
|
endif()
|
|
|
|
|
target_link_libraries(wayland_wsi drm_utils ${WAYLAND_CLIENT_LDFLAGS})
|
2025-03-26 17:15:21 +00:00
|
|
|
target_link_libraries(wayland_wsi wsi_utils)
|
2021-01-31 20:09:53 +00:00
|
|
|
list(APPEND LINK_WSI_LIBS wayland_wsi)
|
2024-10-15 13:41:21 +01:00
|
|
|
if(ENABLE_WAYLAND_FIFO_PRESENTATION_THREAD)
|
|
|
|
|
target_compile_definitions(wayland_wsi PRIVATE "-DWAYLAND_FIFO_PRESENTATION_THREAD_ENABLED=1")
|
|
|
|
|
else()
|
|
|
|
|
target_compile_definitions(wayland_wsi PRIVATE "-DWAYLAND_FIFO_PRESENTATION_THREAD_ENABLED=0")
|
|
|
|
|
endif()
|
2021-01-31 20:09:53 +00:00
|
|
|
else()
|
|
|
|
|
list(APPEND JSON_COMMANDS COMMAND sed -i '/VK_KHR_wayland_surface/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-10-26 10:07:14 +00:00
|
|
|
# Headless
|
|
|
|
|
if(BUILD_WSI_HEADLESS)
|
|
|
|
|
add_library(wsi_headless STATIC
|
|
|
|
|
wsi/headless/surface_properties.cpp
|
|
|
|
|
wsi/headless/surface.cpp
|
2025-06-06 16:41:12 +00:00
|
|
|
wsi/headless/swapchain.cpp
|
2025-11-20 13:55:45 +00:00
|
|
|
wsi/headless/present_wait_headless.cpp
|
|
|
|
|
wsi/image_backing_memory_device.cpp)
|
2021-10-26 10:07:14 +00:00
|
|
|
|
2024-11-29 17:22:59 +00:00
|
|
|
if(VULKAN_WSI_LAYER_EXPERIMENTAL)
|
|
|
|
|
target_sources(wsi_headless PRIVATE wsi/headless/present_timing_handler.cpp)
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-10-26 10:07:14 +00:00
|
|
|
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)
|
2024-04-12 14:52:39 +02:00
|
|
|
list(APPEND JSON_COMMANDS COMMAND sed -i '/VK_KHR_shared_presentable_image/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
2021-10-26 10:07:14 +00:00
|
|
|
endif()
|
|
|
|
|
|
2024-01-31 12:48:32 +01:00
|
|
|
# Display
|
|
|
|
|
if (BUILD_WSI_DISPLAY)
|
|
|
|
|
add_library(wsi_display STATIC
|
|
|
|
|
wsi/display/drm_display.cpp
|
2024-03-06 09:39:05 +01:00
|
|
|
wsi/display/surface_properties.cpp
|
|
|
|
|
wsi/display/swapchain.cpp
|
2025-03-27 18:06:44 +00:00
|
|
|
wsi/display/surface.cpp
|
2025-11-20 13:55:45 +00:00
|
|
|
wsi/extensions/external_memory_extension.cpp
|
|
|
|
|
wsi/display/present_wait_display.cpp
|
|
|
|
|
wsi/image_backing_memory_external.cpp)
|
2025-05-09 16:04:39 +00:00
|
|
|
|
2024-01-31 12:48:32 +01:00
|
|
|
pkg_check_modules(LIBDRM REQUIRED libdrm)
|
|
|
|
|
message(STATUS "Using libdrm include directories: ${LIBDRM_INCLUDE_DIRS}")
|
|
|
|
|
message(STATUS "Using libdrm ldflags: ${LIBDRM_LDFLAGS}")
|
|
|
|
|
|
|
|
|
|
target_include_directories(wsi_display PRIVATE
|
|
|
|
|
${PROJECT_SOURCE_DIR}
|
|
|
|
|
${VULKAN_CXX_INCLUDE}
|
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
|
|
target_include_directories(wsi_display PUBLIC
|
|
|
|
|
${LIBDRM_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
|
|
target_compile_options(wsi_display INTERFACE "-DBUILD_WSI_DISPLAY=1")
|
|
|
|
|
target_link_libraries(wsi_display ${LIBDRM_LDFLAGS} drm)
|
|
|
|
|
target_link_libraries(wsi_display drm_utils)
|
2025-03-26 17:15:21 +00:00
|
|
|
target_link_libraries(wsi_display wsi_utils)
|
2024-03-06 09:39:05 +01:00
|
|
|
if(NOT EXTERNAL_WSIALLOC_LIBRARY STREQUAL "")
|
|
|
|
|
target_link_libraries(wsi_display ${EXTERNAL_WSIALLOC_LIBRARY})
|
|
|
|
|
else()
|
|
|
|
|
target_link_libraries(wsi_display wsialloc)
|
|
|
|
|
endif()
|
2024-01-31 12:48:32 +01:00
|
|
|
list(APPEND LINK_WSI_LIBS wsi_display)
|
|
|
|
|
else()
|
|
|
|
|
list(APPEND JSON_COMMANDS COMMAND sed -i '/VK_KHR_display/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-01-31 20:09:53 +00:00
|
|
|
# Layer
|
2019-05-24 15:57:50 +01:00
|
|
|
add_library(${PROJECT_NAME} SHARED
|
2025-03-17 11:48:51 +00:00
|
|
|
layer/calibrated_timestamps_api.cpp
|
2019-05-24 15:57:50 +01:00
|
|
|
layer/layer.cpp
|
|
|
|
|
layer/private_data.cpp
|
|
|
|
|
layer/surface_api.cpp
|
|
|
|
|
layer/swapchain_api.cpp
|
2024-01-23 18:19:27 +00:00
|
|
|
layer/swapchain_maintenance_api.cpp
|
2025-06-06 16:41:12 +00:00
|
|
|
layer/present_wait_api.cpp
|
2019-05-24 15:57:50 +01:00
|
|
|
util/timed_semaphore.cpp
|
2020-07-10 10:28:51 +01:00
|
|
|
util/custom_allocator.cpp
|
2025-09-05 15:06:38 +00:00
|
|
|
util/custom_mutex.cpp
|
2020-08-04 12:25:34 +01:00
|
|
|
util/extension_list.cpp
|
2021-03-23 10:24:43 +00:00
|
|
|
util/log.cpp
|
2022-03-18 12:05:46 +00:00
|
|
|
util/format_modifiers.cpp
|
2022-10-21 15:28:09 +00:00
|
|
|
wsi/external_memory.cpp
|
2024-11-28 06:36:17 +00:00
|
|
|
wsi/extensions/image_compression_control.cpp
|
|
|
|
|
wsi/extensions/present_id.cpp
|
2025-06-06 16:41:12 +00:00
|
|
|
wsi/extensions/present_wait.cpp
|
2024-11-28 06:36:17 +00:00
|
|
|
wsi/extensions/frame_boundary.cpp
|
2025-11-20 13:55:45 +00:00
|
|
|
wsi/extensions/mutable_format_extension.cpp
|
|
|
|
|
util/wsi_extension.cpp
|
2024-11-28 06:36:17 +00:00
|
|
|
wsi/extensions/swapchain_maintenance.cpp
|
2022-03-18 12:05:46 +00:00
|
|
|
wsi/surface_properties.cpp
|
2019-05-24 15:57:50 +01:00
|
|
|
wsi/swapchain_base.cpp
|
2021-09-01 22:30:31 +01:00
|
|
|
wsi/synchronization.cpp
|
2025-03-26 13:18:02 +00:00
|
|
|
wsi/wsi_factory.cpp
|
2025-11-20 13:55:45 +00:00
|
|
|
wsi/vulkan_image_handle_creator.cpp
|
|
|
|
|
wsi/swapchain_image_factory.cpp
|
|
|
|
|
wsi/swapchain_image.cpp)
|
2024-08-02 16:56:30 +01:00
|
|
|
if (VULKAN_WSI_LAYER_EXPERIMENTAL)
|
2024-11-28 06:36:17 +00:00
|
|
|
target_sources(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/layer/present_timing_api.cpp)
|
|
|
|
|
target_sources(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/wsi/extensions/present_timing.cpp)
|
2024-08-21 12:59:49 +01:00
|
|
|
add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=1")
|
2024-08-02 16:56:30 +01:00
|
|
|
else()
|
2025-09-18 09:20:43 +00:00
|
|
|
list(APPEND JSON_COMMANDS COMMAND sed -Ei '/VK_EXT_present_timing/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
2024-08-21 12:59:49 +01:00
|
|
|
add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=0")
|
2024-08-02 16:56:30 +01:00
|
|
|
endif()
|
2021-10-26 10:07:14 +00:00
|
|
|
|
2025-11-04 12:20:24 +00:00
|
|
|
|
|
|
|
|
if((CMAKE_BUILD_TYPE MATCHES "^[Dd]ebug$") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
|
|
|
|
target_sources(${PROJECT_NAME} PUBLIC util/debug.cpp)
|
|
|
|
|
endif()
|
2021-01-31 20:09:53 +00:00
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE ${WSI_DEFINES})
|
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
|
|
|
|
${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${VULKAN_CXX_INCLUDE})
|
|
|
|
|
|
2024-04-11 10:05:24 +02:00
|
|
|
if (BUILD_WSI_DISPLAY_SUPPORT_FORMAT_MODIFIERS)
|
|
|
|
|
add_definitions("-DWSI_DISPLAY_SUPPORT_FORMAT_MODIFIERS=1")
|
|
|
|
|
else()
|
|
|
|
|
add_definitions("-DWSI_DISPLAY_SUPPORT_FORMAT_MODIFIERS=0")
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-10-01 15:18:22 +00:00
|
|
|
if(ENABLE_INSTRUMENTATION)
|
|
|
|
|
add_definitions("-DENABLE_INSTRUMENTATION=1")
|
|
|
|
|
else()
|
|
|
|
|
add_definitions("-DENABLE_INSTRUMENTATION=0")
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-01-31 20:09:53 +00:00
|
|
|
target_link_libraries(${PROJECT_NAME} ${LINK_WSI_LIBS})
|
|
|
|
|
|
|
|
|
|
add_custom_target(manifest_json ALL COMMAND
|
|
|
|
|
cp ${PROJECT_SOURCE_DIR}/layer/VkLayer_window_system_integration.json ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
|
${JSON_COMMANDS})
|