From 90244212f3477326ee4fc552bf5e0870cd0a58e9 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 5 Jan 2021 17:53:52 +0100 Subject: [PATCH] obs-outputs: Use system-wide FTL if present To support FTL, it needed to be present in-tree to be compiled. This PR adds support for system-wide installations of libftl. It uses pkg-config to find the system-wide installation. If pkg-config can't provide libftl we just fall back to using the in-tree submodule. If that's also not available it won't be included at all like before. --- plugins/obs-outputs/CMakeLists.txt | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/plugins/obs-outputs/CMakeLists.txt b/plugins/obs-outputs/CMakeLists.txt index 404e34f01..3ec627396 100644 --- a/plugins/obs-outputs/CMakeLists.txt +++ b/plugins/obs-outputs/CMakeLists.txt @@ -3,6 +3,8 @@ project(obs-outputs) set(WITH_RTMPS AUTO CACHE STRING "Enable RTMPS support with mbedTLS") set_property(CACHE WITH_RTMPS PROPERTY STRINGS AUTO ON OFF) +find_package(PkgConfig) + option(STATIC_MBEDTLS "Statically link mbedTLS into binary" OFF) if (WITH_RTMPS STREQUAL "AUTO") @@ -23,7 +25,21 @@ else() add_definitions(-DNO_CRYPTO) endif() -if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/CMakeLists.txt") +set(COMPILE_FTL FALSE) + +if (PKG_CONFIG_FOUND) + pkg_check_modules(FTL libftl) +endif() + +if (FTL_FOUND) + find_package(Libcurl REQUIRED) + message(STATUS "Found ftl-sdk (system): ftl outputs enabled") + + set(ftl_SOURCES ftl-stream.c) + + include_directories(${LIBCURL_INCLUDE_DIRS} ${FTL_INCLUDE_DIRS}) + set(COMPILE_FTL TRUE) +elseif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/CMakeLists.txt") find_package(Libcurl REQUIRED) message(STATUS "Found ftl-sdk: ftl outputs enabled") @@ -74,8 +90,6 @@ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ftl-sdk/CMakeLists.txt") include_directories(ftl-sdk/libftl) set(COMPILE_FTL TRUE) -else() - set(COMPILE_FTL FALSE) endif() configure_file( @@ -169,6 +183,12 @@ add_library(obs-outputs MODULE ${obs-outputs_HEADERS} ${obs-outputs_librtmp_SOURCES} ${obs-outputs_librtmp_HEADERS}) + +if(FTL_FOUND) + target_link_libraries(obs-outputs ${FTL_LIBRARIES}) + target_include_directories(obs-outputs PUBLIC ${FTL_INCLUDE_DIRS}) +endif() + target_link_libraries(obs-outputs libobs ${MBEDTLS_LIBRARIES} -- GitLab