diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,24 +19,35 @@ include(ECMOptionalAddSubdirectory) include(FeatureSummary) -include(FindPkgConfig) +find_package(Glib) +set_package_properties(Glib PROPERTIES + TYPE OPTIONAL + PURPOSE "Required for screencast portal" +) -pkg_check_modules(PIPEWIRE libpipewire-0.1) -pkg_check_modules(SPA libspa-0.1) -pkg_check_modules(GLIB glib-2.0) +find_package(SPA) +set_package_properties(SPA PROPERTIES + TYPE OPTIONAL + PURPOSE "Required for screencast portal" +) + +find_package(PipeWire) +set_package_properties(PipeWire PROPERTIES + TYPE OPTIONAL + PURPOSE "Required for screencast portal" +) -find_package(gbm) -set_package_properties(gbm PROPERTIES DESCRIPTION "GBM - Generic Buffer Management" +find_package(Gbm) +set_package_properties(Gbm PROPERTIES TYPE OPTIONAL - PURPOSE "Required for egl ouput of drm backend." + PURPOSE "Required for screencast portal" ) -find_package(epoxy) -include_directories(${epoxy_INCLUDE_DIRS}) -set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy" +find_package(Epoxy) +set_package_properties(Epoxy PROPERTIES DESCRIPTION "libepoxy" URL "http://github.com/anholt/libepoxy" TYPE OPTIONAL - PURPOSE "OpenGL dispatch library for GBM backend" + PURPOSE "Required for screencast portal" ) if (${PIPEWIRE_FOUND} AND ${SPA_FOUND} AND ${GLIB_FOUND} AND ${GBM_FOUND} AND ${EPOXY_FOUND}) diff --git a/cmake/modules/Findepoxy.cmake b/cmake/modules/FindEpoxy.cmake rename from cmake/modules/Findepoxy.cmake rename to cmake/modules/FindEpoxy.cmake --- a/cmake/modules/Findepoxy.cmake +++ b/cmake/modules/FindEpoxy.cmake @@ -1,11 +1,11 @@ # - Try to find libepoxy # Once done this will define # -# epoxy_FOUND - System has libepoxy -# epoxy_LIBRARY - The libepoxy library -# epoxy_INCLUDE_DIR - The libepoxy include dir -# epoxy_DEFINITIONS - Compiler switches required for using libepoxy -# epoxy_HAS_GLX - Whether GLX support is available +# Epoxy_FOUND - System has libepoxy +# Epoxy_LIBRARIES - The libepoxy library +# Epoxy_INCLUDE_DIRS - The libepoxy include dir +# Epoxy_DEFINITIONS - Compiler switches required for using libepoxy +# Epoxy_HAS_GLX - Whether GLX support is available # Copyright (c) 2014 Fredrik Höglund # @@ -33,24 +33,22 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -if (NOT WIN32) - find_package(PkgConfig) - pkg_check_modules(PKG_epoxy QUIET epoxy) +find_package(PkgConfig) +pkg_check_modules(PKG_Epoxy QUIET epoxy) - set(epoxy_DEFINITIONS ${PKG_epoxy_CFLAGS}) +set(Epoxy_DEFINITIONS ${PKG_Epoxy_CFLAGS}) - find_path(epoxy_INCLUDE_DIR NAMES epoxy/gl.h HINTS ${PKG_epoxy_INCLUDEDIR} ${PKG_epoxy_INCLUDE_DIRS}) - find_library(epoxy_LIBRARY NAMES epoxy HINTS ${PKG_epoxy_LIBDIR} ${PKG_epoxy_LIBRARY_DIRS}) - find_file(epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${epoxy_INCLUDE_DIR}) +find_path(Epoxy_INCLUDE_DIRS NAMES epoxy/gl.h HINTS ${PKG_Epoxy_INCLUDEDIR} ${PKG_Epoxy_INCLUDE_DIRS}) +find_library(Epoxy_LIBRARIES NAMES epoxy HINTS ${PKG_Epoxy_LIBDIR} ${PKG_Epoxy_LIBRARIES_DIRS}) +find_file(Epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${Epoxy_INCLUDE_DIRS}) - if (epoxy_GLX_HEADER STREQUAL "epoxy_GLX_HEADER-NOTFOUND") - set(epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available") - else () - set(epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available") - endif() +if (Epoxy_GLX_HEADER STREQUAL "Epoxy_GLX_HEADER-NOTFOUND") +set(Epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available") +else () +set(Epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available") +endif() - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(epoxy DEFAULT_MSG epoxy_LIBRARY epoxy_INCLUDE_DIR) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Epoxy DEFAULT_MSG Epoxy_LIBRARIES Epoxy_INCLUDE_DIRS) - mark_as_advanced(epoxy_INCLUDE_DIR epoxy_LIBRARY epoxy_HAS_GLX) -endif() +mark_as_advanced(Epoxy_INCLUDE_DIRS Epoxy_LIBRARIES Epoxy_HAS_GLX) diff --git a/cmake/modules/Findgbm.cmake b/cmake/modules/FindGbm.cmake rename from cmake/modules/Findgbm.cmake rename to cmake/modules/FindGbm.cmake --- a/cmake/modules/Findgbm.cmake +++ b/cmake/modules/FindGbm.cmake @@ -1,28 +1,28 @@ #.rst: -# Findgbm +# FindGbm # ------- # # Try to find gbm on a Unix system. # # This will define the following variables: # -# ``gbm_FOUND`` +# ``Gbm_FOUND`` # True if (the requested version of) gbm is available -# ``gbm_VERSION`` +# ``Gbm_VERSION`` # The version of gbm -# ``gbm_LIBRARIES`` -# This can be passed to target_link_libraries() instead of the ``gbm::gbm`` +# ``Gbm_LIBRARIES`` +# This can be passed to target_link_libraries() instead of the ``Gbm::Gbm`` # target -# ``gbm_INCLUDE_DIRS`` +# ``Gbm_INCLUDE_DIRSS`` # This should be passed to target_include_directories() if the target is not # used for linking -# ``gbm_DEFINITIONS`` +# ``Gbm_DEFINITIONS`` # This should be passed to target_compile_options() if the target is not # used for linking # -# If ``gbm_FOUND`` is TRUE, it will also define the following imported target: +# If ``Gbm_FOUND`` is TRUE, it will also define the following imported target: # -# ``gbm::gbm`` +# ``Gbm::Gbm`` # The gbm library # # In general we recommend using the imported target, as it is easier to use. @@ -57,69 +57,51 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= -if(CMAKE_VERSION VERSION_LESS 2.8.12) - message(FATAL_ERROR "CMake 2.8.12 is required by Findgbm.cmake") -endif() -if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) - message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findgbm.cmake") -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_Gbm QUIET gbm) -if(NOT WIN32) - # 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_gbm QUIET gbm) +set(Gbm_DEFINITIONS ${PKG_Gbm_CFLAGS_OTHER}) +set(Gbm_VERSION ${PKG_Gbm_VERSION}) - set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER}) - set(gbm_VERSION ${PKG_gbm_VERSION}) +find_path(Gbm_INCLUDE_DIRS + NAMES + gbm.h + HINTS + ${PKG_Gbm_INCLUDE_DIRS} +) +find_library(Gbm_LIBRARIES + NAMES + gbm + HINTS + ${PKG_Gbm_LIBRARIES_DIRS} +) - find_path(gbm_INCLUDE_DIR - NAMES - gbm.h - HINTS - ${PKG_gbm_INCLUDE_DIRS} - ) - find_library(gbm_LIBRARY - NAMES - gbm - HINTS - ${PKG_gbm_LIBRARY_DIRS} - ) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Gbm + FOUND_VAR + Gbm_FOUND + REQUIRED_VARS + Gbm_LIBRARIES + Gbm_INCLUDE_DIRS + VERSION_VAR + Gbm_VERSION +) - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(gbm - FOUND_VAR - gbm_FOUND - REQUIRED_VARS - gbm_LIBRARY - gbm_INCLUDE_DIR - VERSION_VAR - gbm_VERSION +if(Gbm_FOUND AND NOT TARGET Gbm::Gbm) + add_library(Gbm::Gbm UNKNOWN IMPORTED) + set_target_properties(Gbm::Gbm PROPERTIES + IMPORTED_LOCATION "${Gbm_LIBRARIES}" + INTERFACE_COMPILE_OPTIONS "${Gbm_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Gbm_INCLUDE_DIRS}" ) - - if(gbm_FOUND AND NOT TARGET gbm::gbm) - add_library(gbm::gbm UNKNOWN IMPORTED) - set_target_properties(gbm::gbm PROPERTIES - IMPORTED_LOCATION "${gbm_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}" - ) - endif() - - mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR) - - # compatibility variables - set(gbm_LIBRARIES ${gbm_LIBRARY}) - set(gbm_INCLUDE_DIRS ${gbm_INCLUDE_DIR}) - set(gbm_VERSION_STRING ${gbm_VERSION}) - -else() - message(STATUS "Findgbm.cmake cannot find gbm on Windows systems.") - set(gbm_FOUND FALSE) endif() +mark_as_advanced(Gbm_LIBRARIES Gbm_INCLUDE_DIRS) + include(FeatureSummary) -set_package_properties(gbm PROPERTIES +set_package_properties(Gbm PROPERTIES URL "http://www.mesa3d.org" DESCRIPTION "Mesa gbm library." ) diff --git a/cmake/modules/FindGlib.cmake b/cmake/modules/FindGlib.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/FindGlib.cmake @@ -0,0 +1,122 @@ +# - Try to find Glib and its components (gio, gobject etc) +# Once done, this will define +# +# Glib_FOUND - system has Glib +# Glib_INCLUDE_DIRS - the Glib include directories +# Glib_LIBRARIES - link these to use Glib +# +# Optionally, the COMPONENTS keyword can be passed to find_package() +# and Glib components can be looked for. Currently, the following +# components can be used, and they define the following variables if +# found: +# +# gio: Glib_GIO_LIBRARIES +# gobject: Glib_GObject_LIBRARIES +# gmodule: Glib_GModule_LIBRARIES +# gthread: Glib_GThread_LIBRARIES +# +# Note that the respective _INCLUDE_DIR variables are not set, since +# all headers are in the same directory as Glib_INCLUDE_DIRS. +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS 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 ITS +# 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. + +find_package(PkgConfig) +pkg_check_modules(PC_Glib QUIET glib-2.0) + +find_library(Glib_LIBRARIES + NAMES glib-2.0 + HINTS ${PC_Glib_LIBDIR} + ${PC_Glib_LIBRARY_DIRS} +) + +# Files in glib's main include path may include glibconfig.h, which, +# for some odd reason, is normally in $LIBDIR/glib-2.0/include. +get_filename_component(_Glib_LIBRARY_DIR ${Glib_LIBRARIES} PATH) +find_path(GlibConfig_INCLUDE_DIR + NAMES glibconfig.h + HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_Glib_LIBRARY_DIR} + ${PC_Glib_INCLUDEDIR} ${PC_Glib_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0/include +) + +find_path(Glib_INCLUDE_DIR + NAMES glib.h + HINTS ${PC_Glib_INCLUDEDIR} + ${PC_Glib_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0 +) + +set(Glib_INCLUDE_DIRS ${Glib_INCLUDE_DIR} ${GlibConfig_INCLUDE_DIR}) + +# Version detection +if (EXISTS "${GlibConfig_INCLUDE_DIR}/glibconfig.h") + file(READ "${GlibConfig_INCLUDE_DIR}/glibconfig.h" GlibConfig_H_CONTENTS) + string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GlibConfig_H_CONTENTS}") + set(Glib_VERSION_MAJOR "${CMAKE_MATCH_1}") + string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GlibConfig_H_CONTENTS}") + set(Glib_VERSION_MINOR "${CMAKE_MATCH_1}") + string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GlibConfig_H_CONTENTS}") + set(Glib_VERSION_MICRO "${CMAKE_MATCH_1}") + set(Glib_VERSION "${Glib_VERSION_MAJOR}.${Glib_VERSION_MINOR}.${Glib_VERSION_MICRO}") +endif () + +# Additional Glib components. We only look for libraries, as not all of them +# have corresponding headers and all headers are installed alongside the main +# glib ones. +foreach (_component ${Glib_FIND_COMPONENTS}) + if (${_component} STREQUAL "gio") + find_library(Glib_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_Glib_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} Glib_GIO_LIBRARIES) + elseif (${_component} STREQUAL "gobject") + find_library(Glib_GObject_LIBRARIES NAMES gobject-2.0 HINTS ${_Glib_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} Glib_GObject_LIBRARIES) + elseif (${_component} STREQUAL "gmodule") + find_library(Glib_GModule_LIBRARIES NAMES gmodule-2.0 HINTS ${_Glib_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} Glib_GModule_LIBRARIES) + elseif (${_component} STREQUAL "gthread") + find_library(Glib_GThread_LIBRARIES NAMES gthread-2.0 HINTS ${_Glib_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} Glib_GThread_LIBRARIES) + elseif (${_component} STREQUAL "gio-unix") + # gio-unix is compiled as part of the gio library, but the include paths + # are separate from the shared glib ones. Since this is currently only used + # by WebKitGTK+ we don't go to extraordinary measures beyond pkg-config. + pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0) + endif () +endforeach () + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glib REQUIRED_VARS Glib_INCLUDE_DIRS Glib_LIBRARIES ${ADDITIONAL_REQUIRED_VARS} + VERSION_VAR Glib_VERSION) + +mark_as_advanced( + GlibConfig_INCLUDE_DIR + Glib_GIO_LIBRARIES + Glib_GIO_UNIX_LIBRARIES + Glib_GModule_LIBRARIES + Glib_GObject_LIBRARIES + Glib_GThread_LIBRARIES + Glib_INCLUDE_DIR + Glib_INCLUDE_DIRS + Glib_LIBRARIES +) diff --git a/cmake/modules/Findgbm.cmake b/cmake/modules/FindPipeWire.cmake copy from cmake/modules/Findgbm.cmake copy to cmake/modules/FindPipeWire.cmake --- a/cmake/modules/Findgbm.cmake +++ b/cmake/modules/FindPipeWire.cmake @@ -1,37 +1,38 @@ #.rst: -# Findgbm +# Findpipewire # ------- # -# Try to find gbm on a Unix system. +# Try to find pipewire on a Unix system. # # This will define the following variables: # -# ``gbm_FOUND`` -# True if (the requested version of) gbm is available -# ``gbm_VERSION`` -# The version of gbm -# ``gbm_LIBRARIES`` -# This can be passed to target_link_libraries() instead of the ``gbm::gbm`` +# ``PipeWire_FOUND`` +# True if (the requested version of) PipeWire is available +# ``PipeWire_VERSION`` +# The version of PipeWire +# ``PipeWire_LIBRARIES`` +# This can be passed to target_link_libraries() instead of the ``PipeWire::PipeWire`` # target -# ``gbm_INCLUDE_DIRS`` +# ``PipeWire_INCLUDE_DIRS`` # This should be passed to target_include_directories() if the target is not # used for linking -# ``gbm_DEFINITIONS`` +# ``PipeWire_DEFINITIONS`` # This should be passed to target_compile_options() if the target is not # used for linking # -# If ``gbm_FOUND`` is TRUE, it will also define the following imported target: +# If ``PipeWire_FOUND`` is TRUE, it will also define the following imported target: # -# ``gbm::gbm`` -# The gbm library +# ``PipeWire::PipeWire`` +# The PipeWire library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. #============================================================================= # Copyright 2014 Alex Merry # Copyright 2014 Martin Gräßlin +# Copyright 2018 Jan Grulich # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -57,69 +58,52 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= -if(CMAKE_VERSION VERSION_LESS 2.8.12) - message(FATAL_ERROR "CMake 2.8.12 is required by Findgbm.cmake") -endif() -if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) - message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findgbm.cmake") -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_PipeWire QUIET libpipewire-0.1) -if(NOT WIN32) - # 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_gbm QUIET gbm) +set(PipeWire_DEFINITIONS ${PKG_PipeWire_CFLAGS_OTHER}) +set(PipeWire_VERSION ${PKG_PipeWire_VERSION}) - set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER}) - set(gbm_VERSION ${PKG_gbm_VERSION}) - - find_path(gbm_INCLUDE_DIR - NAMES - gbm.h - HINTS - ${PKG_gbm_INCLUDE_DIRS} - ) - find_library(gbm_LIBRARY - NAMES - gbm - HINTS - ${PKG_gbm_LIBRARY_DIRS} - ) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(gbm - FOUND_VAR - gbm_FOUND - REQUIRED_VARS - gbm_LIBRARY - gbm_INCLUDE_DIR - VERSION_VAR - gbm_VERSION - ) - - if(gbm_FOUND AND NOT TARGET gbm::gbm) - add_library(gbm::gbm UNKNOWN IMPORTED) - set_target_properties(gbm::gbm PROPERTIES - IMPORTED_LOCATION "${gbm_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}" - ) - endif() +find_path(PipeWire_INCLUDE_DIRS + NAMES + pipewire/pipewire.h + HINTS + ${PKG_PipeWire_INCLUDE_DIRS} +) - mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR) +find_library(PipeWire_LIBRARIES + NAMES + pipewire-0.1 + HINTS + ${PKG_PipeWire_LIBRARIES_DIRS} +) - # compatibility variables - set(gbm_LIBRARIES ${gbm_LIBRARY}) - set(gbm_INCLUDE_DIRS ${gbm_INCLUDE_DIR}) - set(gbm_VERSION_STRING ${gbm_VERSION}) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PipeWire + FOUND_VAR + PipeWire_FOUND + REQUIRED_VARS + PipeWire_LIBRARIES + PipeWire_INCLUDE_DIRS + VERSION_VAR + PipeWire_VERSION +) -else() - message(STATUS "Findgbm.cmake cannot find gbm on Windows systems.") - set(gbm_FOUND FALSE) +if(PipeWire_FOUND AND NOT TARGET PipeWire::PipeWire) + add_library(PipeWire::PipeWire UNKNOWN IMPORTED) + set_target_properties(PipeWire::PipeWire PROPERTIES + IMPORTED_LOCATION "${PipeWire_LIBRARIES}" + INTERFACE_COMPILE_OPTIONS "${PipeWire_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${PipeWire_INCLUDE_DIRS}" + ) endif() +mark_as_advanced(PipeWire_LIBRARIES PipeWire_INCLUDE_DIRS) + include(FeatureSummary) -set_package_properties(gbm PROPERTIES - URL "http://www.mesa3d.org" - DESCRIPTION "Mesa gbm library." +set_package_properties(PipeWire PROPERTIES + URL "http://www.pipewire.org" + DESCRIPTION "Pipewire - multimedia processing" ) diff --git a/cmake/modules/Findgbm.cmake b/cmake/modules/FindSPA.cmake rename from cmake/modules/Findgbm.cmake rename to cmake/modules/FindSPA.cmake --- a/cmake/modules/Findgbm.cmake +++ b/cmake/modules/FindSPA.cmake @@ -1,38 +1,39 @@ #.rst: -# Findgbm +# FindSPA # ------- # -# Try to find gbm on a Unix system. +# Try to find spa on a Unix system. # # This will define the following variables: # -# ``gbm_FOUND`` -# True if (the requested version of) gbm is available -# ``gbm_VERSION`` -# The version of gbm -# ``gbm_LIBRARIES`` -# This can be passed to target_link_libraries() instead of the ``gbm::gbm`` +# ``SPA_FOUND`` +# True if (the requested version of) spa is available +# ``SPA_VERSION`` +# The version of spa +# ``SPA_LIBRARIES`` +# This can be passed to target_link_libraries() instead of the ``SPA::SPA`` # target -# ``gbm_INCLUDE_DIRS`` +# ``SPA_INCLUDE_DIRSS`` # This should be passed to target_include_directories() if the target is not # used for linking -# ``gbm_DEFINITIONS`` +# ``SPA_DEFINITIONS`` # This should be passed to target_compile_options() if the target is not # used for linking # -# If ``gbm_FOUND`` is TRUE, it will also define the following imported target: +# If ``SPA_FOUND`` is TRUE, it will also define the following imported target: # -# ``gbm::gbm`` -# The gbm library +# ``SPA::SPA`` +# The spa library # # In general we recommend using the imported target, as it is easier to use. # Bear in mind, however, that if the target is in the link interface of an # exported library, it must be made available by the package config file. #============================================================================= # Copyright 2014 Alex Merry # Copyright 2014 Martin Gräßlin -# +# Copyright 2018 Jan Grulich + # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: @@ -57,69 +58,52 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #============================================================================= -if(CMAKE_VERSION VERSION_LESS 2.8.12) - message(FATAL_ERROR "CMake 2.8.12 is required by Findgbm.cmake") -endif() -if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) - message(AUTHOR_WARNING "Your project should require at least CMake 2.8.12 to use Findgbm.cmake") -endif() -if(NOT WIN32) - # 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_gbm QUIET gbm) - - set(gbm_DEFINITIONS ${PKG_gbm_CFLAGS_OTHER}) - set(gbm_VERSION ${PKG_gbm_VERSION}) - - find_path(gbm_INCLUDE_DIR - NAMES - gbm.h - HINTS - ${PKG_gbm_INCLUDE_DIRS} - ) - find_library(gbm_LIBRARY - NAMES - gbm - HINTS - ${PKG_gbm_LIBRARY_DIRS} - ) +# 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_SPA QUIET libspa-0.1) - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(gbm - FOUND_VAR - gbm_FOUND - REQUIRED_VARS - gbm_LIBRARY - gbm_INCLUDE_DIR - VERSION_VAR - gbm_VERSION - ) +set(SPA_DEFINITIONS ${PKG_SPA_CFLAGS_OTHER}) +set(SPA_VERSION ${PKG_SPA_VERSION}) - if(gbm_FOUND AND NOT TARGET gbm::gbm) - add_library(gbm::gbm UNKNOWN IMPORTED) - set_target_properties(gbm::gbm PROPERTIES - IMPORTED_LOCATION "${gbm_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${gbm_DEFINITIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${gbm_INCLUDE_DIR}" - ) - endif() +find_path(SPA_INCLUDE_DIRS + NAMES + spa/pod/pod.h + HINTS + ${PKG_SPA_INCLUDE_DIRS} +) - mark_as_advanced(gbm_LIBRARY gbm_INCLUDE_DIR) +find_library(SPA_LIBRARIES + NAMES + spa-lib + HINTS + ${PKG_SPA_LIBRARIES_DIRS} +) - # compatibility variables - set(gbm_LIBRARIES ${gbm_LIBRARY}) - set(gbm_INCLUDE_DIRS ${gbm_INCLUDE_DIR}) - set(gbm_VERSION_STRING ${gbm_VERSION}) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SPA + FOUND_VAR + SPA_FOUND + REQUIRED_VARS + SPA_LIBRARIES + SPA_INCLUDE_DIRS + VERSION_VAR + SPA_VERSION +) -else() - message(STATUS "Findgbm.cmake cannot find gbm on Windows systems.") - set(gbm_FOUND FALSE) +if(SPA_FOUND AND NOT TARGET SPA::SPA) + add_library(SPA::SPA UNKNOWN IMPORTED) + set_target_properties(SPA::SPA PROPERTIES + IMPORTED_LOCATION "${SPA_LIBRARIES}" + INTERFACE_COMPILE_OPTIONS "${SPA_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${SPA_INCLUDE_DIRS}" + ) endif() +mark_as_advanced(SPA_LIBRARIES SPA_INCLUDE_DIRS) + include(FeatureSummary) -set_package_properties(gbm PROPERTIES - URL "http://www.mesa3d.org" - DESCRIPTION "Mesa gbm library." +set_package_properties(SPA PROPERTIES + DESCRIPTION "Simple Plugin API" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,10 +1,6 @@ add_definitions(-DTRANSLATION_DOMAIN="xdg-desktop-portal-kde") -include_directories( - ${Qt5PrintSupport_PRIVATE_INCLUDE_DIRS} - ${PIPEWIRE_INCLUDE_DIRS} ${SPA_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} - ${gbm_INCLUDE_DIRS} -) +include_directories(${Qt5PrintSupport_PRIVATE_INCLUDE_DIRS}) set(xdg_desktop_portal_kde_SRCS xdg-desktop-portal-kde.cpp @@ -53,11 +49,11 @@ if (SCREENCAST_ENABLED) target_link_libraries(xdg-desktop-portal-kde - ${PIPEWIRE_LIBRARIES} - ${SPA_LIBRARIES} - ${GLIB_LIBRARIES} - ${epoxy_LIBRARY} - gbm::gbm) + PipeWire::PipeWire + SPA::SPA + ${Glib_LIBRARIES} + ${Epoxy_LIBRARIES} + Gbm::Gbm) endif() install(TARGETS xdg-desktop-portal-kde DESTINATION ${KDE_INSTALL_LIBEXECDIR})