From ff21f8da212366a5ad0aec2389482bc8e076306b Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sat, 6 Apr 2024 11:22:20 +0000 Subject: [PATCH] build: enable FAudio sound driver on Windows Enable FAudio on Windows if cmake can find it. Signed-off-by: Rafael Kitover --- cmake/Options.cmake | 12 +++++++++++- src/wx/CMakeLists.txt | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/Options.cmake b/cmake/Options.cmake index 4b8ac851..2b84d6b3 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -140,7 +140,17 @@ if(WIN32) option(ENABLE_XAUDIO2 "Enable xaudio2 sound output for the wxWidgets port" ${XAUDIO2_DEFAULT}) endif() -option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" OFF) +set(ENABLE_FAUDIO_DEFAULT OFF) + +if(WIN32) + find_package(FAudio) + + if(FAudio_FOUND) + set(ENABLE_FAUDIO_DEFAULT ON) + endif() +endif() + +option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" ${ENABLE_FAUDIO_DEFAULT}) option(ZIP_SUFFIX [=[suffix for release zip files, e.g. "-somebranch".zip]=] OFF) diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index c92b3742..2360138f 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -324,7 +324,6 @@ endif() # FAudio. if(ENABLE_FAUDIO) - find_package(FAudio REQUIRED) target_sources(visualboyadvance-m PRIVATE faudio.cpp) target_link_libraries(visualboyadvance-m FAudio::FAudio) target_compile_definitions(visualboyadvance-m PRIVATE VBAM_ENABLE_FAUDIO)