summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/portaudio/cmake/modules
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/portaudio/cmake/modules')
-rw-r--r--3rdparty/portaudio/cmake/modules/FindASIO.cmake79
-rw-r--r--3rdparty/portaudio/cmake/modules/FindJACK.cmake67
-rw-r--r--3rdparty/portaudio/cmake/modules/FindOSS.cmake57
-rw-r--r--3rdparty/portaudio/cmake/modules/FindPulseAudio.cmake147
-rw-r--r--3rdparty/portaudio/cmake/modules/FindRegex.cmake68
5 files changed, 418 insertions, 0 deletions
diff --git a/3rdparty/portaudio/cmake/modules/FindASIO.cmake b/3rdparty/portaudio/cmake/modules/FindASIO.cmake
new file mode 100644
index 00000000000..d67cf42b929
--- /dev/null
+++ b/3rdparty/portaudio/cmake/modules/FindASIO.cmake
@@ -0,0 +1,79 @@
+#[=======================================================================[.rst:
+FindASIO
+--------
+
+Finds the ASIO SDK by searching for the SDK ZIP in CMAKE_PREFIX_PATH and
+CMAKE_CURRENT_BINARY_DIR. Alternatively, you may manually specify the path of
+the SDK ZIP with the ASIO_SDK_ZIP_PATH variable, which can be used for caching
+in CI scripts.
+
+If the ZIP is found, this module extracts it.
+The ZIP extraction is skipped if the unzipped SDK is found.
+
+This module provides an `ASIO::host` IMPORT library target for building host
+applications which use ASIO drivers. If you want to build an ASIO driver, this
+module may serve as a useful start but you will need to modify it.
+
+#]=======================================================================]
+
+if(NOT WIN32)
+ message(FATAL_ERROR "ASIO is only supported on Windows.")
+endif()
+
+file(GLOB HEADER_FILE
+ "${CMAKE_CURRENT_BINARY_DIR}/asiosdk*/common/asio.h"
+ "${CMAKE_PREFIX_PATH}/asiosdk*/common/asio.h"
+ # The old build systems before PortAudio 19.8 used to look for the ASIO SDK
+ # in the same parent directory as the source code repository. This is no
+ # longer advised or documented but kept for backwards compatibility.
+ "${CMAKE_CURRENT_SOURCE_DIR}/../asiosdk*/common/asio.h"
+)
+if(NOT EXISTS "${HEADER_FILE}")
+ # The file(ARCHIVE_EXTRACT) command was added in CMake 3.18, so if using an
+ # older version of CMake, the user needs to extract it themselves.
+ if(CMAKE_VERSION VERSION_LESS 3.18)
+ message(STATUS "ASIO SDK NOT found. Download the ASIO SDK ZIP from "
+ "https://www.steinberg.net/asiosdk and extract it to "
+ "${CMAKE_PREFIX_PATH} or ${CMAKE_CURRENT_BINARY_DIR}"
+ )
+ return()
+ endif()
+ file(GLOB results
+ "${ASIO_SDK_ZIP_PATH}"
+ "${CMAKE_CURRENT_BINARY_DIR}/asiosdk*.zip"
+ "${CMAKE_PREFIX_PATH}/asiosdk*.zip"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../asiosdk*.zip"
+ )
+ foreach(f ${results})
+ if(EXISTS "${f}")
+ message(STATUS "Extracting ASIO SDK ZIP archive: ${f}")
+ file(ARCHIVE_EXTRACT INPUT "${f}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
+ endif()
+ endforeach()
+ file(GLOB HEADER_FILE "${CMAKE_CURRENT_BINARY_DIR}/asiosdk*/common/asio.h")
+endif()
+
+get_filename_component(HEADER_DIR "${HEADER_FILE}" DIRECTORY)
+get_filename_component(ASIO_ROOT "${HEADER_DIR}" DIRECTORY)
+
+if(ASIO_ROOT)
+ set(ASIO_FOUND TRUE)
+ message(STATUS "Found ASIO SDK: ${ASIO_ROOT}")
+
+ if(ASIO_FOUND AND NOT TARGET ASIO::host)
+ add_library(ASIO::host INTERFACE IMPORTED)
+ target_sources(ASIO::host INTERFACE
+ "${ASIO_ROOT}/common/asio.cpp"
+ "${ASIO_ROOT}/host/asiodrivers.cpp"
+ "${ASIO_ROOT}/host/pc/asiolist.cpp"
+ )
+ target_include_directories(ASIO::host INTERFACE
+ "${ASIO_ROOT}/common"
+ "${ASIO_ROOT}/host"
+ "${ASIO_ROOT}/host/pc"
+ )
+ target_link_libraries(ASIO::host INTERFACE ole32 uuid)
+ endif()
+else()
+ message(STATUS "ASIO SDK NOT found")
+endif()
diff --git a/3rdparty/portaudio/cmake/modules/FindJACK.cmake b/3rdparty/portaudio/cmake/modules/FindJACK.cmake
new file mode 100644
index 00000000000..5bf8e4272ff
--- /dev/null
+++ b/3rdparty/portaudio/cmake/modules/FindJACK.cmake
@@ -0,0 +1,67 @@
+#[=======================================================================[.rst:
+FindJACK
+--------
+
+Finds the JACK Audio Connection Kit library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``JACK::jack``
+ The JACK library
+
+#]=======================================================================]
+
+# Prefer finding the libraries from pkgconfig rather than find_library. This is
+# required to build with PipeWire's reimplementation of the JACK library.
+#
+# This also enables using PortAudio with the jack2 port in vcpkg. That only
+# builds JackWeakAPI (not the JACK server) which dynamically loads the real
+# JACK library and forwards API calls to it. JackWeakAPI requires linking `dl`
+# in addition to jack, as specified in the pkgconfig file in vcpkg.
+find_package(PkgConfig QUIET)
+if(PkgConfig_FOUND)
+ pkg_check_modules(JACK jack)
+else()
+ find_library(JACK_LINK_LIBRARIES
+ NAMES jack
+ DOC "JACK library"
+ )
+ find_path(JACK_INCLUDEDIR
+ NAMES jack/jack.h
+ DOC "JACK header"
+ )
+endif()
+
+find_package(Regex)
+list(APPEND JACK_LINK_LIBRARIES Regex::regex)
+
+if(NOT CMAKE_USE_PTHREADS_INIT)
+ # This CMake find module is provided by the pthreads port in vcpkg.
+ find_package(pthreads)
+ list(APPEND JACK_LINK_LIBRARIES PThreads4W::PThreads4W)
+endif()
+
+if(CMAKE_USE_PTHREADS_INIT OR TARGET PThreads4W::PThreads4W)
+ set(PTHREADS_AVAILABLE TRUE)
+else()
+ set(PTHREADS_AVAILABLE FALSE)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ JACK
+ DEFAULT_MSG
+ JACK_LINK_LIBRARIES
+ JACK_INCLUDEDIR
+ PTHREADS_AVAILABLE
+ Regex_FOUND
+)
+
+if(JACK_FOUND AND NOT TARGET JACK::jack)
+ add_library(JACK::jack INTERFACE IMPORTED)
+ target_link_libraries(JACK::jack INTERFACE "${JACK_LINK_LIBRARIES}" Regex::regex)
+ target_include_directories(JACK::jack INTERFACE "${JACK_INCLUDEDIR}")
+endif()
diff --git a/3rdparty/portaudio/cmake/modules/FindOSS.cmake b/3rdparty/portaudio/cmake/modules/FindOSS.cmake
new file mode 100644
index 00000000000..eec7dc33789
--- /dev/null
+++ b/3rdparty/portaudio/cmake/modules/FindOSS.cmake
@@ -0,0 +1,57 @@
+#[=======================================================================[.rst:
+FindOSS
+--------
+
+Finds the Open Sound System include directory. There is no library to link.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``OSS::oss``
+ Target for the OSS header include directory. One of the following
+ compile definitions is added to the target:
+ HAVE_SYS_SOUNDCARD_H if the header is sys/soundcard.h
+ HAVE_LINUX_SOUNDCARD_H if the header is linux/soundcard.h
+ HAVE_MACHINE_SOUNDCARD_H if the header is machine/soundcard.h
+
+#]=======================================================================]
+
+find_path(OSS_INCLUDE_DIR
+ NAMES sys/soundcard.h
+ DOC "OSS include directory")
+if(OSS_INCLUDE_DIR)
+ set(OSS_DEFINITIONS HAVE_SYS_SOUNDCARD_H)
+else()
+ find_path(OSS_INCLUDE_DIR
+ NAMES linux/soundcard.h
+ DOC "OSS include directory")
+ if(OSS_INCLUDE_DIR)
+ set(OSS_DEFINITIONS HAVE_LINUX_SOUNDCARD_H)
+ else()
+ find_path(OSS_INCLUDE_DIR
+ NAMES machine/soundcard.h
+ DOC "OSS include directory")
+ if(OSS_INCLUDE_DIR)
+ set(OSS_DEFINITIONS HAVE_MACHINE_SOUNDCARD_H)
+ endif()
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ OSS
+ DEFAULT_MSG
+ OSS_INCLUDE_DIR
+ OSS_DEFINITIONS
+)
+
+if(OSS_INCLUDE_DIR AND OSS_DEFINITIONS)
+ set(OSS_FOUND TRUE)
+ if(NOT TARGET OSS::oss)
+ add_library(OSS::oss INTERFACE IMPORTED)
+ target_include_directories(OSS::oss INTERFACE "${OSS_INCLUDE_DIR}")
+ target_compile_definitions(OSS::oss INTERFACE "${OSS_DEFINITIONS}")
+ endif()
+endif()
diff --git a/3rdparty/portaudio/cmake/modules/FindPulseAudio.cmake b/3rdparty/portaudio/cmake/modules/FindPulseAudio.cmake
new file mode 100644
index 00000000000..234692c4393
--- /dev/null
+++ b/3rdparty/portaudio/cmake/modules/FindPulseAudio.cmake
@@ -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")
diff --git a/3rdparty/portaudio/cmake/modules/FindRegex.cmake b/3rdparty/portaudio/cmake/modules/FindRegex.cmake
new file mode 100644
index 00000000000..8793de613c7
--- /dev/null
+++ b/3rdparty/portaudio/cmake/modules/FindRegex.cmake
@@ -0,0 +1,68 @@
+#[=======================================================================[.rst:
+FindRegex
+--------
+
+Finds an implementation of POSIX regular expressions. It first checks if the
+standard regex.h POSIX header is available. If not, it looks for the TRE library.
+MinGW does not come with regex.h, so TRE is useful with MinGW.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module provides the following imported targets, if found:
+
+``Regex::regex``
+ The POSIX regular expression implementation
+
+#]=======================================================================]
+
+include(FindPackageHandleStandardArgs)
+include(CheckIncludeFile)
+
+set(CMAKE_REQUIRED_QUIET TRUE)
+check_include_file(regex.h REGEX_H)
+set(CMAKE_REQUIRED_QUIET FALSE)
+
+if(REGEX_H)
+ # No need to add any include directories or link any libraries;
+ # simply provide a dummy target.
+ if(NOT TARGET Regex::regex)
+ add_library(Regex::regex INTERFACE IMPORTED)
+ endif()
+
+ # check_include_file sets the variable to "1" which looks odd in the output
+ # of find_package_handle_standard_args, so show the user what was actually found.
+ set(REGEX_H "POSIX regex.h")
+ find_package_handle_standard_args(
+ Regex
+ DEFAULT_MSG
+ REGEX_H
+ )
+else()
+ # MinGW does not include regex.h but this can be supplied by the TRE library.
+ find_path(TRE_REGEX_H NAMES tre/regex.h)
+ if(TRE_REGEX_H)
+ # The POSIX #include is simply <regex.h> but the tre regex.h is at <tre/regex.h>,
+ # so add the directory containing tre's headers to the include path.
+ set(TRE_INCLUDE_DIR "${TRE_REGEX_H}/tre")
+ endif()
+ find_library(TRE_LIBRARY NAMES tre)
+ if(TRE_REGEX_H AND TRE_LIBRARY)
+ message(STATUS "Found regex.h from TRE")
+ else()
+ message(STATUS "regex.h POSIX header NOT found and NOT available from TRE")
+ endif()
+
+ if(NOT TARGET Regex::regex)
+ add_library(Regex::regex INTERFACE IMPORTED)
+ target_include_directories(Regex::regex INTERFACE "${TRE_INCLUDE_DIR}")
+ target_link_libraries(Regex::regex INTERFACE "${TRE_LIBRARY}")
+ endif()
+
+ find_package_handle_standard_args(
+ Regex
+ DEFAULT_MSG
+ TRE_INCLUDE_DIR
+ TRE_LIBRARY
+ )
+endif()