| 1 |
add_library(audiocommon |
| 2 |
AudioCommon.cpp |
| 3 |
AudioCommon.h |
| 4 |
CubebStream.h |
| 5 |
Enums.h |
| 6 |
Mixer.cpp |
| 7 |
Mixer.h |
| 8 |
SurroundDecoder.cpp |
| 9 |
SurroundDecoder.h |
| 10 |
NullSoundStream.cpp |
| 11 |
NullSoundStream.h |
| 12 |
WaveFile.cpp |
| 13 |
WaveFile.h |
| 14 |
) |
| 15 |
|
| 16 |
if(ENABLE_CUBEB) |
| 17 |
message(STATUS "Cubeb found, enabling Cubeb sound backend") |
| 18 |
target_sources(audiocommon PRIVATE |
| 19 |
CubebStream.cpp |
| 20 |
CubebUtils.cpp |
| 21 |
CubebUtils.h |
| 22 |
) |
| 23 |
target_link_libraries(audiocommon PRIVATE cubeb) |
| 24 |
endif() |
| 25 |
|
| 26 |
if(ANDROID) |
| 27 |
find_package(OpenSLES) |
| 28 |
if(OPENSLES_FOUND) |
| 29 |
message(STATUS "OpenSLES found, enabling OpenSLES sound backend") |
| 30 |
target_sources(audiocommon PRIVATE |
| 31 |
OpenSLESStream.cpp |
| 32 |
OpenSLESStream.h |
| 33 |
) |
| 34 |
target_link_libraries(audiocommon PRIVATE OpenSLES::OpenSLES) |
| 35 |
target_compile_definitions(audiocommon PRIVATE HAVE_OPENSL_ES=1) |
| 36 |
endif() |
| 37 |
endif() |
| 38 |
|
| 39 |
if(ENABLE_ALSA) |
| 40 |
find_package(ALSA) |
| 41 |
if(ALSA_FOUND) |
| 42 |
message(STATUS "ALSA found, enabling ALSA sound backend") |
| 43 |
target_sources(audiocommon PRIVATE |
| 44 |
AlsaSoundStream.cpp |
| 45 |
AlsaSoundStream.h |
| 46 |
) |
| 47 |
target_link_libraries(audiocommon PRIVATE ALSA::ALSA) |
| 48 |
target_compile_definitions(audiocommon PRIVATE HAVE_ALSA=1) |
| 49 |
else() |
| 50 |
message(STATUS "ALSA NOT found, disabling ALSA sound backend") |
| 51 |
endif() |
| 52 |
else() |
| 53 |
message(STATUS "ALSA explicitly disabled, disabling ALSA sound backend") |
| 54 |
endif() |
| 55 |
|
| 56 |
if(ENABLE_PULSEAUDIO) |
| 57 |
# PulseAudio ships with a PulseAudioConfig.cmake with no imported target |
| 58 |
# So we use our own FindPulseAudio instead with "MODULE" |
| 59 |
find_package(PulseAudio MODULE QUIET) |
| 60 |
if(PulseAudio_FOUND) |
| 61 |
message(STATUS "PulseAudio found, enabling PulseAudio sound backend") |
| 62 |
target_sources(audiocommon PRIVATE |
| 63 |
PulseAudioStream.cpp |
| 64 |
PulseAudioStream.h |
| 65 |
) |
| 66 |
target_link_libraries(audiocommon PRIVATE PulseAudio::PulseAudio) |
| 67 |
target_compile_definitions(audiocommon PRIVATE HAVE_PULSEAUDIO=1) |
| 68 |
else() |
| 69 |
message(STATUS "PulseAudio NOT found, disabling PulseAudio sound backend") |
| 70 |
endif() |
| 71 |
else() |
| 72 |
message(STATUS "PulseAudio explicitly disabled, disabling PulseAudio sound backend") |
| 73 |
endif() |
| 74 |
|
| 75 |
if(WIN32) |
| 76 |
target_sources(audiocommon PRIVATE |
| 77 |
# Dolphin loads openal32.dll at runtime |
| 78 |
OpenALStream.cpp |
| 79 |
OpenALStream.h |
| 80 |
|
| 81 |
WASAPIStream.cpp |
| 82 |
WASAPIStream.h |
| 83 |
) |
| 84 |
endif() |
| 85 |
|
| 86 |
target_link_libraries(audiocommon |
| 87 |
PUBLIC |
| 88 |
common |
| 89 |
|
| 90 |
PRIVATE |
| 91 |
FreeSurround) |
| 92 |
|
| 93 |
if(ENABLE_CUBEB) |
| 94 |
target_link_libraries(audiocommon PRIVATE cubeb::cubeb) |
| 95 |
endif() |
| 96 |
|
| 97 |
if(MSVC) |
| 98 |
# Add precompiled header |
| 99 |
target_link_libraries(audiocommon PRIVATE use_pch) |
| 100 |
endif() |