diff options
Diffstat (limited to '3rdparty/portaudio/bindings/cpp/cmake')
4 files changed, 137 insertions, 0 deletions
diff --git a/3rdparty/portaudio/bindings/cpp/cmake/PortAudioCppConfig.cmake.in b/3rdparty/portaudio/bindings/cpp/cmake/PortAudioCppConfig.cmake.in new file mode 100644 index 00000000000..37540c0431e --- /dev/null +++ b/3rdparty/portaudio/bindings/cpp/cmake/PortAudioCppConfig.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/PortAudioCppTargets.cmake") + +check_required_components(PortAudioCpp) diff --git a/3rdparty/portaudio/bindings/cpp/cmake/modules/FindASIO.cmake b/3rdparty/portaudio/bindings/cpp/cmake/modules/FindASIO.cmake new file mode 100644 index 00000000000..4a8d10d0507 --- /dev/null +++ b/3rdparty/portaudio/bindings/cpp/cmake/modules/FindASIO.cmake @@ -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() diff --git a/3rdparty/portaudio/bindings/cpp/cmake/modules/FindPortAudio.cmake b/3rdparty/portaudio/bindings/cpp/cmake/modules/FindPortAudio.cmake new file mode 100644 index 00000000000..5d58c158bed --- /dev/null +++ b/3rdparty/portaudio/bindings/cpp/cmake/modules/FindPortAudio.cmake @@ -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 +# ) diff --git a/3rdparty/portaudio/bindings/cpp/cmake/portaudiocpp.pc.in b/3rdparty/portaudio/bindings/cpp/cmake/portaudiocpp.pc.in new file mode 100644 index 00000000000..69333b278d5 --- /dev/null +++ b/3rdparty/portaudio/bindings/cpp/cmake/portaudiocpp.pc.in @@ -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} |