From f60bd42e9dd7cd5a7d65a256265b96631b3bc1c7 Mon Sep 17 00:00:00 2001 From: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> Date: Thu, 2 Apr 2020 17:04:10 +0200 Subject: [PATCH] [CMAKE] Portaudio: do not activate OSS on Windows (#477) * [CMAKE] Portaudio: do not activate OSS on Windows I had a strange error when building the local portaudio library with MinGW under msys2. The error was caused by the file sys/soundcard.h that was found somewhere in the path, because use_pa_oss is always activated regardless the platform. So, in my opinion it is better to not activate this option if the platform is Windows. Afterall, it is useless in this case. * [CMAKE] Portaudio: move also remaining OSS code --- cmake-proxies/portaudio-v19/CMakeLists.txt | 75 +++++++++++----------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/cmake-proxies/portaudio-v19/CMakeLists.txt b/cmake-proxies/portaudio-v19/CMakeLists.txt index 591dfcdab..d46ae062d 100644 --- a/cmake-proxies/portaudio-v19/CMakeLists.txt +++ b/cmake-proxies/portaudio-v19/CMakeLists.txt @@ -22,50 +22,53 @@ if( CMAKE_SYSTEM_NAME MATCHES "Windows" ) "Use the portaudio WMME interface if available" YES ) -elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) +else() + # Look for OSS if the user wants it cmd_option( - ${_OPT}use_pa_coreaudio - "Use the portaudio CoreAudio interface if available" - YES - ) -elseif( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" ) - cmd_option( - ${_OPT}use_pa_alsa - "Use the portaudio ALSA interface if available" + ${_OPT}use_pa_oss + "Use the OSS audio interface if available" YES ) - if( ${_OPT}use_pa_alsa ) - find_package( ALSA ) - if( NOT ALSA_FOUND ) - set_cache_value( ${_OPT}use_pa_alsa NO ) + if( ${_OPT}use_pa_oss ) + find_path( OSS_INCLUDE NAMES sys/soundcard.h ) + mark_as_advanced( FORCE OSS_INCLUDE ) + + if( OSS_INCLUDE ) + set( OSS_INCLUDE_DIRS ${OSS_INCLUDE} ) + endif() + + find_library( OSS_LIBRARY NAMES ossaudio ) + mark_as_advanced( FORCE OSS_LIBRARY ) + + if( OSS_LIBRARY ) + set( OSS_LIBRARIES ${OSS_LIBRARY} ) + endif() + + if( NOT OSS_INCLUDE_DIRS ) + set_cache_value( ${_OPT}use_pa_oss NO ) endif() endif() -endif() -# Look for OSS if the user wants it -cmd_option( - ${_OPT}use_pa_oss - "Use the OSS audio interface if available" - YES -) -if( ${_OPT}use_pa_oss ) - find_path( OSS_INCLUDE NAMES sys/soundcard.h ) - mark_as_advanced( FORCE OSS_INCLUDE ) + if( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) + cmd_option( + ${_OPT}use_pa_coreaudio + "Use the portaudio CoreAudio interface if available" + YES + ) + elseif( CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD" ) + cmd_option( + ${_OPT}use_pa_alsa + "Use the portaudio ALSA interface if available" + YES + ) - if( OSS_INCLUDE ) - set( OSS_INCLUDE_DIRS ${OSS_INCLUDE} ) - endif() - - find_library( OSS_LIBRARY NAMES ossaudio ) - mark_as_advanced( FORCE OSS_LIBRARY ) - - if( OSS_LIBRARY ) - set( OSS_LIBRARIES ${OSS_LIBRARY} ) - endif() - - if( NOT OSS_INCLUDE_DIRS ) - set_cache_value( ${_OPT}use_pa_oss NO ) + if( ${_OPT}use_pa_alsa ) + find_package( ALSA ) + if( NOT ALSA_FOUND ) + set_cache_value( ${_OPT}use_pa_alsa NO ) + endif() + endif() endif() endif()