summarylogtreecommitdiffstats
path: root/use_system_ftl-sdk.patch
blob: 0604fdc97489d06e35efca5d69a56328e4fbfbc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From a920e39524cc989474136e6371b662d28d51a185 Mon Sep 17 00:00:00 2001
From: Sefa Eyeoglu <contact@scrumplex.net>
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 404e34f015c..3ec627396e7 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}