Simplify the cmake backend handling a bit

This commit is contained in:
Chris Robinson 2014-04-22 07:58:25 -07:00
parent d5ac11c87f
commit 84afe4fb40

View File

@ -614,6 +614,16 @@ SET(HAVE_PULSEAUDIO 0)
SET(HAVE_COREAUDIO 0) SET(HAVE_COREAUDIO 0)
SET(HAVE_OPENSL 0) SET(HAVE_OPENSL 0)
SET(HAVE_WAVE 0) SET(HAVE_WAVE 0)
IF(WIN32 OR HAVE_DLFCN_H)
SET(IS_LINKED "")
MACRO(ADD_BACKEND_LIBS _LIBS)
ENDMACRO()
ELSE()
SET(IS_LINKED " (linked)")
MACRO(ADD_BACKEND_LIBS _LIBS)
SET(EXTRA_LIBS ${_LIBS} ${EXTRA_LIBS})
ENDMACRO()
ENDIF()
# Check ALSA backend # Check ALSA backend
OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF) OPTION(ALSOFT_REQUIRE_ALSA "Require ALSA backend" OFF)
@ -622,13 +632,9 @@ IF(ALSA_FOUND)
OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON) OPTION(ALSOFT_BACKEND_ALSA "Enable ALSA backend" ON)
IF(ALSOFT_BACKEND_ALSA) IF(ALSOFT_BACKEND_ALSA)
SET(HAVE_ALSA 1) SET(HAVE_ALSA 1)
SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c)
IF(HAVE_DLFCN_H OR WIN32) ADD_BACKEND_LIBS(${ALSA_LIBRARIES})
SET(BACKENDS "${BACKENDS} ALSA,")
ELSE()
SET(BACKENDS "${BACKENDS} ALSA \(linked\),")
SET(EXTRA_LIBS ${ALSA_LIBRARIES} ${EXTRA_LIBS})
ENDIF()
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS})
ENDIF() ENDIF()
@ -645,8 +651,8 @@ IF(OSS_FOUND)
OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON) OPTION(ALSOFT_BACKEND_OSS "Enable OSS backend" ON)
IF(ALSOFT_BACKEND_OSS) IF(ALSOFT_BACKEND_OSS)
SET(HAVE_OSS 1) SET(HAVE_OSS 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
SET(BACKENDS "${BACKENDS} OSS,") SET(BACKENDS "${BACKENDS} OSS,")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c)
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${OSS_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${OSS_INCLUDE_DIRS})
ENDIF() ENDIF()
@ -663,8 +669,8 @@ IF(AUDIOIO_FOUND)
OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON) OPTION(ALSOFT_BACKEND_SOLARIS "Enable Solaris backend" ON)
IF(ALSOFT_BACKEND_SOLARIS) IF(ALSOFT_BACKEND_SOLARIS)
SET(HAVE_SOLARIS 1) SET(HAVE_SOLARIS 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
SET(BACKENDS "${BACKENDS} Solaris,") SET(BACKENDS "${BACKENDS} Solaris,")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c)
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${AUDIOIO_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${AUDIOIO_INCLUDE_DIRS})
ENDIF() ENDIF()
@ -681,8 +687,8 @@ IF(SOUNDIO_FOUND)
OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON) OPTION(ALSOFT_BACKEND_SNDIO "Enable SndIO backend" ON)
IF(ALSOFT_BACKEND_SNDIO) IF(ALSOFT_BACKEND_SNDIO)
SET(HAVE_SNDIO 1) SET(HAVE_SNDIO 1)
SET(BACKENDS "${BACKENDS} SndIO (linked),")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c)
SET(BACKENDS "${BACKENDS} SndIO \(linked\),")
SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS}) SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS})
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${SOUNDIO_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${SOUNDIO_INCLUDE_DIRS})
@ -700,9 +706,9 @@ IF(QSA_FOUND)
OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON) OPTION(ALSOFT_BACKEND_QSA "Enable QSA backend" ON)
IF(ALSOFT_BACKEND_QSA) IF(ALSOFT_BACKEND_QSA)
SET(HAVE_QSA 1) SET(HAVE_QSA 1)
SET(BACKENDS "${BACKENDS} QSA (linked),")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c)
SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS}) SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS})
SET(BACKENDS "${BACKENDS} QSA \(linked\),")
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${QSA_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${QSA_INCLUDE_DIRS})
ENDIF() ENDIF()
@ -719,13 +725,9 @@ IF(DSOUND_FOUND)
OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON)
IF(ALSOFT_BACKEND_DSOUND) IF(ALSOFT_BACKEND_DSOUND)
SET(HAVE_DSOUND 1) SET(HAVE_DSOUND 1)
SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c)
IF(HAVE_DLFCN_H OR WIN32) ADD_BACKEND_LIBS(${DSOUND_LIBRARIES})
SET(BACKENDS "${BACKENDS} DirectSound,")
ELSE()
SET(BACKENDS "${BACKENDS} DirectSound \(linked\),")
SET(EXTRA_LIBS ${DSOUND_LIBRARIES} ${EXTRA_LIBS})
ENDIF()
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${DSOUND_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${DSOUND_INCLUDE_DIRS})
ENDIF() ENDIF()
@ -743,9 +745,8 @@ IF(HAVE_WINDOWS_H)
OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON) OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON)
IF(ALSOFT_BACKEND_MMDEVAPI) IF(ALSOFT_BACKEND_MMDEVAPI)
SET(HAVE_MMDEVAPI 1) SET(HAVE_MMDEVAPI 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c)
SET(BACKENDS "${BACKENDS} MMDevApi,") SET(BACKENDS "${BACKENDS} MMDevApi,")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c)
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -763,8 +764,8 @@ IF(HAVE_WINDOWS_H)
OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON)
IF(ALSOFT_BACKEND_WINMM) IF(ALSOFT_BACKEND_WINMM)
SET(HAVE_WINMM 1) SET(HAVE_WINMM 1)
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
SET(BACKENDS "${BACKENDS} WinMM,") SET(BACKENDS "${BACKENDS} WinMM,")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/winmm.c)
SET(EXTRA_LIBS winmm ${EXTRA_LIBS}) SET(EXTRA_LIBS winmm ${EXTRA_LIBS})
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -781,13 +782,9 @@ IF(PORTAUDIO_FOUND)
OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON) OPTION(ALSOFT_BACKEND_PORTAUDIO "Enable PortAudio backend" ON)
IF(ALSOFT_BACKEND_PORTAUDIO) IF(ALSOFT_BACKEND_PORTAUDIO)
SET(HAVE_PORTAUDIO 1) SET(HAVE_PORTAUDIO 1)
SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c)
IF(HAVE_DLFCN_H OR WIN32) ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES})
SET(BACKENDS "${BACKENDS} PortAudio,")
ELSE()
SET(BACKENDS "${BACKENDS} PortAudio \(linked\),")
SET(EXTRA_LIBS ${PORTAUDIO_LIBRARIES} ${EXTRA_LIBS})
ENDIF()
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${PORTAUDIO_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${PORTAUDIO_INCLUDE_DIRS})
ENDIF() ENDIF()
@ -804,13 +801,9 @@ IF(PULSEAUDIO_FOUND)
OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON) OPTION(ALSOFT_BACKEND_PULSEAUDIO "Enable PulseAudio backend" ON)
IF(ALSOFT_BACKEND_PULSEAUDIO) IF(ALSOFT_BACKEND_PULSEAUDIO)
SET(HAVE_PULSEAUDIO 1) SET(HAVE_PULSEAUDIO 1)
SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c) SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c)
IF(HAVE_DLFCN_H OR WIN32) ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
SET(BACKENDS "${BACKENDS} PulseAudio,")
ELSE()
SET(BACKENDS "${BACKENDS} PulseAudio \(linked\),")
SET(EXTRA_LIBS ${PULSEAUDIO_LIBRARIES} ${EXTRA_LIBS})
ENDIF()
IF(CMAKE_VERSION VERSION_LESS "2.8.8") IF(CMAKE_VERSION VERSION_LESS "2.8.8")
INCLUDE_DIRECTORIES(${PULSEAUDIO_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${PULSEAUDIO_INCLUDE_DIRS})
ENDIF() ENDIF()