Warning, /frameworks/extra-cmake-modules/find-modules/FindPulseAudio.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2008 Matthias Kretz <kretz@kde.org> 0002 # SPDX-FileCopyrightText: 2009 Marcus Hufgard <Marcus.Hufgard@hufgard.de> 0003 # 0004 # SPDX-License-Identifier: BSD-3-Clause 0005 0006 #[=======================================================================[.rst: 0007 FindPulseAudio 0008 -------------- 0009 0010 Try to locate the PulseAudio library. 0011 If found, this will define the following variables: 0012 0013 ``PulseAudio_FOUND`` 0014 True if the system has the PulseAudio library of at least 0015 the minimum version specified by either the version parameter 0016 to find_package() or the variable PulseAudio_MINIMUM_VERSION 0017 ``PulseAudio_INCLUDE_DIRS`` 0018 The PulseAudio include directory 0019 ``PulseAudio_LIBRARIES`` 0020 The PulseAudio libraries for linking 0021 ``PulseAudio_MAINLOOP_LIBRARY`` 0022 The libraries needed to use PulseAudio Mainloop 0023 ``PulseAudio_VERSION`` 0024 The version of PulseAudio that was found 0025 ``PulseAudio_INCLUDE_DIR`` 0026 Deprecated, use ``PulseAudio_INCLUDE_DIRS`` 0027 ``PulseAudio_LIBRARY`` 0028 Deprecated, use ``PulseAudio_LIBRARIES`` 0029 0030 If ``PulseAudio_FOUND`` is TRUE, it will also define the following 0031 imported target: 0032 0033 ``PulseAudio::PulseAudio`` 0034 The PulseAudio library 0035 0036 Since 5.41.0. 0037 #]=======================================================================] 0038 0039 # Support PulseAudio_MINIMUM_VERSION for compatibility: 0040 if(NOT PulseAudio_FIND_VERSION) 0041 set(PulseAudio_FIND_VERSION "${PulseAudio_MINIMUM_VERSION}") 0042 endif() 0043 0044 # the minimum version of PulseAudio we require 0045 if(NOT PulseAudio_FIND_VERSION) 0046 set(PulseAudio_FIND_VERSION "0.9.9") 0047 endif() 0048 0049 find_package(PkgConfig QUIET) 0050 pkg_check_modules(PC_PulseAudio QUIET libpulse>=${PulseAudio_FIND_VERSION}) 0051 pkg_check_modules(PC_PulseAudio_MAINLOOP QUIET libpulse-mainloop-glib) 0052 0053 find_path(PulseAudio_INCLUDE_DIRS pulse/pulseaudio.h 0054 HINTS 0055 ${PC_PulseAudio_INCLUDEDIR} 0056 ${PC_PulseAudio_INCLUDE_DIRS} 0057 ) 0058 0059 find_library(PulseAudio_LIBRARIES NAMES pulse libpulse 0060 HINTS 0061 ${PC_PulseAudio_LIBDIR} 0062 ${PC_PulseAudio_LIBRARY_DIRS} 0063 ) 0064 0065 find_library(PulseAudio_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib 0066 HINTS 0067 ${PC_PulseAudio_LIBDIR} 0068 ${PC_PulseAudio_LIBRARY_DIRS} 0069 ) 0070 0071 # Store the version number in the cache, so we don't have to search every time again: 0072 if (PulseAudio_INCLUDE_DIRS AND NOT PulseAudio_VERSION) 0073 0074 # get PulseAudio's version from its version.h 0075 file(STRINGS "${PulseAudio_INCLUDE_DIRS}/pulse/version.h" pulse_version_h 0076 REGEX ".*pa_get_headers_version\\(\\).*") 0077 string(REGEX REPLACE ".*pa_get_headers_version\\(\\)\ \\(\"([0-9]+\\.[0-9]+\\.[0-9]+)[^\"]*\"\\).*" "\\1" 0078 _PulseAudio_VERSION "${pulse_version_h}") 0079 0080 set(PulseAudio_VERSION "${_PulseAudio_VERSION}" CACHE STRING "Version number of PulseAudio" FORCE) 0081 endif() 0082 0083 # Use the new extended syntax of find_package_handle_standard_args(), which also handles version checking: 0084 include(FindPackageHandleStandardArgs) 0085 find_package_handle_standard_args(PulseAudio REQUIRED_VARS PulseAudio_LIBRARIES PulseAudio_INCLUDE_DIRS 0086 VERSION_VAR PulseAudio_VERSION) 0087 0088 # Deprecated synonyms 0089 set(PULSEAUDIO_INCLUDE_DIR "${PulseAudio_INCLUDE_DIRS}") 0090 set(PULSEAUDIO_LIBRARY "${PulseAudio_LIBRARIES}") 0091 set(PULSEAUDIO_MAINLOOP_LIBRARY "${PulseAudio_MAINLOOP_LIBRARY}") 0092 set(PULSEAUDIO_FOUND "${PulseAudio_FOUND}") 0093 0094 if(PulseAudio_FOUND AND NOT TARGET PulseAudio::PulseAudio) 0095 add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED) 0096 set_target_properties(PulseAudio::PulseAudio PROPERTIES 0097 IMPORTED_LOCATION "${PulseAudio_LIBRARIES}" 0098 INTERFACE_INCLUDE_DIRECTORIES "${PulseAudio_INCLUDE_DIRS}") 0099 endif() 0100 0101 mark_as_advanced(PulseAudio_INCLUDE_DIRS PULSEAUDIO_INCLUDE_DIR 0102 PulseAudio_LIBRARIES PULSEAUDIO_LIBRARY 0103 PulseAudio_MAINLOOP_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY) 0104 0105 include(FeatureSummary) 0106 set_package_properties(PulseAudio PROPERTIES 0107 URL "https://www.freedesktop.org/wiki/Software/PulseAudio" 0108 DESCRIPTION "Sound server, for sound stream routing and mixing")