Commit 0ff113d3 authored by Jan Grulich's avatar Jan Grulich
Browse files

Search properly for pipewire and other libs

Summary:
We cannot rely on pkgconfig only so use more advanced search for libs
required by screencast portal

Reviewers: #plasma, cgiboudeaux

Reviewed By: cgiboudeaux

Subscribers: #plasma

Differential Revision: https://phabricator.kde.org/D12147
parent c0129da0
......@@ -8,7 +8,7 @@ set(PROJECT_VERSION_MAJOR 5)
################# set KDE specific information #################
find_package(ECM 1.3.0 REQUIRED NO_MODULE)
find_package(ECM 5.41.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
include(KDEInstallDirs)
......@@ -19,27 +19,38 @@ include(ECMPackageConfigHelpers)
include(ECMOptionalAddSubdirectory)
include(FeatureSummary)
include(FindPkgConfig)
find_package(GLIB2)
set_package_properties(GLIB2 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})
if (${PIPEWIRE_FOUND} AND ${SPA_FOUND} AND ${GLIB2_FOUND} AND ${GBM_FOUND} AND ${EPOXY_FOUND})
set (SCREENCAST_ENABLED true)
else()
set (SCREENCAST_ENABLED false)
......
# - 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 <fredrik@kde.org>
#
......@@ -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)
#.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."
)
#.rst:
# Findpipewire
# -------
#
# Try to find pipewire on a Unix system.
#
# This will define the following variables:
#
# ``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
# ``PipeWire_INCLUDE_DIRS``
# This should be passed to target_include_directories() if the target is not
# used for linking
# ``PipeWire_DEFINITIONS``
# This should be passed to target_compile_options() if the target is not
# used for linking
#
# If ``PipeWire_FOUND`` is TRUE, it will also define the following imported target:
#
# ``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 <alex.merry@kde.org>
# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
# Copyright 2018 Jan Grulich <jgrulich@redhat.com>
#
# 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 copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
#=============================================================================
# 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)
set(PipeWire_DEFINITIONS ${PKG_PipeWire_CFLAGS_OTHER})
set(PipeWire_VERSION ${PKG_PipeWire_VERSION})
find_path(PipeWire_INCLUDE_DIRS
NAMES
pipewire/pipewire.h
HINTS
${PKG_PipeWire_INCLUDE_DIRS}
)
find_library(PipeWire_LIBRARIES
NAMES
pipewire-0.1
HINTS
${PKG_PipeWire_LIBRARIES_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PipeWire
FOUND_VAR
PipeWire_FOUND
REQUIRED_VARS
PipeWire_LIBRARIES
PipeWire_INCLUDE_DIRS
VERSION_VAR
PipeWire_VERSION
)
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(PipeWire PROPERTIES
URL "http://www.pipewire.org"
DESCRIPTION "Pipewire - multimedia processing"
)
#.rst:
# FindSPA
# -------
#
# Try to find spa on a Unix system.
#
# This will define the following variables:
#
# ``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
# ``SPA_INCLUDE_DIRSS``
# This should be passed to target_include_directories() if the target is not
# used for linking
# ``SPA_DEFINITIONS``
# This should be passed to target_compile_options() if the target is not
# used for linking
#
# If ``SPA_FOUND`` is TRUE, it will also define the following imported target:
#
# ``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 <alex.merry@kde.org>
# Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
# Copyright 2018 Jan Grulich <jgrulich@redhat.com>
# 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 copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
#=============================================================================
# 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)
set(SPA_DEFINITIONS ${PKG_SPA_CFLAGS_OTHER})
set(SPA_VERSION ${PKG_SPA_VERSION})
find_path(SPA_INCLUDE_DIRS
NAMES
spa/pod/pod.h
HINTS
${PKG_SPA_INCLUDE_DIRS}
)
find_library(SPA_LIBRARIES
NAMES
spa-lib
HINTS
${PKG_SPA_LIBRARIES_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SPA
FOUND_VAR
SPA_FOUND
REQUIRED_VARS
SPA_LIBRARIES
SPA_INCLUDE_DIRS
VERSION_VAR
SPA_VERSION
)
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(SPA PROPERTIES
DESCRIPTION "Simple Plugin API"
)
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 @@ target_link_libraries(xdg-desktop-portal-kde
if (SCREENCAST_ENABLED)
target_link_libraries(xdg-desktop-portal-kde
${PIPEWIRE_LIBRARIES}
${SPA_LIBRARIES}
${GLIB_LIBRARIES}
${epoxy_LIBRARY}
gbm::gbm)
PipeWire::PipeWire
SPA::SPA
GLIB2::GLIB2
${Epoxy_LIBRARIES}
GBM::GBM)
endif()
install(TARGETS xdg-desktop-portal-kde DESTINATION ${KDE_INSTALL_LIBEXECDIR})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment