aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-03-30 02:20:16 -0700
committerChris Robinson <[email protected]>2023-03-30 02:20:16 -0700
commit3e4a2a151860c04fb0ebb971343a6f05e0c3c08a (patch)
treef33dabb7562d40e93f4315471a3a38f3799ad408 /CMakeLists.txt
parentd82d30cce98194a98a3eb32b60b49a1ae57ae5ef (diff)
Don't check for backend packages that aren't wanted
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt394
1 files changed, 192 insertions, 202 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ca29401..03a24828 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,6 +98,7 @@ include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
find_package(PkgConfig)
+find_package(SDL2 QUIET)
option(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
@@ -396,64 +397,54 @@ set(HAVE_SSE4_1 0)
set(HAVE_NEON 0)
# Check for SSE support
+option(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
option(ALSOFT_REQUIRE_SSE "Require SSE support" OFF)
-if(HAVE_XMMINTRIN_H)
- option(ALSOFT_CPUEXT_SSE "Enable SSE support" ON)
- if(ALSOFT_CPUEXT_SSE)
- set(HAVE_SSE 1)
- endif()
+if(ALSOFT_CPUEXT_SSE AND HAVE_XMMINTRIN_H)
+ set(HAVE_SSE 1)
endif()
if(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE)
message(FATAL_ERROR "Failed to enabled required SSE CPU extensions")
endif()
+option(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
option(ALSOFT_REQUIRE_SSE2 "Require SSE2 support" OFF)
-if(HAVE_EMMINTRIN_H)
- option(ALSOFT_CPUEXT_SSE2 "Enable SSE2 support" ON)
- if(HAVE_SSE AND ALSOFT_CPUEXT_SSE2)
- set(HAVE_SSE2 1)
- endif()
+if(ALSOFT_CPUEXT_SSE2 AND HAVE_SSE AND HAVE_EMMINTRIN_H)
+ set(HAVE_SSE2 1)
endif()
if(ALSOFT_REQUIRE_SSE2 AND NOT HAVE_SSE2)
message(FATAL_ERROR "Failed to enable required SSE2 CPU extensions")
endif()
+option(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
option(ALSOFT_REQUIRE_SSE3 "Require SSE3 support" OFF)
-if(HAVE_PMMINTRIN_H)
- option(ALSOFT_CPUEXT_SSE3 "Enable SSE3 support" ON)
- if(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3)
- set(HAVE_SSE3 1)
- endif()
+if(ALSOFT_CPUEXT_SSE3 AND HAVE_SSE2 AND HAVE_PMMINTRIN_H)
+ set(HAVE_SSE3 1)
endif()
if(ALSOFT_REQUIRE_SSE3 AND NOT HAVE_SSE3)
message(FATAL_ERROR "Failed to enable required SSE3 CPU extensions")
endif()
+option(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
option(ALSOFT_REQUIRE_SSE4_1 "Require SSE4.1 support" OFF)
-if(HAVE_SMMINTRIN_H)
- option(ALSOFT_CPUEXT_SSE4_1 "Enable SSE4.1 support" ON)
- if(HAVE_SSE3 AND ALSOFT_CPUEXT_SSE4_1)
- set(HAVE_SSE4_1 1)
- endif()
+if(ALSOFT_CPUEXT_SSE4_1 AND HAVE_SSE3 AND HAVE_SMMINTRIN_H)
+ set(HAVE_SSE4_1 1)
endif()
if(ALSOFT_REQUIRE_SSE4_1 AND NOT HAVE_SSE4_1)
message(FATAL_ERROR "Failed to enable required SSE4.1 CPU extensions")
endif()
# Check for ARM Neon support
+option(ALSOFT_CPUEXT_NEON "Enable ARM NEON support" ON)
option(ALSOFT_REQUIRE_NEON "Require ARM NEON support" OFF)
-if(HAVE_ARM_NEON_H)
- option(ALSOFT_CPUEXT_NEON "Enable ARM NEON support" ON)
- if(ALSOFT_CPUEXT_NEON)
- check_c_source_compiles("#include <arm_neon.h>
- int main()
- {
- int32x4_t ret4 = vdupq_n_s32(0);
- return vgetq_lane_s32(ret4, 0);
- }" HAVE_NEON_INTRINSICS)
- if(HAVE_NEON_INTRINSICS)
- set(HAVE_NEON 1)
- endif()
+if(ALSOFT_CPUEXT_NEON AND HAVE_ARM_NEON_H)
+ check_c_source_compiles("#include <arm_neon.h>
+ int main()
+ {
+ int32x4_t ret4 = vdupq_n_s32(0);
+ return vgetq_lane_s32(ret4, 0);
+ }" HAVE_NEON_INTRINSICS)
+ if(HAVE_NEON_INTRINSICS)
+ set(HAVE_NEON 1)
endif()
endif()
if(ALSOFT_REQUIRE_NEON AND NOT HAVE_NEON)
@@ -698,14 +689,14 @@ set(CORE_OBJS
set(HAVE_RTKIT 0)
if(NOT WIN32)
+ option(ALSOFT_RTKIT "Enable RTKit support" ON)
option(ALSOFT_REQUIRE_RTKIT "Require RTKit/D-Bus support" FALSE)
- find_package(DBus1 QUIET)
- if(NOT DBus1_FOUND AND PkgConfig_FOUND)
- pkg_check_modules(DBUS dbus-1)
- endif()
- if(DBus1_FOUND OR DBUS_FOUND)
- option(ALSOFT_RTKIT "Enable RTKit support" ON)
- if(ALSOFT_RTKIT)
+ if(ALSOFT_RTKIT)
+ find_package(DBus1 QUIET)
+ if(NOT DBus1_FOUND AND PkgConfig_FOUND)
+ pkg_check_modules(DBUS dbus-1)
+ endif()
+ if(DBus1_FOUND OR DBUS_FOUND)
set(HAVE_RTKIT 1)
set(CORE_OBJS ${CORE_OBJS} core/dbus_wrap.cpp core/dbus_wrap.h
core/rtkit.cpp core/rtkit.h)
@@ -894,101 +885,116 @@ set(ALC_OBJS ${ALC_OBJS}
alc/backends/null.h
)
-# Check ALSA backend
-option(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
-find_package(ALSA)
-if(ALSA_FOUND)
- option(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
- if(ALSOFT_BACKEND_ALSA)
- set(HAVE_ALSA 1)
- set(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
- set(ALC_OBJS ${ALC_OBJS} alc/backends/alsa.cpp alc/backends/alsa.h)
- add_backend_libs(${ALSA_LIBRARIES})
- set(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
+# Check PipeWire backend
+option(ALSOFT_BACKEND_PIPEWIRE "Enable PipeWire backend" ON)
+option(ALSOFT_REQUIRE_PIPEWIRE "Require PipeWire backend" OFF)
+if(ALSOFT_BACKEND_PIPEWIRE AND PkgConfig_FOUND)
+ pkg_check_modules(PIPEWIRE libpipewire-0.3>=0.3.23)
+ if(PIPEWIRE_FOUND)
+ set(HAVE_PIPEWIRE 1)
+ set(BACKENDS "${BACKENDS} PipeWire${IS_LINKED},")
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/pipewire.cpp alc/backends/pipewire.h)
+ add_backend_libs(${PIPEWIRE_LIBRARIES})
+ set(INC_PATHS ${INC_PATHS} ${PIPEWIRE_INCLUDE_DIRS})
endif()
endif()
-if(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
- message(FATAL_ERROR "Failed to enabled required ALSA backend")
+if(ALSOFT_REQUIRE_PIPEWIRE AND NOT HAVE_PIPEWIRE)
+ message(FATAL_ERROR "Failed to enabled required PipeWire backend")
endif()
-# Check OSS backend
-option(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
-find_package(OSS)
-if(OSS_FOUND)
- option(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
- if(ALSOFT_BACKEND_OSS)
- set(HAVE_OSS 1)
- set(BACKENDS "${BACKENDS} OSS,")
- set(ALC_OBJS ${ALC_OBJS} alc/backends/oss.cpp alc/backends/oss.h)
- if(OSS_LIBRARIES)
- set(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
- endif()
- set(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
+# Check PulseAudio backend
+option(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
+option(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
+if(ALSOFT_BACKEND_PULSEAUDIO)
+ find_package(PulseAudio)
+ if(PULSEAUDIO_FOUND)
+ set(HAVE_PULSEAUDIO 1)
+ set(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/pulseaudio.cpp alc/backends/pulseaudio.h)
+ add_backend_libs(${PULSEAUDIO_LIBRARY})
+ set(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIR})
endif()
endif()
-if(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
- message(FATAL_ERROR "Failed to enabled required OSS backend")
+if(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
+ message(FATAL_ERROR "Failed to enabled required PulseAudio backend")
endif()
-# Check PipeWire backend
-option(ALSOFT_REQUIRE_PIPEWIRE "Require PipeWire backend" OFF)
-if(PkgConfig_FOUND)
- pkg_check_modules(PIPEWIRE libpipewire-0.3>=0.3.23)
- if(PIPEWIRE_FOUND)
- option(ALSOFT_BACKEND_PIPEWIRE "Enable PipeWire backend" ON)
- if(ALSOFT_BACKEND_PIPEWIRE)
- set(HAVE_PIPEWIRE 1)
- set(BACKENDS "${BACKENDS} PipeWire${IS_LINKED},")
- set(ALC_OBJS ${ALC_OBJS} alc/backends/pipewire.cpp alc/backends/pipewire.h)
- add_backend_libs(${PIPEWIRE_LIBRARIES})
- set(INC_PATHS ${INC_PATHS} ${PIPEWIRE_INCLUDE_DIRS})
+if(NOT WIN32)
+ # Check ALSA backend
+ option(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
+ option(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
+ if(ALSOFT_BACKEND_ALSA)
+ find_package(ALSA)
+ if(ALSA_FOUND)
+ set(HAVE_ALSA 1)
+ set(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/alsa.cpp alc/backends/alsa.h)
+ add_backend_libs(${ALSA_LIBRARIES})
+ set(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS})
endif()
endif()
-endif()
-if(ALSOFT_REQUIRE_PIPEWIRE AND NOT HAVE_PIPEWIRE)
- message(FATAL_ERROR "Failed to enabled required PipeWire backend")
-endif()
-# Check Solaris backend
-option(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
-find_package(AudioIO)
-if(AUDIOIO_FOUND)
+ # Check OSS backend
+ option(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
+ option(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF)
+ if(ALSOFT_BACKEND_OSS)
+ find_package(OSS)
+ if(OSS_FOUND)
+ set(HAVE_OSS 1)
+ set(BACKENDS "${BACKENDS} OSS,")
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/oss.cpp alc/backends/oss.h)
+ if(OSS_LIBRARIES)
+ set(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS})
+ endif()
+ set(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS})
+ endif()
+ endif()
+
+ # Check Solaris backend
option(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
+ option(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF)
if(ALSOFT_BACKEND_SOLARIS)
- set(HAVE_SOLARIS 1)
- set(BACKENDS "${BACKENDS} Solaris,")
- set(ALC_OBJS ${ALC_OBJS} alc/backends/solaris.cpp alc/backends/solaris.h)
- set(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
+ find_package(AudioIO)
+ if(AUDIOIO_FOUND)
+ set(HAVE_SOLARIS 1)
+ set(BACKENDS "${BACKENDS} Solaris,")
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/solaris.cpp alc/backends/solaris.h)
+ set(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS})
+ endif()
endif()
-endif()
-if(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
- message(FATAL_ERROR "Failed to enabled required Solaris backend")
-endif()
-# Check SndIO backend
-option(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
-find_package(SoundIO)
-if(SOUNDIO_FOUND)
+ # Check SndIO backend
option(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
+ option(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF)
if(ALSOFT_BACKEND_SNDIO)
- set(HAVE_SNDIO 1)
- set(BACKENDS "${BACKENDS} SndIO (linked),")
- set(ALC_OBJS ${ALC_OBJS} alc/backends/sndio.cpp alc/backends/sndio.h)
- set(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
- set(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
+ find_package(SoundIO)
+ if(SOUNDIO_FOUND)
+ set(HAVE_SNDIO 1)
+ set(BACKENDS "${BACKENDS} SndIO (linked),")
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/sndio.cpp alc/backends/sndio.h)
+ set(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
+ set(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS})
+ endif()
endif()
endif()
+if(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA)
+ message(FATAL_ERROR "Failed to enabled required ALSA backend")
+endif()
+if(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS)
+ message(FATAL_ERROR "Failed to enabled required OSS backend")
+endif()
+if(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS)
+ message(FATAL_ERROR "Failed to enabled required Solaris backend")
+endif()
if(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO)
message(FATAL_ERROR "Failed to enabled required SndIO backend")
endif()
# Check Windows-only backends
-option(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
-option(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
-option(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
if(WIN32)
# Check MMSystem backend
option(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
+ option(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF)
if(ALSOFT_BACKEND_WINMM)
set(HAVE_WINMM 1)
set(BACKENDS "${BACKENDS} WinMM,")
@@ -1001,15 +1007,16 @@ if(WIN32)
endif()
# Check DSound backend
- check_include_file(dsound.h HAVE_DSOUND_H)
- if(DXSDK_DIR)
- find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h"
- PATHS "${DXSDK_DIR}" PATH_SUFFIXES include
- DOC "The DirectSound include directory")
- endif()
- if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR)
- option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
- if(ALSOFT_BACKEND_DSOUND)
+ option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
+ option(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
+ if(ALSOFT_BACKEND_DSOUND)
+ check_include_file(dsound.h HAVE_DSOUND_H)
+ if(DXSDK_DIR)
+ find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h"
+ PATHS "${DXSDK_DIR}" PATH_SUFFIXES include
+ DOC "The DirectSound include directory")
+ endif()
+ if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR)
set(HAVE_DSOUND 1)
set(BACKENDS "${BACKENDS} DirectSound,")
set(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h)
@@ -1021,10 +1028,11 @@ if(WIN32)
endif()
# Check for WASAPI backend
- check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
- if(HAVE_MMDEVICEAPI_H)
- option(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON)
- if(ALSOFT_BACKEND_WASAPI)
+ option(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON)
+ option(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF)
+ if(ALSOFT_BACKEND_WASAPI)
+ check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
+ if(HAVE_MMDEVICEAPI_H)
set(HAVE_WASAPI 1)
set(BACKENDS "${BACKENDS} WASAPI,")
set(ALC_OBJS ${ALC_OBJS} alc/backends/wasapi.cpp alc/backends/wasapi.h)
@@ -1041,46 +1049,12 @@ if(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI)
message(FATAL_ERROR "Failed to enabled required WASAPI backend")
endif()
-# Check PortAudio backend
-option(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
-find_package(PortAudio)
-if(PORTAUDIO_FOUND)
- option(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
- if(ALSOFT_BACKEND_PORTAUDIO)
- set(HAVE_PORTAUDIO 1)
- set(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
- set(ALC_OBJS ${ALC_OBJS} alc/backends/portaudio.cpp alc/backends/portaudio.h)
- add_backend_libs(${PORTAUDIO_LIBRARIES})
- set(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
- endif()
-endif()
-if(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
- message(FATAL_ERROR "Failed to enabled required PortAudio backend")
-endif()
-
-# Check PulseAudio backend
-option(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF)
-find_package(PulseAudio)
-if(PULSEAUDIO_FOUND)
- option(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
- if(ALSOFT_BACKEND_PULSEAUDIO)
- set(HAVE_PULSEAUDIO 1)
- set(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
- set(ALC_OBJS ${ALC_OBJS} alc/backends/pulseaudio.cpp alc/backends/pulseaudio.h)
- add_backend_libs(${PULSEAUDIO_LIBRARY})
- set(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIR})
- endif()
-endif()
-if(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
- message(FATAL_ERROR "Failed to enabled required PulseAudio backend")
-endif()
-
# Check JACK backend
+option(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
option(ALSOFT_REQUIRE_JACK "Require JACK backend" OFF)
-find_package(JACK)
-if(JACK_FOUND)
- option(ALSOFT_BACKEND_JACK "Enable JACK backend" ON)
- if(ALSOFT_BACKEND_JACK)
+if(ALSOFT_BACKEND_JACK)
+ find_package(JACK)
+ if(JACK_FOUND)
set(HAVE_JACK 1)
set(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
set(ALC_OBJS ${ALC_OBJS} alc/backends/jack.cpp alc/backends/jack.h)
@@ -1093,12 +1067,12 @@ if(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK)
endif()
# Check CoreAudio backend
+option(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
option(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF)
-find_library(COREAUDIO_FRAMEWORK NAMES CoreAudio)
-find_path(AUDIOUNIT_INCLUDE_DIR NAMES AudioUnit/AudioUnit.h)
-if(COREAUDIO_FRAMEWORK AND AUDIOUNIT_INCLUDE_DIR)
- option(ALSOFT_BACKEND_COREAUDIO "Enable CoreAudio backend" ON)
- if(ALSOFT_BACKEND_COREAUDIO)
+if(ALSOFT_BACKEND_COREAUDIO)
+ find_library(COREAUDIO_FRAMEWORK NAMES CoreAudio)
+ find_path(AUDIOUNIT_INCLUDE_DIR NAMES AudioUnit/AudioUnit.h)
+ if(COREAUDIO_FRAMEWORK AND AUDIOUNIT_INCLUDE_DIR)
set(HAVE_COREAUDIO 1)
set(ALC_OBJS ${ALC_OBJS} alc/backends/coreaudio.cpp alc/backends/coreaudio.h)
set(BACKENDS "${BACKENDS} CoreAudio,")
@@ -1127,12 +1101,44 @@ if(ALSOFT_REQUIRE_COREAUDIO AND NOT HAVE_COREAUDIO)
message(FATAL_ERROR "Failed to enabled required CoreAudio backend")
endif()
+# Check for Oboe (Android) backend
+option(ALSOFT_BACKEND_OBOE "Enable Oboe backend" ON)
+option(ALSOFT_REQUIRE_OBOE "Require Oboe backend" OFF)
+if(ALSOFT_BACKEND_OBOE)
+ set(OBOE_TARGET )
+ if(ANDROID)
+ set(OBOE_SOURCE "" CACHE STRING "Source directory for Oboe.")
+ if(OBOE_SOURCE)
+ add_subdirectory(${OBOE_SOURCE} ./oboe)
+ set(OBOE_TARGET oboe)
+ else()
+ find_package(oboe CONFIG)
+ if(NOT TARGET oboe::oboe)
+ find_package(Oboe)
+ endif()
+ if(TARGET oboe::oboe)
+ set(OBOE_TARGET "oboe::oboe")
+ endif()
+ endif()
+ endif()
+
+ if(OBOE_TARGET)
+ set(HAVE_OBOE 1)
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/oboe.cpp alc/backends/oboe.h)
+ set(BACKENDS "${BACKENDS} Oboe,")
+ set(EXTRA_LIBS ${OBOE_TARGET} ${EXTRA_LIBS})
+ endif()
+endif()
+if(ALSOFT_REQUIRE_OBOE AND NOT HAVE_OBOE)
+ message(FATAL_ERROR "Failed to enabled required Oboe backend")
+endif()
+
# Check for OpenSL (Android) backend
+option(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
option(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF)
-find_package(OpenSL)
-if(OPENSL_FOUND)
- option(ALSOFT_BACKEND_OPENSL "Enable OpenSL backend" ON)
- if(ALSOFT_BACKEND_OPENSL)
+if(ALSOFT_BACKEND_OPENSL)
+ find_package(OpenSL)
+ if(OPENSL_FOUND)
set(HAVE_OPENSL 1)
set(ALC_OBJS ${ALC_OBJS} alc/backends/opensl.cpp alc/backends/opensl.h)
set(BACKENDS "${BACKENDS} OpenSL,")
@@ -1143,52 +1149,36 @@ if(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
message(FATAL_ERROR "Failed to enabled required OpenSL backend")
endif()
-# Check for Oboe (Android) backend
-set(OBOE_TARGET )
-if(ANDROID)
- set(OBOE_SOURCE "" CACHE STRING "Source directory for Oboe.")
- if(OBOE_SOURCE)
- add_subdirectory(${OBOE_SOURCE} ./oboe)
- set(OBOE_TARGET oboe)
- else()
- find_package(oboe CONFIG)
- if(NOT TARGET oboe::oboe)
- find_package(Oboe)
- endif()
- if(TARGET oboe::oboe)
- set(OBOE_TARGET "oboe::oboe")
- endif()
- endif()
-endif()
-
-option(ALSOFT_REQUIRE_OBOE "Require Oboe backend" OFF)
-if(OBOE_TARGET)
- option(ALSOFT_BACKEND_OBOE "Enable Oboe backend" ON)
- if(ALSOFT_BACKEND_OBOE)
- set(HAVE_OBOE 1)
- set(ALC_OBJS ${ALC_OBJS} alc/backends/oboe.cpp alc/backends/oboe.h)
- set(BACKENDS "${BACKENDS} Oboe,")
- set(EXTRA_LIBS ${OBOE_TARGET} ${EXTRA_LIBS})
+# Check PortAudio backend
+option(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
+option(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF)
+if(ALSOFT_BACKEND_PORTAUDIO)
+ find_package(PortAudio)
+ if(PORTAUDIO_FOUND)
+ set(HAVE_PORTAUDIO 1)
+ set(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
+ set(ALC_OBJS ${ALC_OBJS} alc/backends/portaudio.cpp alc/backends/portaudio.h)
+ add_backend_libs(${PORTAUDIO_LIBRARIES})
+ set(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS})
endif()
endif()
-if(ALSOFT_REQUIRE_OBOE AND NOT HAVE_OBOE)
- message(FATAL_ERROR "Failed to enabled required Oboe backend")
+if(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO)
+ message(FATAL_ERROR "Failed to enabled required PortAudio backend")
endif()
# Check for SDL2 backend
+# Off by default, since it adds a runtime dependency
+option(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
option(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
-find_package(SDL2 QUIET)
-if(SDL2_FOUND)
- # Off by default, since it adds a runtime dependency
- option(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF)
- if(ALSOFT_BACKEND_SDL2)
+if(ALSOFT_BACKEND_SDL2)
+ if(SDL2_FOUND)
set(HAVE_SDL2 1)
set(ALC_OBJS ${ALC_OBJS} alc/backends/sdl2.cpp alc/backends/sdl2.h)
set(BACKENDS "${BACKENDS} SDL2,")
set(EXTRA_LIBS ${EXTRA_LIBS} SDL2::SDL2)
+ else()
+ message(STATUS "Could NOT find SDL2")
endif()
-else()
- message(STATUS "Could NOT find SDL2")
endif()
if(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND)
message(FATAL_ERROR "Failed to enabled required SDL2 backend")