audio_core: Only include cubeb if it's available

This commit is contained in:
darkf 2018-05-25 00:58:53 -05:00
parent af73dd45f0
commit 35c43aa293
2 changed files with 5 additions and 0 deletions

View file

@ -39,4 +39,5 @@ endif()
if(ENABLE_CUBEB) if(ENABLE_CUBEB)
target_link_libraries(audio_core PRIVATE cubeb) target_link_libraries(audio_core PRIVATE cubeb)
add_definitions(-DHAVE_CUBEB=1)
endif() endif()

View file

@ -11,14 +11,18 @@
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
#include "audio_core/sdl2_sink.h" #include "audio_core/sdl2_sink.h"
#endif #endif
#ifdef HAVE_CUBEB
#include "audio_core/cubeb_sink.h" #include "audio_core/cubeb_sink.h"
#endif
#include "common/logging/log.h" #include "common/logging/log.h"
namespace AudioCore { namespace AudioCore {
// g_sink_details is ordered in terms of desirability, with the best choice at the top. // g_sink_details is ordered in terms of desirability, with the best choice at the top.
const std::vector<SinkDetails> g_sink_details = { const std::vector<SinkDetails> g_sink_details = {
#ifdef HAVE_CUBEB
{"cubeb", []() { return std::make_unique<CubebSink>(); }}, {"cubeb", []() { return std::make_unique<CubebSink>(); }},
#endif
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
{"sdl2", []() { return std::make_unique<SDL2Sink>(); }}, {"sdl2", []() { return std::make_unique<SDL2Sink>(); }},
#endif #endif