# Copyright 2020 Fangjun Kuang (csukuangfj@gmail.com) # See ../LICENSE for clarification regarding multiple authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. function(download_portaudio) if(CMAKE_VERSION VERSION_LESS 3.11) # FetchContent is available since 3.11, # we've copied it to ${CMAKE_SOURCE_DIR}/cmake/Modules # so that it can be used in lower CMake versions. message(STATUS "Use FetchContent provided by sherpa-ncnn") list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) endif() include(FetchContent) set(portaudio_URL "http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz") set(portaudio_HASH "SHA256=47efbf42c77c19a05d22e627d42873e991ec0c1357219c0d74ce6a2948cb2def") if(BUILD_SHARED_LIBS) set(PA_BUILD_SHARED ON CACHE BOOL "" FORCE) set(PA_BUILD_STATIC OFF CACHE BOOL "" FORCE) else() set(PA_BUILD_SHARED OFF CACHE BOOL "" FORCE) set(PA_BUILD_STATIC ON CACHE BOOL "" FORCE) endif() FetchContent_Declare(portaudio URL ${portaudio_URL} URL_HASH ${portaudio_HASH} ) FetchContent_GetProperties(portaudio) if(NOT portaudio_POPULATED) message(STATUS "Downloading portaudio") FetchContent_Populate(portaudio) endif() message(STATUS "portaudio is downloaded to ${portaudio_SOURCE_DIR}") message(STATUS "portaudio's binary dir is ${portaudio_BINARY_DIR}") if(APPLE) set(CMAKE_MACOSX_RPATH ON) # to solve the following warning on macOS endif() add_subdirectory(${portaudio_SOURCE_DIR} ${portaudio_BINARY_DIR} EXCLUDE_FROM_ALL) endfunction() download_portaudio() # Note # See http://portaudio.com/docs/v19-doxydocs/tutorial_start.html # for how to use portaudio