summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Ramos <juan@lunarg.com>2023-10-10 12:45:34 -0600
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>2023-10-10 13:25:52 -0600
commit09d1b5ed777d8f89bbe7bbe72a65a54a868689db (patch)
tree38e7240c2d8bbec1f0cd3627b98a805cffb1121d
parent48686ee04f9a7905d415c3207c4b05824230aff2 (diff)
downloadVulkan-Tools-09d1b5ed777d8f89bbe7bbe72a65a54a868689db.tar.gz
Vulkan-Tools-09d1b5ed777d8f89bbe7bbe72a65a54a868689db.tar.bz2
Vulkan-Tools-09d1b5ed777d8f89bbe7bbe72a65a54a868689db.zip
cmake: Use pkg-config for Wayland
-rw-r--r--cmake/Copyright_cmake.txt126
-rw-r--r--cmake/FindWayland.cmake68
-rw-r--r--cmake/FindWaylandProtocols.cmake18
-rw-r--r--cmake/FindWaylandScanner.cmake18
-rw-r--r--cube/CMakeLists.txt43
-rw-r--r--icd/CMakeLists.txt3
-rw-r--r--vulkaninfo/CMakeLists.txt7
7 files changed, 29 insertions, 254 deletions
diff --git a/cmake/Copyright_cmake.txt b/cmake/Copyright_cmake.txt
deleted file mode 100644
index 743c6341..00000000
--- a/cmake/Copyright_cmake.txt
+++ /dev/null
@@ -1,126 +0,0 @@
-CMake - Cross Platform Makefile Generator
-Copyright 2000-2018 Kitware, Inc. and Contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-* Neither the name of Kitware, Inc. nor the names of Contributors
- may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-------------------------------------------------------------------------------
-
-The following individuals and institutions are among the Contributors:
-
-* Aaron C. Meadows <cmake@shadowguarddev.com>
-* Adriaan de Groot <groot@kde.org>
-* Aleksey Avdeev <solo@altlinux.ru>
-* Alexander Neundorf <neundorf@kde.org>
-* Alexander Smorkalov <alexander.smorkalov@itseez.com>
-* Alexey Sokolov <sokolov@google.com>
-* Alex Turbov <i.zaufi@gmail.com>
-* Andreas Pakulat <apaku@gmx.de>
-* Andreas Schneider <asn@cryptomilk.org>
-* André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
-* Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
-* Benjamin Eikel
-* Bjoern Ricks <bjoern.ricks@gmail.com>
-* Brad Hards <bradh@kde.org>
-* Christopher Harvey
-* Christoph Grüninger <foss@grueninger.de>
-* Clement Creusot <creusot@cs.york.ac.uk>
-* Daniel Blezek <blezek@gmail.com>
-* Daniel Pfeifer <daniel@pfeifer-mail.de>
-* Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-* Eran Ifrah <eran.ifrah@gmail.com>
-* Esben Mose Hansen, Ange Optimization ApS
-* Geoffrey Viola <geoffrey.viola@asirobots.com>
-* Google Inc
-* Gregor Jasny
-* Helio Chissini de Castro <helio@kde.org>
-* Ilya Lavrenov <ilya.lavrenov@itseez.com>
-* Insight Software Consortium <insightsoftwareconsortium.org>
-* Jan Woetzel
-* Kelly Thompson <kgt@lanl.gov>
-* Konstantin Podsvirov <konstantin@podsvirov.pro>
-* Mario Bensi <mbensi@ipsquad.net>
-* Mathieu Malaterre <mathieu.malaterre@gmail.com>
-* Matthaeus G. Chajdas
-* Matthias Kretz <kretz@kde.org>
-* Matthias Maennich <matthias@maennich.net>
-* Michael Stürmer
-* Miguel A. Figueroa-Villanueva
-* Mike Jackson
-* Mike McQuaid <mike@mikemcquaid.com>
-* Nicolas Bock <nicolasbock@gmail.com>
-* Nicolas Despres <nicolas.despres@gmail.com>
-* Nikita Krupen'ko <krnekit@gmail.com>
-* NVIDIA Corporation <www.nvidia.com>
-* OpenGamma Ltd. <opengamma.com>
-* Patrick Stotko <stotko@cs.uni-bonn.de>
-* Per Øyvind Karlsen <peroyvind@mandriva.org>
-* Peter Collingbourne <peter@pcc.me.uk>
-* Petr Gotthard <gotthard@honeywell.com>
-* Philip Lowman <philip@yhbt.com>
-* Philippe Proulx <pproulx@efficios.com>
-* Raffi Enficiaud, Max Planck Society
-* Raumfeld <raumfeld.com>
-* Roger Leigh <rleigh@codelibre.net>
-* Rolf Eike Beer <eike@sf-mail.de>
-* Roman Donchenko <roman.donchenko@itseez.com>
-* Roman Kharitonov <roman.kharitonov@itseez.com>
-* Ruslan Baratov
-* Sebastian Holtermann <sebholt@xwmw.org>
-* Stephen Kelly <steveire@gmail.com>
-* Sylvain Joubert <joubert.sy@gmail.com>
-* Thomas Sondergaard <ts@medical-insight.com>
-* Tobias Hunger <tobias.hunger@qt.io>
-* Todd Gamblin <tgamblin@llnl.gov>
-* Tristan Carel
-* University of Dundee
-* Vadim Zhukov
-* Will Dicharry <wdicharry@stellarscience.com>
-
-See version control history for details of individual contributions.
-
-The above copyright and license notice applies to distributions of
-CMake in source and binary form. Third-party software packages supplied
-with CMake under compatible licenses provide their own copyright notices
-documented in corresponding subdirectories or source files.
-
-------------------------------------------------------------------------------
-
-CMake was initially developed by Kitware with the following sponsorship:
-
- * National Library of Medicine at the National Institutes of Health
- as part of the Insight Segmentation and Registration Toolkit (ITK).
-
- * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
- Visualization Initiative.
-
- * National Alliance for Medical Image Computing (NAMIC) is funded by the
- National Institutes of Health through the NIH Roadmap for Medical Research,
- Grant U54 EB005149.
-
- * Kitware, Inc.
diff --git a/cmake/FindWayland.cmake b/cmake/FindWayland.cmake
deleted file mode 100644
index 758744d8..00000000
--- a/cmake/FindWayland.cmake
+++ /dev/null
@@ -1,68 +0,0 @@
-# Try to find Wayland on a Unix system
-#
-# This will define:
-#
-# WAYLAND_FOUND - True if Wayland is found
-# WAYLAND_LIBRARIES - Link these to use Wayland
-# WAYLAND_INCLUDE_DIR - Include directory for Wayland
-# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
-#
-# In addition the following more fine grained variables will be defined:
-#
-# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
-# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
-# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
-#
-# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-IF (NOT WIN32)
- IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
- # In the cache already
- SET(WAYLAND_FIND_QUIETLY TRUE)
- ENDIF ()
-
- # Use pkg-config to get the directories and then use these values
- # in the FIND_PATH() and FIND_LIBRARY() calls
- FIND_PACKAGE(PkgConfig)
- PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor)
-
- SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
-
- FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
- FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
- FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
- FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
-
- FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
- FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
- FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
- FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
-
- set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR})
-
- set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES})
-
- list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
-
- include(FindPackageHandleStandardArgs)
-
- set(FPHSA_NAME_MISMATCHED ON)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
- unset(FPHSA_NAME_MISMATCHED)
-
- MARK_AS_ADVANCED(
- WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
- WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
- WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
- WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
- WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES
- )
-
-ENDIF ()
diff --git a/cmake/FindWaylandProtocols.cmake b/cmake/FindWaylandProtocols.cmake
deleted file mode 100644
index 25cf2a62..00000000
--- a/cmake/FindWaylandProtocols.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-# Wayland protocols Defines:
-#
-# * WAYLAND_PROTOCOLS_FOUND True if the wayland-protocols data path is found
-# * WAYLAND_PROTOCOLS_PATH Path to the wayland-scanner executable
-#
-
-if(NOT WIN32)
- find_package(PkgConfig)
- pkg_check_modules(WAYLAND_PROTOCOLS_PATH REQUIRED wayland-protocols)
- execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
- OUTPUT_VARIABLE WAYLAND_PROTOCOLS_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- set(FPHSA_NAME_MISMATCHED ON)
- find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_PROTOCOLS_PATH)
- unset(FPHSA_NAME_MISMATCHED)
-
- mark_as_advanced(WAYLAND_PROTOCOLS_PATH)
-endif()
diff --git a/cmake/FindWaylandScanner.cmake b/cmake/FindWaylandScanner.cmake
deleted file mode 100644
index d016c934..00000000
--- a/cmake/FindWaylandScanner.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-# Wayland scanner Defines:
-#
-# * WAYLAND_SCANNER_FOUND True if wayland-scanner is found
-# * WAYLAND_SCANNER_EXECUTABLE Path to the wayland-scanner executable
-#
-
-if(NOT WIN32)
- # Delegate to pkg-config for our first guess
- find_package(PkgConfig)
- pkg_check_modules(PKG_WAYLAND_SCANNER QUIET wayland-scanner)
- find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner ${PKG_WAYLAND_SCANNER_PREFIX}/bin/wayland-scanner)
-
- set(FPHSA_NAME_MISMATCHED ON)
- find_package_handle_standard_args(WAYLAND DEFAULT_MSG WAYLAND_SCANNER_EXECUTABLE)
- unset(FPHSA_NAME_MISMATCHED)
-
- mark_as_advanced(WAYLAND_SCANNER_EXECUTABLE)
-endif()
diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt
index 2318d912..61440492 100644
--- a/cube/CMakeLists.txt
+++ b/cube/CMakeLists.txt
@@ -33,10 +33,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD")
endif()
if(BUILD_WSI_WAYLAND_SUPPORT)
- find_package(Wayland REQUIRED)
- find_package(WaylandScanner REQUIRED)
- find_package(WaylandProtocols REQUIRED)
- include_directories(${WAYLAND_CLIENT_INCLUDE_DIR})
+ pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client)
+
+ pkg_get_variable(WAYLAND_SCANNER_EXECUTABLE wayland-scanner wayland_scanner)
+ message(STATUS "WAYLAND_SCANNER_EXECUTABLE = ${WAYLAND_SCANNER_EXECUTABLE}")
+
+ pkg_get_variable(WAYLAND_PROTOCOLS_PATH wayland-protocols pkgdatadir)
+ message(STATUS "WAYLAND_PROTOCOLS_PATH = ${WAYLAND_PROTOCOLS_PATH}")
set(XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_PATH}/stable/xdg-shell/xdg-shell.xml)
add_custom_command(COMMENT "Generating xdg-shell protocol dispatch data"
OUTPUT xdg-shell-code.c
@@ -113,7 +116,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD")
if(NOT BUILD_WSI_WAYLAND_SUPPORT)
message(FATAL_ERROR "Selected Wayland for vkcube build but not building Wayland support")
endif()
- link_libraries(${WAYLAND_CLIENT_LIBRARIES})
+ link_libraries(PkgConfig::WAYLAND_CLIENT)
set(CUBE_PLATFORM VK_USE_PLATFORM_WAYLAND_KHR)
set(XDG_SHELL_PROTOCOL ${WAYLAND_PROTOCOLS_PATH}/stable/xdg-shell/xdg-shell.xml)
set(OPTIONAL_WAYLAND_DATA_FILES
@@ -264,29 +267,33 @@ endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD")
if(BUILD_WSI_WAYLAND_SUPPORT AND EXISTS ${WAYLAND_PROTOCOLS_PATH}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml)
- link_libraries(${WAYLAND_CLIENT_LIBRARIES})
- set(OPTIONAL_WAYLAND_DATA_FILES
+ add_executable(vkcube-wayland)
+
+ target_sources(vkcube-wayland PRIVATE
+ cube.c
+ ${PROJECT_SOURCE_DIR}/cube/cube.vert
+ ${PROJECT_SOURCE_DIR}/cube/cube.frag
+ cube.vert.inc
+ cube.frag.inc
${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-code.c
${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-client-header.h
${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-code.c
- ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h)
- add_executable(vkcube-wayland
- cube.c
- ${PROJECT_SOURCE_DIR}/cube/cube.vert
- ${PROJECT_SOURCE_DIR}/cube/cube.frag
- cube.vert.inc
- cube.frag.inc
- ${OPTIONAL_WAYLAND_DATA_FILES})
+ ${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-client-header.h
+ )
target_include_directories(vkcube-wayland PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
.
)
- target_link_libraries(vkcube-wayland Vulkan::Headers Vulkan::Loader)
- target_compile_definitions(vkcube-wayland PUBLIC VK_USE_PLATFORM_WAYLAND_KHR)
+ target_link_libraries(vkcube-wayland PRIVATE
+ Vulkan::Headers
+ Vulkan::Loader
+ PkgConfig::WAYLAND_CLIENT
+ )
+ target_compile_definitions(vkcube-wayland PRIVATE VK_USE_PLATFORM_WAYLAND_KHR)
include(CheckLibraryExists)
CHECK_LIBRARY_EXISTS("rt" clock_gettime "" NEED_RT)
if (NEED_RT)
- target_link_libraries(vkcube-wayland rt)
+ target_link_libraries(vkcube-wayland PRIVATE rt)
endif()
install(TARGETS vkcube-wayland)
diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt
index c42afb01..8ffed4e2 100644
--- a/icd/CMakeLists.txt
+++ b/icd/CMakeLists.txt
@@ -57,9 +57,6 @@ target_include_directories(VkICD_mock_icd PRIVATE
${GENERATED}
.
)
-if(BUILD_WSI_WAYLAND_SUPPORT)
- target_include_directories(VkICD_mock_icd PRIVATE ${WAYLAND_CLIENT_INCLUDE_DIR})
-endif()
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
target_compile_options(VkICD_mock_icd PRIVATE
diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt
index 37f6a57b..2fe0fc11 100644
--- a/vulkaninfo/CMakeLists.txt
+++ b/vulkaninfo/CMakeLists.txt
@@ -90,9 +90,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD")
endif()
if(BUILD_WSI_WAYLAND_SUPPORT)
- find_package(Wayland REQUIRED)
- target_include_directories(vulkaninfo PRIVATE ${WAYLAND_CLIENT_INCLUDE_DIR})
- target_link_libraries(vulkaninfo ${WAYLAND_CLIENT_LIBRARIES})
+ pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client)
+ add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR)
+
+ target_link_libraries(vulkaninfo PkgConfig::WAYLAND_CLIENT)
target_compile_definitions(vulkaninfo PRIVATE -DVK_USE_PLATFORM_WAYLAND_KHR -DVK_NO_PROTOTYPES)
endif()