-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3rdparty/portaudio: Updated to latest upstream version. (#11604)
Up-to-date with revision 24c8d575e588d557d28f4011becb753421346860. Resolves issues building with Visual Studio. Enabled PortAudio when building with Visual Studio and clang-cl. docs: Removed note about duplicate GUID symbols in PortAudio when built with MSVC.
- Loading branch information
Showing
47 changed files
with
5,453 additions
and
694 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
cmake_policy(VERSION 3.13) | ||
|
||
project(PortAudioCpp VERSION 19.8 LANGUAGES CXX) | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
|
||
# Todo (multi-generator): Add support for multiple generators like: - {Debug, | ||
# Release} x {Static, Dynamic} x {MT, MD (Windows only)} | ||
|
||
# ############################################################################## | ||
# sources and headers | ||
# ############################################################################## | ||
|
||
set(portaudiocpp-sources | ||
source/portaudiocpp/BlockingStream.cxx | ||
source/portaudiocpp/CFunCallbackStream.cxx | ||
source/portaudiocpp/CallbackInterface.cxx | ||
source/portaudiocpp/CallbackStream.cxx | ||
source/portaudiocpp/CppFunCallbackStream.cxx | ||
source/portaudiocpp/Device.cxx | ||
source/portaudiocpp/DirectionSpecificStreamParameters.cxx | ||
source/portaudiocpp/Exception.cxx | ||
source/portaudiocpp/HostApi.cxx | ||
source/portaudiocpp/InterfaceCallbackStream.cxx | ||
source/portaudiocpp/MemFunCallbackStream.cxx | ||
source/portaudiocpp/Stream.cxx | ||
source/portaudiocpp/StreamParameters.cxx | ||
source/portaudiocpp/System.cxx | ||
source/portaudiocpp/SystemDeviceIterator.cxx | ||
source/portaudiocpp/SystemHostApiIterator.cxx) | ||
|
||
# since we don't GLOBing this variable must be kept up to date otherwise user | ||
# installations are broken. | ||
set(portaudiocpp-header-files | ||
include/portaudiocpp/AutoSystem.hxx | ||
include/portaudiocpp/BlockingStream.hxx | ||
include/portaudiocpp/CFunCallbackStream.hxx | ||
include/portaudiocpp/CallbackInterface.hxx | ||
include/portaudiocpp/CallbackStream.hxx | ||
include/portaudiocpp/CppFunCallbackStream.hxx | ||
include/portaudiocpp/Device.hxx | ||
include/portaudiocpp/DirectionSpecificStreamParameters.hxx | ||
include/portaudiocpp/Exception.hxx | ||
include/portaudiocpp/HostApi.hxx | ||
include/portaudiocpp/InterfaceCallbackStream.hxx | ||
include/portaudiocpp/MemFunCallbackStream.hxx | ||
include/portaudiocpp/PortAudioCpp.hxx | ||
include/portaudiocpp/SampleDataFormat.hxx | ||
include/portaudiocpp/Stream.hxx | ||
include/portaudiocpp/StreamParameters.hxx | ||
include/portaudiocpp/System.hxx | ||
include/portaudiocpp/SystemDeviceIterator.hxx | ||
include/portaudiocpp/SystemHostApiIterator.hxx) | ||
|
||
if(WIN32) | ||
find_package(ASIO MODULE) | ||
if(ASIO_FOUND) | ||
list(APPEND portaudiocpp-sources source/portaudiocpp/AsioDeviceAdapter.cxx) | ||
list(APPEND portaudiocpp-header-files | ||
include/portaudiocpp/AsioDeviceAdapter.hxx) | ||
endif() | ||
endif() | ||
|
||
# ############################################################################## | ||
# portaudiocpp-targets | ||
# ############################################################################## | ||
|
||
add_library(portaudiocpp ${portaudiocpp-sources}) | ||
add_library(PortAudio::portaudiocpp ALIAS portaudiocpp) # For subdirectory build | ||
|
||
find_package(PortAudio MODULE REQUIRED) | ||
|
||
target_link_libraries(portaudiocpp PUBLIC PortAudio::portaudio) | ||
target_include_directories( | ||
portaudiocpp PUBLIC $<INSTALL_INTERFACE:include> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) | ||
set_target_properties(portaudiocpp PROPERTIES SOVERSION 2) | ||
# Todo (modernize): update the code at least to c++14 | ||
# target_compile_features(portaudiocpp PUBLIC cxx_std_14) | ||
|
||
# ## Export ### | ||
include(GNUInstallDirs) | ||
|
||
install( | ||
TARGETS portaudiocpp | ||
EXPORT PortAudioCppTargets | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
INCLUDES | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/portaudiocpp) | ||
|
||
install(FILES ${portaudiocpp-header-files} | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/portaudiocpp) | ||
|
||
install( | ||
EXPORT PortAudioCppTargets | ||
FILE PortAudioCppTargets.cmake | ||
NAMESPACE PortAudio:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PortAudio) | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/PortAudioCppConfig.cmake.in | ||
"${CMAKE_CURRENT_BINARY_DIR}/PortAudioCppConfig.cmake" | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PortAudio) | ||
|
||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/PortAudioCppConfigVersion.cmake" | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PortAudioCppConfig.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/PortAudioCppConfigVersion.cmake" | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/PortAudio) | ||
|
||
#use relative path, since CMAKE can't reconfigure on install with different prefix path | ||
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 RelWithDebInfo | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) |
5 changes: 5 additions & 0 deletions
5
3rdparty/portaudio/bindings/cpp/cmake/PortAudioCppConfig.cmake.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/PortAudioCppTargets.cmake") | ||
|
||
check_required_components(PortAudioCpp) |
81 changes: 81 additions & 0 deletions
81
3rdparty/portaudio/bindings/cpp/cmake/modules/FindASIO.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#[=======================================================================[.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(WARNING "ASIO is only supported on Windows.") | ||
set(ASIO_FOUND OFF) | ||
return() | ||
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() |
39 changes: 39 additions & 0 deletions
39
3rdparty/portaudio/bindings/cpp/cmake/modules/FindPortAudio.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
macro(handle_default) | ||
|
||
endmacro() | ||
|
||
if(TARGET PortAudio::portaudio) | ||
# nothing to do | ||
return() | ||
endif() | ||
# search for portaudio as cmake module | ||
find_package(PortAudio CONFIG QUIET) | ||
if(PortAudio_FOUND) | ||
if(TARGET PortAudio::portaudio) | ||
return() | ||
elseif(TARGET portaudio) | ||
# vcpkg and old portaudio installations do not provide the same targets | ||
add_library(PortAudio::portaudio ALIAS portaudio) | ||
return() | ||
else() | ||
message(FATAL_ERROR "PortAudio_FOUND but not target PortAudio::portaudio") | ||
endif() | ||
endif() | ||
|
||
# search for portaudio via pkg-config | ||
|
||
message(STATUS "portaudio could not be found via cmake, specify PortAudio_DIR.\n Searching for it via pkg-config") | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(portaudio REQUIRED QUIET IMPORTED_TARGET GLOBAL portaudio-2.0) | ||
add_library(PortAudio::portaudio ALIAS PkgConfig::portaudio) | ||
return() | ||
|
||
# include(FindPackageHandleStandardArgs) | ||
# find_package_handle_standard_args(Foo | ||
# FOUND_VAR Foo_FOUND | ||
# REQUIRED_VARS | ||
# Foo_LIBRARY | ||
# Foo_INCLUDE_DIR | ||
# VERSION_VAR Foo_VERSION | ||
# ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
prefix=@PC_PREFIX@ | ||
exec_prefix=${prefix} | ||
libdir=${prefix}/lib | ||
includedir=${prefix}/include | ||
|
||
Name: PortAudioCpp | ||
Description: Portable audio I/O C++ bindings | ||
Version: 12 | ||
Requires: portaudio-2.0 | ||
|
||
Libs: -L${libdir} -lportaudiocpp | ||
Cflags: -I${includedir} |
Oops, something went wrong.