diff options
author | Chris Robinson <[email protected]> | 2014-04-19 06:35:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-04-19 06:35:14 -0700 |
commit | 887763e41c953b91105bba119da7a7265815f5e0 (patch) | |
tree | 8443332ee06bf28e78fe5e34baf66e55b18b42a5 /CMakeLists.txt | |
parent | 1d266aa8347fadfb0db34ae27df7b728c0ab2171 (diff) |
Use find cmake modules for more backends
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 155 |
1 files changed, 76 insertions, 79 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e84cd64..305dcf68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,37 +37,16 @@ ELSE() ENDIF() -OPTION(ALSOFT_BACKEND_OSS "Check for OSS backend" ON) -OPTION(ALSOFT_BACKEND_SOLARIS "Check for Solaris backend" ON) -OPTION(ALSOFT_BACKEND_SNDIO "Check for SndIO backend" ON) -OPTION(ALSOFT_BACKEND_QSA "Check for QSA backend" ON) OPTION(ALSOFT_BACKEND_MMDEVAPI "Check for MMDevApi backend" ON) OPTION(ALSOFT_BACKEND_DSOUND "Check for DirectSound backend" ON) OPTION(ALSOFT_BACKEND_WINMM "Check for Windows Multimedia backend" ON) -OPTION(ALSOFT_BACKEND_PORTAUDIO "Check for PortAudio backend" ON) -OPTION(ALSOFT_BACKEND_PULSEAUDIO "Check for PulseAudio backend" ON) -OPTION(ALSOFT_BACKEND_COREAUDIO "Check for CoreAudio backend" ON) OPTION(ALSOFT_BACKEND_OPENSL "Check for OpenSL backend" ON) -OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON) - -OPTION(ALSOFT_REQUIRE_SSE "Require SSE/SSE2 support" OFF) -OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF) - -OPTION(ALSOFT_REQUIRE_OSS "Require OSS backend" OFF) -OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF) -OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF) -OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF) OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi" OFF) OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF) OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF) -OPTION(ALSOFT_REQUIRE_PORTAUDIO "Require PortAudio backend" OFF) -OPTION(ALSOFT_REQUIRE_PULSEAUDIO "Require PulseAudio backend" OFF) -OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF) OPTION(ALSOFT_REQUIRE_OPENSL "Require OpenSL backend" OFF) -OPTION(ALSOFT_REQUIRE_FLUIDSYNTH "Require FluidSynth MIDI" OFF) - OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON) OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF) @@ -569,6 +548,7 @@ SET(HAVE_SSE 0) SET(HAVE_NEON 0) # Check for SSE support +OPTION(ALSOFT_REQUIRE_SSE "Require SSE/SSE2 support" OFF) CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE_SWITCH}") IF(HAVE_XMMINTRIN_H) OPTION(ALSOFT_CPUEXT_SSE "Enable SSE/SSE2 support" ON) @@ -587,6 +567,7 @@ IF(ALSOFT_REQUIRE_SSE AND NOT HAVE_SSE) ENDIF() # Check for ARM Neon support +OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF) CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H) IF(HAVE_ARM_NEON_H) OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON) @@ -612,6 +593,7 @@ SET(ALC_OBJS ${ALC_OBJS} SET(HAVE_FLUIDSYNTH 0) # Check for FluidSynth support +OPTION(ALSOFT_REQUIRE_FLUIDSYNTH "Require FluidSynth MIDI" OFF) FIND_PACKAGE(FluidSynth) IF(FLUIDSYNTH_FOUND) OPTION(ALSOFT_MIDI_FLUIDSYNTH "Enable FluidSynth MIDI" ON) @@ -673,10 +655,14 @@ IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA) ENDIF() # Check OSS backend -IF(ALSOFT_BACKEND_OSS) - CHECK_INCLUDE_FILE(sys/soundcard.h HAVE_SYS_SOUNDCARD_H) - IF(HAVE_SYS_SOUNDCARD_H) +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_SOURCE_FILES_PROPERTIES(Alc/backends/oss.c PROPERTIES + INCLUDE_DIRECTORIES "${OSS_INCLUDE_DIRS}") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c) SET(BACKENDS "${BACKENDS} OSS,") ENDIF() @@ -686,10 +672,14 @@ IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS) ENDIF() # Check Solaris backend -IF(ALSOFT_BACKEND_SOLARIS) - CHECK_INCLUDE_FILE(sys/audioio.h HAVE_SYS_AUDIOIO_H) - IF(HAVE_SYS_AUDIOIO_H) +OPTION(ALSOFT_REQUIRE_SOLARIS "Require Solaris backend" OFF) +FIND_PACKAGE(AudioIO) +IF(AUDIOIO_FOUND) + OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON) + IF(ALSOFT_BACKEND_SOLARIS) SET(HAVE_SOLARIS 1) + SET_SOURCE_FILES_PROPERTIES(Alc/backends/solaris.c PROPERTIES + INCLUDE_DIRECTORIES "${AUDIOIO_INCLUDE_DIRS}") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c) SET(BACKENDS "${BACKENDS} Solaris,") ENDIF() @@ -699,16 +689,17 @@ IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS) ENDIF() # Check SndIO backend -IF(ALSOFT_BACKEND_SNDIO) - CHECK_INCLUDE_FILE(sndio.h HAVE_SNDIO_H) - IF(HAVE_SNDIO_H) - CHECK_SHARED_FUNCTION_EXISTS(sio_open "sndio.h" sndio "" HAVE_LIBSNDIO) - IF(HAVE_LIBSNDIO) - SET(HAVE_SNDIO 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c) - SET(BACKENDS "${BACKENDS} SndIO \(linked\),") - SET(EXTRA_LIBS sndio ${EXTRA_LIBS}) - ENDIF() +OPTION(ALSOFT_REQUIRE_SNDIO "Require SndIO backend" OFF) +FIND_PACKAGE(SoundIO) +IF(SOUNDIO_FOUND) + OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON) + IF(ALSOFT_BACKEND_SNDIO) + SET(HAVE_SNDIO 1) + SET_SOURCE_FILES_PROPERTIES(Alc/backends/sndio.c PROPERTIES + INCLUDE_DIRECTORIES "${SOUNDIO_INCLUDE_DIRS}") + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c) + SET(BACKENDS "${BACKENDS} SndIO \(linked\),") + SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO) @@ -716,16 +707,17 @@ IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO) ENDIF() # Check QSA backend -IF (ALSOFT_BACKEND_QSA AND "${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX") - CHECK_INCLUDE_FILE(sys/asoundlib.h HAVE_SYS_ASOUNDLIB_H) - IF(HAVE_SYS_ASOUNDLIB_H) - CHECK_SHARED_FUNCTION_EXISTS(snd_pcm_open "sys/asoundlib.h" asound "" HAVE_LIBASOUND) - IF(HAVE_LIBASOUND) - SET(HAVE_QSA 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c) - SET(EXTRA_LIBS asound ${EXTRA_LIBS}) - SET(BACKENDS "${BACKENDS} QSA \(linked\),") - ENDIF() +OPTION(ALSOFT_REQUIRE_QSA "Require QSA backend" OFF) +FIND_PACKAGE(QSA) +IF(QSA_FOUND) + OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON) + IF(ALSOFT_BACKEND_QSA) + SET(HAVE_QSA 1) + SET_SOURCE_FILES_PROPERTIES(Alc/backends/qsa.c PROPERTIES + INCLUDE_DIRECTORIES "${QSA_INCLUDE_DIRS}") + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c) + SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS}) + SET(BACKENDS "${BACKENDS} QSA \(linked\),") ENDIF() ENDIF() IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA) @@ -785,19 +777,20 @@ IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM) ENDIF() # Check PortAudio backend -IF(ALSOFT_BACKEND_PORTAUDIO) - CHECK_INCLUDE_FILE(portaudio.h HAVE_PORTAUDIO_H) - IF(HAVE_PORTAUDIO_H) - CHECK_SHARED_FUNCTION_EXISTS(Pa_Initialize "portaudio.h" portaudio "" HAVE_LIBPORTAUDIO) - IF(HAVE_LIBPORTAUDIO OR HAVE_DLFCN_H OR WIN32) - SET(HAVE_PORTAUDIO 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c) - IF(HAVE_DLFCN_H OR WIN32) - SET(BACKENDS "${BACKENDS} PortAudio,") - ELSE() - SET(BACKENDS "${BACKENDS} PortAudio \(linked\),") - SET(EXTRA_LIBS portaudio ${EXTRA_LIBS}) - ENDIF() +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_SOURCE_FILES_PROPERTIES(Alc/backends/portaudio.c PROPERTIES + INCLUDE_DIRECTORIES "${PORTAUDIO_INCLUDE_DIRS}") + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c) + IF(HAVE_DLFCN_H OR WIN32) + SET(BACKENDS "${BACKENDS} PortAudio,") + ELSE() + SET(BACKENDS "${BACKENDS} PortAudio \(linked\),") + SET(EXTRA_LIBS ${PORTAUDIO_LIBRARIES} ${EXTRA_LIBS}) ENDIF() ENDIF() ENDIF() @@ -806,19 +799,20 @@ IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO) ENDIF() # Check PulseAudio backend -IF(ALSOFT_BACKEND_PULSEAUDIO) - CHECK_INCLUDE_FILE(pulse/pulseaudio.h HAVE_PULSE_PULSEAUDIO_H) - IF(HAVE_PULSE_PULSEAUDIO_H) - CHECK_SHARED_FUNCTION_EXISTS(pa_context_new "pulse/pulseaudio.h" pulse "" HAVE_LIBPULSE) - IF(HAVE_LIBPULSE OR HAVE_DLFCN_H OR WIN32) - SET(HAVE_PULSEAUDIO 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c) - IF(HAVE_DLFCN_H OR WIN32) - SET(BACKENDS "${BACKENDS} PulseAudio,") - ELSE() - SET(BACKENDS "${BACKENDS} PulseAudio \(linked\),") - SET(EXTRA_LIBS pulse ${EXTRA_LIBS}) - ENDIF() +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_SOURCE_FILES_PROPERTIES(Alc/backends/pulseaudio.c PROPERTIES + INCLUDE_DIRECTORIES "${PULSEAUDIO_INCLUDE_DIRS}") + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c) + IF(HAVE_DLFCN_H OR WIN32) + SET(BACKENDS "${BACKENDS} PulseAudio,") + ELSE() + SET(BACKENDS "${BACKENDS} PulseAudio \(linked\),") + SET(EXTRA_LIBS ${PULSEAUDIO_LIBRARIES} ${EXTRA_LIBS}) ENDIF() ENDIF() ENDIF() @@ -827,12 +821,14 @@ IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO) ENDIF() # Check CoreAudio backend -IF(ALSOFT_BACKEND_COREAUDIO) - FIND_LIBRARY(COREAUDIO_FRAMEWORK - NAMES CoreAudio - PATHS /System/Library/Frameworks - ) - IF(COREAUDIO_FRAMEWORK) +OPTION(ALSOFT_REQUIRE_COREAUDIO "Require CoreAudio backend" OFF) +FIND_LIBRARY(COREAUDIO_FRAMEWORK + NAMES CoreAudio + PATHS /System/Library/Frameworks +) +IF(COREAUDIO_FRAMEWORK) + OPTION(ALSOFT_BACKEND_COREAUDIO "Check for CoreAudio backend" ON) + IF(ALSOFT_BACKEND_COREAUDIO) SET(HAVE_COREAUDIO 1) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/coreaudio.c) SET(BACKENDS "${BACKENDS} CoreAudio,") @@ -875,6 +871,7 @@ IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL) ENDIF() # Optionally enable the Wave Writer backend +OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON) IF(ALSOFT_BACKEND_WAVE) SET(HAVE_WAVE 1) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wave.c) |