diff --git a/CMakeLists.txt b/CMakeLists.txt index f12f63ba6..74aa9b033 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,10 @@ option(USE_DX11 "Build with Direct3D 11 support" ON) option(LIBRETRO "Build libretro core" OFF) option(USE_OPENGL "Use OpenGL API" ON) option(USE_VIDEOCORE "RPI: use the legacy Broadcom GLES libraries" OFF) +option(USE_ALSA "Build with ALSA support" ON) +option(USE_LIBAO "Build with AO support" ON) +option(USE_OSS "Build with OSS support" OFF) +option(USE_PULSEAUDIO "Build with PulseAudio support" ON) option(USE_BREAKPAD "Build and link with breakpad library" ON) option(ENABLE_GDB_SERVER "Build with GDB debugging support" OFF) option(ENABLE_DC_PROFILER "Build with support for target machine (SH4) profiler" OFF) @@ -411,11 +415,17 @@ if(USE_VULKAN) endif() if(NOT LIBRETRO) - find_package(ALSA) - if(ALSA_FOUND AND NOT ANDROID) - target_compile_definitions(${PROJECT_NAME} PRIVATE USE_ALSA) - target_include_directories(${PROJECT_NAME} PRIVATE ${ALSA_INCLUDE_DIRS}) - target_link_libraries(${PROJECT_NAME} PRIVATE ${ALSA_LIBRARIES}) + if(USE_OSS) + target_compile_definitions(${PROJECT_NAME} PRIVATE USE_OSS) + endif() + + if(USE_ALSA) + find_package(ALSA) + if(ALSA_FOUND AND NOT ANDROID) + target_compile_definitions(${PROJECT_NAME} PRIVATE USE_ALSA) + target_include_directories(${PROJECT_NAME} PRIVATE ${ALSA_INCLUDE_DIRS}) + target_link_libraries(${PROJECT_NAME} PRIVATE ${ALSA_LIBRARIES}) + endif() endif() if(MINGW) @@ -489,10 +499,12 @@ endif() find_package(PkgConfig) if(PKG_CONFIG_FOUND AND NOT ANDROID AND NOT APPLE AND NOT LIBRETRO) - pkg_check_modules(AO IMPORTED_TARGET ao) - if(AO_FOUND) - target_compile_definitions(${PROJECT_NAME} PRIVATE USE_LIBAO) - target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::AO) + if(USE_LIBAO) + pkg_check_modules(AO IMPORTED_TARGET ao) + if(AO_FOUND) + target_compile_definitions(${PROJECT_NAME} PRIVATE USE_LIBAO) + target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::AO) + endif() endif() if(NOT SDL2_FOUND) @@ -509,10 +521,12 @@ if(PKG_CONFIG_FOUND AND NOT ANDROID AND NOT APPLE AND NOT LIBRETRO) endif() endif() - pkg_check_modules(LIBPULSE IMPORTED_TARGET libpulse) - if(LIBPULSE_FOUND) - target_compile_definitions(${PROJECT_NAME} PRIVATE USE_PULSEAUDIO) - target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::LIBPULSE) + if(USE_PULSEAUDIO) + pkg_check_modules(LIBPULSE IMPORTED_TARGET libpulse) + if(LIBPULSE_FOUND) + target_compile_definitions(${PROJECT_NAME} PRIVATE USE_PULSEAUDIO) + target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::LIBPULSE) + endif() endif() if(USE_HOST_LIBZIP)