From 9f8b74b720c630102e99f76dd7693a8a2ee696a8 Mon Sep 17 00:00:00 2001 From: BtbN <btbn@btbn.de> Date: Wed, 10 Sep 2014 13:47:50 +0200 Subject: [PATCH] Add disable options for optional plugins --- plugins/linux-pulseaudio/CMakeLists.txt | 9 ++++++++- plugins/linux-v4l2/CMakeLists.txt | 13 +++++++++---- plugins/obs-libfdk/CMakeLists.txt | 9 ++++++++- plugins/text-freetype2/CMakeLists.txt | 17 ++++++++++++++--- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/plugins/linux-pulseaudio/CMakeLists.txt b/plugins/linux-pulseaudio/CMakeLists.txt index 8f36d79b4..7f6eca61b 100644 --- a/plugins/linux-pulseaudio/CMakeLists.txt +++ b/plugins/linux-pulseaudio/CMakeLists.txt @@ -1,7 +1,14 @@ project(linux-pulseaudio) +if(DISABLE_PULSEAUDIO) + message(STATUS "PulseAudio support disabled") + return() +endif() + find_package(PulseAudio) -if(NOT PulseAudio_FOUND) +if(NOT PULSEAUDIO_FOUND AND ENABLE_PULSEAUDIO) + message(FATAL_ERROR "PulseAudio not found but set as enabled") +elseif(NOT PULSEAUDIO_FOUND) message(STATUS "PulseAudio not found, disabling PulseAudio plugin") return() endif() diff --git a/plugins/linux-v4l2/CMakeLists.txt b/plugins/linux-v4l2/CMakeLists.txt index 4c1f0e4da..db728f475 100644 --- a/plugins/linux-v4l2/CMakeLists.txt +++ b/plugins/linux-v4l2/CMakeLists.txt @@ -1,13 +1,18 @@ -include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") +project(linux-v4l2) + +if(DISABLE_V4L2) + message(STATUS "v4l2 plugin disabled") + return() +endif() find_package(Libv4l2) -if(NOT LIBV4L2_FOUND) +if(NOT LIBV4L2_FOUND AND ENABLE_V4L2) + message(FATAL_ERROR "libv4l2 not found bit plugin set as enabled") +elseif(NOT LIBV4L2_FOUND) message(STATUS "libv4l2 not found, disabling v4l2 plugin") return() endif() -include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") - set(linux-v4l2_SOURCES linux-v4l2.c v4l2-input.c diff --git a/plugins/obs-libfdk/CMakeLists.txt b/plugins/obs-libfdk/CMakeLists.txt index 1b260e139..f804d0124 100644 --- a/plugins/obs-libfdk/CMakeLists.txt +++ b/plugins/obs-libfdk/CMakeLists.txt @@ -1,7 +1,14 @@ project(obs-libfdk) +if(DISABLE_LIBFDK) + message(STATUS "Libfdk support disabled") + return() +endif() + find_package(Libfdk QUIET) -if(NOT LIBFDK_FOUND) +if(NOT LIBFDK_FOUND AND ENABLE_LIBFDK) + message(FATAL_ERROR "Libfdk not found but set as enabled") +elseif(NOT LIBFDK_FOUND) message(STATUS "Libfdk not found - obs-libfdk plugin disabled") return() endif() diff --git a/plugins/text-freetype2/CMakeLists.txt b/plugins/text-freetype2/CMakeLists.txt index dba08e038..26af54923 100644 --- a/plugins/text-freetype2/CMakeLists.txt +++ b/plugins/text-freetype2/CMakeLists.txt @@ -1,7 +1,14 @@ project(text-freetype2) +if(DISABLE_FREETYPE) + message(STATUS "Freetype text plugin disabled") + return() +endif() + find_package(Freetype QUIET) -if(NOT FREETYPE_FOUND) +if(NOT FREETYPE_FOUND AND ENABLE_FREETYPE) + message(FATAL_ERROR "Freetype library not found but set as enabled") +elseif(NOT FREETYPE_FOUND) message(STATUS "Freetype library not found, Freetype text plugin disabled") return() endif() @@ -12,7 +19,9 @@ if(WIN32) find-font-windows.c) elseif(APPLE) find_package(Iconv QUIET) - if(NOT ICONV_FOUND) + if(NOT ICONV_FOUND AND ENABLE_FREETYPE) + message(FATAL_ERROR "Iconv library not found but plugin set as enabled") + elseif(NOT ICONV_FOUND) message(STATUS "Iconv library not found, Freetype text plugin disabled") return() endif() @@ -35,7 +44,9 @@ elseif(APPLE) PROPERTIES LANGUAGE C) else() find_package(Fontconfig QUIET) - if(NOT FONTCONFIG_FOUND) + if(NOT FONTCONFIG_FOUND AND ENABLE_FREETYPE) + message(FATAL_ERROR "fontconfig not found but plugin set as enabled") + elseif(NOT FONTCONFIG_FOUND) message(STATUS "fontconfig not found, Freetype text plugin disabled") return() endif() -- GitLab