mirror of https://github.com/microsoft/vcpkg.git
71 lines
2.7 KiB
Diff
71 lines
2.7 KiB
Diff
diff --git "a/examples/CMakeLists.txt" "b/examples/CMakeLists.txt"
|
|
|
|
--- "a/examples/CMakeLists.txt"
|
|
+++ "b/examples/CMakeLists.txt"
|
|
@@ -9,28 +9,22 @@ project(LinkExamples)
|
|
#
|
|
|
|
if(WIN32)
|
|
- function(configure_asio asio_sdk_path_OUT)
|
|
- # ASIO-related path/file variables
|
|
- set(asio_download_root "https://download.steinberg.net/sdk_downloads")
|
|
- set(asio_file_name "asiosdk_2.3.3_2019-06-14.zip")
|
|
- set(asio_dir_name "asiosdk_2.3.3_2019-06-14")
|
|
- set(asio_working_dir "${CMAKE_BINARY_DIR}/modules")
|
|
- set(asio_output_path "${asio_working_dir}/${asio_file_name}")
|
|
-
|
|
- message(STATUS "Downloading ASIO SDK")
|
|
- file(DOWNLOAD "${asio_download_root}/${asio_file_name}" ${asio_output_path})
|
|
- file(SHA1 ${asio_output_path} asio_zip_hash)
|
|
- message(" ASIO SDK SHA1: ${asio_zip_hash}")
|
|
-
|
|
- message(" Extracting ASIO SDK")
|
|
- execute_process(COMMAND ${CMAKE_COMMAND} -E tar "xf" ${asio_output_path} --format=zip
|
|
- WORKING_DIRECTORY ${asio_working_dir}
|
|
- INPUT_FILE ${asio_output_path}
|
|
- )
|
|
+ if(LINK_BUILD_ASIO)
|
|
+ function(configure_asio asio_sdk_path_OUT)
|
|
+ # ASIO-related path/file variables
|
|
+ find_package(ASIOSDK)
|
|
+ if(NOT ASIOSDK_FOUND)
|
|
+ message(FATAL_ERROR "Steinberg ASIO audio driver SDK not found")
|
|
+ else()
|
|
+ message(STATUS "Steinberg ASIO audio driver SDK root dir: ${ASIOSDK_ROOT_DIR}")
|
|
+ endif()
|
|
+ set(asio_working_dir "${ASIOSDK_ROOT_DIR}")
|
|
+ set(asio_output_path "${CMAKE_BINARY_DIR}/modules/asiosdk")
|
|
|
|
- # Set the ASIO SDK path for the caller
|
|
- set(${asio_sdk_path_OUT} "${asio_working_dir}/${asio_dir_name}" PARENT_SCOPE)
|
|
- endfunction()
|
|
+ # Set the ASIO SDK path for the caller
|
|
+ set(${asio_sdk_path_OUT} "${asio_working_dir}" PARENT_SCOPE)
|
|
+ endfunction()
|
|
+ endif()
|
|
endif()
|
|
|
|
# _ _ _
|
|
@@ -102,7 +96,20 @@ function(configure_linkhut_audio_sources target)
|
|
-DLINKHUT_AUDIO_PLATFORM_JACK=1
|
|
)
|
|
else()
|
|
- target_link_libraries(${target} asound portaudio)
|
|
+ if(LinkHut)
|
|
+ find_package(ALSA REQUIRED)
|
|
+ find_package(portaudio CONFIG REQUIRED)
|
|
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
+ set(PORTAUDIO_LIB "${portaudio_DIR}/../../debug/lib/libportaudio.a")
|
|
+ else()
|
|
+ set(PORTAUDIO_LIB "${portaudio_DIR}/../../lib/libportaudio.a")
|
|
+ endif()
|
|
+ # PortAudio built with JACK support needs JACK library
|
|
+ find_library(JACK_LIB NAMES jack)
|
|
+ if(JACK_LIB)
|
|
+ target_link_libraries(${target} ALSA::ALSA ${PORTAUDIO_LIB} ${JACK_LIB})
|
|
+ endif()
|
|
+ endif()
|
|
target_compile_definitions(${target} PRIVATE
|
|
-DLINKHUT_AUDIO_PLATFORM_PORTAUDIO=1
|
|
)
|
|
|