Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squash test #2

Merged
merged 141 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
9b6ceeb
Preparation to start patching - TODOS and directory src/hostapi/Oboe
Jun 7, 2023
aff3b5a
Added src/hostapi/oboe/README.md
Jun 7, 2023
7d2c0c9
Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp
Jun 7, 2023
8ab4dd5
Added PA_USE_OBOE section to CMakeLists.txt
Jun 7, 2023
3aed6fe
Added PA_USE_OBOE section to CMakeLists.txt
Jun 7, 2023
f5a89e1
Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa…
Jun 9, 2023
51b3757
Included build_all_PaOboe.sh, more work needed on CMake
Jun 13, 2023
0e05b66
Included build_all_PaOboe.sh, more work needed on CMake
Jun 13, 2023
ed974aa
Update src/hostapi/oboe/README.md
hopefulGiupplo Jul 14, 2023
e951915
bindings/cpp: CMake: support pkgconfig with RelWithDebInfo (#822)
carlo-bramini Jul 14, 2023
929e2e8
Fix MSVC warning C4018 signed/unsigned mismatch (#821)
dechamps Jul 14, 2023
af46735
Built shared library
Jul 26, 2023
cdbb27e
Polished bits
Jul 27, 2023
7e68ca3
mme: don't restrict the host buffer to 16-bit
dechamps Mar 12, 2023
95a5c4b
Don't use absolute path when linking to macOS frameworks (#829)
daschuer Aug 4, 2023
816e7f5
Fixing old problems
Aug 24, 2023
948cb3d
Added some debug messages
Aug 24, 2023
71e0fcb
added new build script
Aug 24, 2023
e96d724
Added paOboe in the paHostApi array
Aug 25, 2023
194c597
Added paOboe in pa_unix_hostapis.c
Aug 25, 2023
313d759
Working patch
Aug 25, 2023
6ee9836
win: New PaWinUtil_GetOsVersion() function for getting Windows OS ver…
dmitrykos Aug 5, 2023
dd40f71
Ready for other users to compile/build
Aug 28, 2023
5cca69c
Updated oboe/Readme.md
Aug 28, 2023
402fc77
Added sharing mode selection
Aug 28, 2023
5c24f22
Fixed minor issue with sharing mode selection
Aug 28, 2023
75605db
Removed references to KCTI
Aug 28, 2023
a6e4301
Fixed error callback, added performance mode autoselection
Aug 30, 2023
3618f11
Minor change to CMakeLists, added low latency costant in pa_oboe.h
Aug 30, 2023
746b3a1
Deleted Build_PaOboe.sh
Aug 30, 2023
4a2bf79
Ready to push (removed my paths to Oboe directory and Android NDK)
Aug 30, 2023
b5ca5f9
Update README.md
hopefulGiupplo Aug 30, 2023
07b8347
Update README.md
hopefulGiupplo Aug 30, 2023
11abb8f
Merge remote-tracking branch 'destination/PaOboe_Patch' into PaOboe_P…
Aug 30, 2023
16fa52a
Merge remote-tracking branch 'destination/PaOboe_Patch' into PaOboe_P…
Aug 30, 2023
67ead0a
remove all alternative sample conversion code using lrintf in pa_conv…
RossBencina Sep 1, 2023
4370459
updated readme
Sep 19, 2023
4100c06
fixed CMakeLists.txt
Sep 19, 2023
ff72947
fixed FindOboe.cmake
Sep 19, 2023
c6fb364
Preparation to start patching - TODOS and directory src/hostapi/Oboe
Jun 7, 2023
9a7349f
Added src/hostapi/oboe/README.md
Jun 7, 2023
78c202b
Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp
Jun 7, 2023
a879301
Added PA_USE_OBOE section to CMakeLists.txt
Jun 7, 2023
b416121
Added PA_USE_OBOE section to CMakeLists.txt
Jun 7, 2023
9ae5170
Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa…
Jun 9, 2023
7288c90
Included build_all_PaOboe.sh, more work needed on CMake
Jun 13, 2023
24465ed
Included build_all_PaOboe.sh, more work needed on CMake
Jun 13, 2023
63c48b2
Built shared library
Jul 26, 2023
5dab26b
Polished bits
Jul 27, 2023
35589ee
Fixing old problems
Aug 24, 2023
f6b7814
Added some debug messages
Aug 24, 2023
09aa1b8
added new build script
Aug 24, 2023
efb6f1a
Added paOboe in the paHostApi array
Aug 25, 2023
3bf8046
Added paOboe in pa_unix_hostapis.c
Aug 25, 2023
b22fee5
Working patch
Aug 25, 2023
7acde75
Ready for other users to compile/build
Aug 28, 2023
3ae7ac3
Updated oboe/Readme.md
Aug 28, 2023
a018452
Added sharing mode selection
Aug 28, 2023
73d5b56
Fixed minor issue with sharing mode selection
Aug 28, 2023
9bd1c31
Removed references to KCTI
Aug 28, 2023
ac7c1c9
Fixed error callback, added performance mode autoselection
Aug 30, 2023
a7f2859
Minor change to CMakeLists, added low latency costant in pa_oboe.h
Aug 30, 2023
fd67311
Deleted Build_PaOboe.sh
Aug 30, 2023
bbf847a
Ready to push (removed my paths to Oboe directory and Android NDK)
Aug 30, 2023
6a12b65
Update src/hostapi/oboe/README.md
hopefulGiupplo Jul 14, 2023
fd5967c
Update README.md
hopefulGiupplo Aug 30, 2023
aa6bcbb
Update README.md
hopefulGiupplo Aug 30, 2023
4d4d071
updated readme
Sep 19, 2023
bde12ce
fixed CMakeLists.txt
Sep 19, 2023
8b0730f
fixed FindOboe.cmake
Sep 19, 2023
577b04c
Merge remote-tracking branch 'origin/PaOboe_Patch' into PaOboe_Patch
Sep 19, 2023
6e8701f
corrected oboe/Readme.md
Sep 19, 2023
b2adaa5
Updated oboe/Readme.md
Sep 19, 2023
0dce0e9
PulseAudio Portaudio HostAPI (#336)
illuusio Sep 29, 2023
ba3f91f
pulseaudio: Move Pulseaudio include in correct place when using autoc…
illuusio Sep 30, 2023
ab0dbbc
Merge branch 'master' into Rebase
hopefulGiupplo Oct 2, 2023
c253251
added .idea to gitignore
Oct 2, 2023
b6cc2e1
added .idea to gitignore
Oct 2, 2023
2217003
restored workflows directory
Oct 2, 2023
b9e7f41
Minor fixes to FindOboe.cmake
Oct 2, 2023
42a02b4
Enhanced prebuilt libraries compatibility in FindOboe.cmake
Oct 2, 2023
26b11aa
Minor changes to Pa_Oboe/Readme and pa_oboe.cpp
Oct 2, 2023
8265a71
Removed auto latency tuning in favor of simpler impleentation in pa_o…
Oct 2, 2023
e19c30d
Set paFloat32 as default format in pa_oboe.cpp
Oct 2, 2023
4112fcb
Renamed most of the variables according to best coding practices.
Oct 4, 2023
49d8122
Added separate callback class to fix the single-stream issue.
Oct 4, 2023
8035e7e
Modified OboeEngine accordingly
Oct 4, 2023
494600d
Adjusted the code in the rest of pa_oboe.cpp
Oct 4, 2023
f389437
Removed stop and close phases of OboeEngine::restartStream
Oct 4, 2023
e626214
Updated functions' description
Oct 5, 2023
62cfeb6
minor description corrections
Oct 5, 2023
ae5c61c
fixed all compiling errors generated by typos
Oct 5, 2023
9d03a73
Added OboeMediator class in place of OboeCallback, that mediates Port…
Oct 5, 2023
5098235
Fixed allocation problem, working PaOboe implementation
Oct 6, 2023
6c9e455
Fix 'pulseaudioHostApi' use-after-free/null ptr deref in PaPulseAudio…
bear101 Oct 6, 2023
24c8d57
wdmks: declare GUIDs with selectany attribute (#846)
invertego Oct 6, 2023
d8b1b8e
fixed README.md indenting
Oct 9, 2023
72abf68
Removed .idea folder from repo
Oct 9, 2023
912e951
replaced 'g_' with 'paOboe_' in non-static global variables
Oct 9, 2023
48947c0
replaced 'm_' prefix with 'm' prefix
Oct 9, 2023
cc9a83e
fixed OboeEngine::tryStream as requested
Oct 9, 2023
a56e813
PulseAudio Portaudio HostAPI (#336)
illuusio Sep 29, 2023
fb38b7f
pulseaudio: Move Pulseaudio include in correct place when using autoc…
illuusio Sep 30, 2023
7b71a12
restored workflows directory
Oct 2, 2023
34bf282
Minor fixes to FindOboe.cmake
Oct 2, 2023
603bdde
Enhanced prebuilt libraries compatibility in FindOboe.cmake
Oct 2, 2023
1412c1d
Minor changes to Pa_Oboe/Readme and pa_oboe.cpp
Oct 2, 2023
df7f7e9
Removed auto latency tuning in favor of simpler impleentation in pa_o…
Oct 2, 2023
125bc00
Set paFloat32 as default format in pa_oboe.cpp
Oct 2, 2023
ba44469
Renamed most of the variables according to best coding practices.
Oct 4, 2023
8bc554f
Added separate callback class to fix the single-stream issue.
Oct 4, 2023
6723d6d
Modified OboeEngine accordingly
Oct 4, 2023
ae0cef2
Adjusted the code in the rest of pa_oboe.cpp
Oct 4, 2023
9f8e6fc
Removed stop and close phases of OboeEngine::restartStream
Oct 4, 2023
74fa4b5
Updated functions' description
Oct 5, 2023
9304b07
minor description corrections
Oct 5, 2023
26a3497
fixed all compiling errors generated by typos
Oct 5, 2023
881970a
Added OboeMediator class in place of OboeCallback, that mediates Port…
Oct 5, 2023
b3a5422
Fixed allocation problem, working PaOboe implementation
Oct 6, 2023
b78a241
fixed README.md indenting
Oct 9, 2023
ea1a4a4
Removed .idea folder from repo
Oct 9, 2023
25999de
replaced 'g_' with 'paOboe_' in non-static global variables
Oct 9, 2023
f38179d
replaced 'm_' prefix with 'm' prefix
Oct 9, 2023
c212474
fixed OboeEngine::tryStream as requested
Oct 9, 2023
decac0d
Changed names to improve readability, i.e. OboeStream -> PaOboeStream
Oct 9, 2023
079e853
Merge remote-tracking branch 'origin/master'
Oct 9, 2023
be18a06
fixed all compiling errors generated by typos
Oct 5, 2023
1dbfd82
Merge remote-tracking branch 'origin/Rebase' into Rebase
Oct 9, 2023
512ed42
Fixed minor problem with TryStream
Oct 9, 2023
f88819a
fixed long line in FindOboe.cmake
Oct 10, 2023
6f84e76
fixed typos in pa_oboe.cpp
Oct 10, 2023
5ed3d7f
set to verbose some logs
Oct 10, 2023
eae9922
Fixed minor problem with TryStream
Oct 9, 2023
87508d9
fixed long line in FindOboe.cmake
Oct 10, 2023
263427d
fixed typos in pa_oboe.cpp
Oct 10, 2023
a5d2b71
set to verbose some logs
Oct 10, 2023
e03f929
Merge remote-tracking branch 'origin/Rebase' into Rebase
Oct 10, 2023
8a54970
Better handling of format in paOboe, removed junk code from CMakeLists
Oct 10, 2023
097b37d
Improved readability of some variables
Oct 18, 2023
6c1e81c
Removed '#include oboe/Oboe.h' from pa_oboe.h, and modified host api …
Oct 19, 2023
9669f5b
static cast fixes
Oct 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ libtool
portaudio-2.0.pc
autom4te.cache/*

# build_all_PaOboe.sh CMake output folder
build
build_old

# Precompiled Headers
*.gch
*.pch
Expand Down Expand Up @@ -54,5 +58,7 @@ CMakeSettings.json
# VSCode
.vscode*

# idea
.idea*

# Common build directories of users and VSCode
build*
317 changes: 182 additions & 135 deletions CMakeLists.txt

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ PALIB = libportaudio.la
PAINC = include/portaudio.h

PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined \
-export-symbols-regex "(Pa|PaMacCore|PaJack|PaAlsa|PaAsio|PaOSS|PaWasapi|PaWasapiWinrt|PaWinMME)_.*" \
-export-symbols-regex "(Pa|PaMacCore|PaPulseAudio|PaJack|PaAlsa|PaAsio|PaOSS|PaWasapi|PaWasapiWinrt|PaWinMME)_.*" \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)

COMMON_OBJS = \
Expand All @@ -66,7 +66,7 @@ LOOPBACK_OBJS = \
qa/loopback/src/test_audio_analyzer.o \
qa/loopback/src/write_wav.o \
qa/loopback/src/paqa.o

EXAMPLES = \
bin/pa_devs \
bin/pa_fuzz \
Expand All @@ -82,7 +82,7 @@ SELFTESTS = \
bin/paqa_devs \
bin/paqa_errs \
bin/paqa_latency

TESTS = \
bin/patest1 \
bin/patest_buffer \
Expand Down Expand Up @@ -146,6 +146,7 @@ SRC_DIRS = \
src/hostapi/coreaudio \
src/hostapi/dsound \
src/hostapi/jack \
src/hostapi/pulseaudio \
src/hostapi/oss \
src/hostapi/skeleton \
src/hostapi/wasapi \
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Please feel free to join. See http://www.portaudio.com for details.
src/os = os specific (but host api neutral) code
src/hostapi = implementations for different host apis


### Host API Implementations:

src/hostapi/alsa = Advanced Linux Sound Architecture (ALSA)
Expand All @@ -40,7 +39,9 @@ Please feel free to join. See http://www.portaudio.com for details.
src/hostapi/coreaudio = Macintosh Core Audio for OS X
src/hostapi/dsound = Windows Direct Sound
src/hostapi/jack = JACK Audio Connection Kit
src/hostapi/oboe = Oboe Library for Android (see src/hostapi/oboe/README.md)
src/hostapi/oss = Unix Open Sound System (OSS)
src/hostapi/pulseaudio = Sound system for POSIX OSes
src/hostapi/wasapi = Windows Vista WASAPI
src/hostapi/wdmks = Windows WDM Kernel Streaming
src/hostapi/wmme = Windows MultiMedia Extensions (MME)
Expand Down
2 changes: 1 addition & 1 deletion bindings/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,5 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PortAudioCppConfig.cmake"
set(PC_PREFIX "\${pcfiledir}/../..")
configure_file(cmake/portaudiocpp.pc.in "${CMAKE_CURRENT_BINARY_DIR}/portaudiocpp.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/portaudiocpp.pc"
CONFIGURATIONS Release
CONFIGURATIONS Release RelWithDebInfo
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
46 changes: 46 additions & 0 deletions build_all_PaOboe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# Script used to build Portaudio for multiple Android ABIs, useful for its Oboe host API.
#
# Ensure that ANDROID_NDK environment variable is set to your Android NDK location
# e.g. /Library/Android/sdk/ndk-bundle

if [ -z "$ANDROID_NDK" ]; then
echo "Please set ANDROID_NDK to the Android NDK folder"
exit 1
fi

# Build directory
BUILD_DIR=build

CMAKE_ARGS="-H. \
-DBUILD_SHARED_LIBS=true \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_STL=c++_shared \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=."

function build_PaOboe {

ABI=$1
MINIMUM_API_LEVEL=$2
ABI_BUILD_DIR=${BUILD_DIR}/${ABI}

echo "Building Pa_Oboe for ${ABI}"

mkdir -p ${ABI_BUILD_DIR} ${ABI_BUILD_DIR}/${STAGING_DIR}

cmake -B${ABI_BUILD_DIR} \
-DANDROID_ABI=${ABI} \
-DANDROID_PLATFORM=android-${MINIMUM_API_LEVEL}\
${CMAKE_ARGS}

pushd ${ABI_BUILD_DIR}
make -j5
popd
}

#build_PaOboe armeabi-v7a 16
build_PaOboe arm64-v8a 21
#build_PaOboe x86 16
build_PaOboe x86_64 21
74 changes: 74 additions & 0 deletions cmake/modules/FindOboe.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#[=======================================================================[.rst:
Findoboe
--------

Finds the oboe library. OBOE_DIRECTORY has to be set to the path of the directory where
the oboe repository was cloned (see src/hostapi/oboe/README.md for more information).

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported target, if found:

``Oboe::oboe``
The OBOE library

#]=======================================================================]

if(NOT DEFINED OBOE_DIRECTORY)
#Insert the path of the directory where you cloned Oboe, i.e. ${CMAKE_CURRENT_SOURCE_DIR}/../oboe
set(OBOE_DIRECTORY FALSE)
endif()

if(NOT OBOE_DIRECTORY)
message(AUTHOR_WARNING
"If you're trying to use Oboe as a Host API, please specify the directory where you "
"cloned its repository. For further information, please read src/hostapi/oboe/README.md"
)
set(OBOE_FOUND FALSE)
else()
if(NOT DEFINED OBOE_INCLUDE_DIR)
set(OBOE_INCLUDE_DIR ${OBOE_DIRECTORY}/include)
endif()

if(NOT DEFINED OBOE_LIBRARY_DIRS)
set(OBOE_LIBRARY_DIRS ${OBOE_DIRECTORY}/build/${ANDROID_ABI})
endif()
set(OBOE_LIBRARIES ${OBOE_LIBRARY_DIRS}/liboboe.so)

find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(OBOE Oboe)
else()
find_library(OBOE_LIBRARIES
NAMES liboboe.so
HINTS ${OBOE_LIBRARY_DIRS}
DOC "Oboe Library"
)
find_path(OBOE_INCLUDE_DIR
NAMES oboe/Oboe.h
DOC "Oboe header"
)
endif()

find_library(LOG_LIBRARY log) #used by pa_oboe.cpp and pa_oboe.h as a logging tool

set(OBOE_LINK_LIBRARIES ${OBOE_LIBRARIES} ${LOG_LIBRARY})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Oboe
DEFAULT_MSG
OBOE_LINK_LIBRARIES
OBOE_INCLUDE_DIR
)

if(OBOE_INCLUDE_DIR AND OBOE_LINK_LIBRARIES)
set(OBOE_FOUND TRUE)
if(NOT TARGET Oboe::oboe)
add_library(Oboe::oboe INTERFACE IMPORTED GLOBAL)
target_link_libraries(Oboe::oboe INTERFACE "${OBOE_LINK_LIBRARIES}")
target_include_directories(Oboe::oboe INTERFACE "${OBOE_INCLUDE_DIR}")
endif()
endif()
endif()
147 changes: 147 additions & 0 deletions cmake/modules/FindPulseAudio.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Copyright 2008 Matthias Kretz <kretz@kde.org>
# Copyright 2009 Marcus Hufgard <Marcus.Hufgard@hufgard.de>
#
# 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.
#
# 3. Neither the name of the copyright holder nor the names of its
# 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.
#
# SPDX-FileCopyrightText: 2008 Matthias Kretz <kretz@kde.org>
# SPDX-FileCopyrightText: 2009 Marcus Hufgard <Marcus.Hufgard@hufgard.de>
#
# SPDX-License-Identifier: BSD-3-Clause

#.rst:
# FindPulseAudio
# --------------
#
# This is base on
# https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/master/find-modules/FindPulseAudio.cmake
#
# Try to locate the PulseAudio library.
# If found, this will define the following variables:
#
# ``PulseAudio_FOUND``
# True if the system has the PulseAudio library of at least
# the minimum version specified by either the version parameter
# to find_package() or the variable PulseAudio_MINIMUM_VERSION
# ``PulseAudio_INCLUDE_DIRS``
# The PulseAudio include directory
# ``PulseAudio_LIBRARIES``
# The PulseAudio libraries for linking
# ``PulseAudio_MAINLOOP_LIBRARY``
# The libraries needed to use PulseAudio Mainloop
# ``PulseAudio_VERSION``
# The version of PulseAudio that was found
# ``PulseAudio_INCLUDE_DIR``
# Deprecated, use ``PulseAudio_INCLUDE_DIRS``
# ``PulseAudio_LIBRARY``
# Deprecated, use ``PulseAudio_LIBRARIES``
#
# If ``PulseAudio_FOUND`` is TRUE, it will also define the following
# imported target:
#
# ``PulseAudio::PulseAudio``
# The PulseAudio library
#
# Since 5.41.0.

# Support PulseAudio_MINIMUM_VERSION for compatibility:
if(NOT PulseAudio_FIND_VERSION)
set(PulseAudio_FIND_VERSION "${PulseAudio_MINIMUM_VERSION}")
endif()

# the minimum version of PulseAudio we require
if(NOT PulseAudio_FIND_VERSION)
set(PulseAudio_FIND_VERSION "1.0.0")
endif()

find_package(PkgConfig)
pkg_check_modules(PC_PulseAudio QUIET libpulse>=${PulseAudio_FIND_VERSION})
pkg_check_modules(PC_PulseAudio_MAINLOOP QUIET libpulse-mainloop-glib)

find_path(PulseAudio_INCLUDE_DIRS pulse/pulseaudio.h
HINTS
${PC_PulseAudio_INCLUDEDIR}
${PC_PulseAudio_INCLUDE_DIRS}
)

find_library(PulseAudio_LIBRARIES NAMES pulse libpulse
HINTS
${PC_PulseAudio_LIBDIR}
${PC_PulseAudio_LIBRARY_DIRS}
)

find_library(PulseAudio_MAINLOOP_LIBRARY
NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib
HINTS
${PC_PulseAudio_LIBDIR}
${PC_PulseAudio_LIBRARY_DIRS}
)

# Store the version number in the cache,
# so we don't have to search every time again:
if(PulseAudio_INCLUDE_DIRS AND NOT PulseAudio_VERSION)

# get PulseAudio's version from its version.h
file(STRINGS "${PulseAudio_INCLUDE_DIRS}/pulse/version.h" pulse_version_h
REGEX ".*pa_get_headers_version\\(\\).*")
string(REGEX REPLACE ".*pa_get_headers_version\\(\\)\ \\(\"([0-9]+\\.[0-9]+\\.[0-9]+)[^\"]*\"\\).*" "\\1"
_PulseAudio_VERSION "${pulse_version_h}")

set(PulseAudio_VERSION "${_PulseAudio_VERSION}"
CACHE STRING "Version number of PulseAudio"
FORCE)
endif()

# Use the new extended syntax of
# find_package_handle_standard_args(),
# which also handles version checking:
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PulseAudio
REQUIRED_VARS PulseAudio_LIBRARIES
PulseAudio_INCLUDE_DIRS
VERSION_VAR PulseAudio_VERSION)

# Deprecated synonyms
set(PulseAudio_INCLUDE_DIR "${PulseAudio_INCLUDE_DIRS}")
set(PulseAudio_LIBRARY "${PulseAudio_LIBRARIES}")
set(PulseAudio_MAINLOOP_LIBRARY "${PulseAudio_MAINLOOP_LIBRARY}")
set(PulseAudio_FOUND "${PulseAudio_FOUND}")

if(PulseAudio_FOUND AND NOT TARGET PulseAudio::PulseAudio)
add_library(PulseAudio::PulseAudio UNKNOWN IMPORTED)
set_target_properties(PulseAudio::PulseAudio PROPERTIES
IMPORTED_LOCATION "${PulseAudio_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${PulseAudio_INCLUDE_DIRS}")
endif()

mark_as_advanced(PulseAudio_INCLUDE_DIRS PulseAudio_INCLUDE_DIR
PulseAudio_LIBRARIES PulseAudio_LIBRARY
PulseAudio_MAINLOOP_LIBRARY PulseAudio_MAINLOOP_LIBRARY)

include(FeatureSummary)
set_package_properties(PulseAudio PROPERTIES
URL "https://www.freedesktop.org/wiki/Software/PulseAudio"
DESCRIPTION "Sound server, for sound stream routing and mixing")
Loading
Loading