build: add cmake options for optional dependencies

closes #1
This commit is contained in:
Andrew Kelley 2015-08-31 15:51:49 -07:00
parent 0f508fcf19
commit 0b7c9965f9

View file

@ -24,6 +24,12 @@ set(LIBSOUNDIO_VERSION_PATCH 0)
set(LIBSOUNDIO_VERSION "${LIBSOUNDIO_VERSION_MAJOR}.${LIBSOUNDIO_VERSION_MINOR}.${LIBSOUNDIO_VERSION_PATCH}")
message("Configuring libsoundio version ${LIBSOUNDIO_VERSION}")
option(ENABLE_JACK "Enable JACK backend" ON)
option(ENABLE_PULSEAUDIO "Enable PulseAudio backend" ON)
option(ENABLE_ALSA "Enable ALSA backend" ON)
option(ENABLE_COREAUDIO "Enable CoreAudio backend" ON)
option(ENABLE_WASAPI "Enable WASAPI backend" ON)
find_package(Threads)
if(Threads_FOUND)
set(STATUS_THREADS "OK")
@ -31,6 +37,7 @@ else(Threads_FOUND)
set(STATUS_THREADS "not found")
endif(Threads_FOUND)
if(ENABLE_JACK)
find_package(JACK)
if(JACK_FOUND)
set(STATUS_JACK "OK")
@ -41,7 +48,13 @@ else()
set(SOUNDIO_HAVE_JACK false)
set(JACK_LIBRARY "")
endif()
else()
set(STATUS_JACK "disabled")
set(SOUNDIO_HAVE_JACK false)
set(JACK_LIBRARY "")
endif()
if(ENABLE_PULSEAUDIO)
find_package(PulseAudio)
if(PULSEAUDIO_FOUND)
set(STATUS_PULSEAUDIO "OK")
@ -52,7 +65,13 @@ else()
set(SOUNDIO_HAVE_PULSEAUDIO false)
set(PULSEAUDIO_LIBRARY "")
endif()
else()
set(STATUS_PULSEAUDIO "disabled")
set(SOUNDIO_HAVE_PULSEAUDIO false)
set(PULSEAUDIO_LIBRARY "")
endif()
if(ENABLE_ALSA)
find_package(ALSA)
if(ALSA_FOUND)
set(STATUS_ALSA "OK")
@ -63,7 +82,13 @@ else()
set(SOUNDIO_HAVE_ALSA false)
set(ALSA_LIBRARIES "")
endif()
else()
set(STATUS_ALSA "disabled")
set(SOUNDIO_HAVE_ALSA false)
set(ALSA_LIBRARIES "")
endif()
if(ENABLE_COREAUDIO)
find_package(CoreAudio)
if(COREAUDIO_FOUND)
set(STATUS_COREAUDIO "OK")
@ -84,7 +109,15 @@ else()
set(COREFOUNDATION_LIBRARY "")
set(AUDIOUNIT_LIBRARY "")
endif()
else()
set(STATUS_COREAUDIO "disabled")
set(SOUNDIO_HAVE_COREAUDIO false)
set(COREAUDIO_LIBRARY "")
set(COREFOUNDATION_LIBRARY "")
set(AUDIOUNIT_LIBRARY "")
endif()
if(ENABLE_WASAPI)
find_package(WASAPI)
if(WASAPI_FOUND)
set(STATUS_WASAPI "OK")
@ -93,6 +126,10 @@ else()
set(STATUS_WASAPI "not found")
set(SOUNDIO_HAVE_WASAPI false)
endif()
else()
set(STATUS_WASAPI "disabled")
set(SOUNDIO_HAVE_WASAPI false)
endif()
set(LIBSOUNDIO_SOURCES