obs-filters: Cleanup CMake

This file has become a mess of people hacking in fixes so this cleans it
up to make sense again.
master
Kurt Kartaltepe 2020-08-27 08:53:30 -07:00
parent f319b96678
commit a2f5c323da
1 changed files with 26 additions and 39 deletions

View File

@ -3,49 +3,36 @@ project(obs-filters)
option(DISABLE_SPEEXDSP "Disable building of the SpeexDSP-based Noise Suppression filter" OFF)
option(DISABLE_RNNOISE "Disable building of the RNNoise-based Noise Suppression filter" OFF)
if(DISABLE_SPEEXDSP AND DISABLE_RNNOISE)
message(STATUS "SpeexDSP and RNNoise support disabled")
set(NOISEREDUCTION_ENABLED FALSE)
if(DISABLE_SPEEXDSP)
message(STATUS "SpeexDSP support disabled")
set(LIBSPEEXDSP_FOUND FALSE)
else()
if(DISABLE_SPEEXDSP)
message(STATUS "SpeexDSP support disabled")
set(LIBSPEEXDSP_FOUND FALSE)
else()
find_package(Libspeexdsp QUIET)
if(NOT LIBSPEEXDSP_FOUND)
message(STATUS "SpeexDSP support not found")
set(LIBSPEEXDSP_FOUND FALSE)
else()
message(STATUS "SpeexDSP supported")
add_definitions(-DLIBSPEEXDSP_ENABLED)
endif()
find_package(Libspeexdsp)
if(LIBSPEEXDSP_FOUND)
add_definitions(-DLIBSPEEXDSP_ENABLED)
endif()
endif()
if(DISABLE_RNNOISE)
message(STATUS "RNNoise support disabled")
set(LIBRNNOISE_FOUND FALSE)
else()
find_package(Librnnoise)
if(LIBRNNOISE_FOUND)
add_definitions(-DLIBRNNOISE_ENABLED)
endif()
if(DISABLE_RNNOISE)
message(STATUS "RNNoise support disabled")
set(LIBRNNOISE_FOUND FALSE)
else()
find_package(Librnnoise QUIET)
if(NOT LIBRNNOISE_FOUND)
message(STATUS "RNNoise support not found")
set(LIBRNNOISE_FOUND FALSE)
else()
message(STATUS "RNNoise supported")
add_definitions(-DLIBRNNOISE_ENABLED)
endif()
endif()
endif()
if(LIBSPEEXDSP_FOUND OR LIBRNNOISE_FOUND)
message(STATUS "Noise Reduction effect enabled")
set(obs-filters_NOISEREDUCTION_SOURCES
noise-suppress-filter.c)
set(obs-filters_NOISEREDUCTION_LIBRARIES
${LIBSPEEXDSP_LIBRARIES} ${LIBRNNOISE_LIBRARIES})
set(NOISEREDUCTION_ENABLED TRUE)
else()
set(NOISEREDUCTION_ENABLED FALSE)
endif()
if(LIBSPEEXDSP_FOUND OR LIBRNNOISE_FOUND)
message(STATUS "Noise Reduction effect enabled")
set(obs-filters_NOISEREDUCTION_SOURCES
noise-suppress-filter.c)
set(obs-filters_NOISEREDUCTION_LIBRARIES
${LIBSPEEXDSP_LIBRARIES} ${LIBRNNOISE_LIBRARIES})
set(NOISEREDUCTION_ENABLED TRUE)
else()
set(NOISEREDUCTION_ENABLED FALSE)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/obs-filters-config.h.in"