-
Notifications
You must be signed in to change notification settings - Fork 3
/
FindGstreamer.cmake
146 lines (120 loc) · 5.47 KB
/
FindGstreamer.cmake
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# - Try to find GStreamer
# Once done this will define
#
# GSTREAMER_FOUND - system has GStreamer
# GSTREAMER_INCLUDE_DIR - the GStreamer include directory
# GSTREAMER_WEBRTC_INCLUDE_DIR - the GStreamer include directory
# GSTREAMER_LIBRARIES - the libraries needed to use GStreamer
# GSTREAMER_DEFINITIONS - Compiler switches required for using GStreamer
# GSTREAMER_VERSION - the version of GStreamer
# Copyright (c) 2008 Helio Chissini de Castro, <[email protected]>
# (c)2006, Tim Beaulen <[email protected]>
# TODO: Other versions --> GSTREAMER_X_Y_FOUND (Example: GSTREAMER_0_8_FOUND and GSTREAMER_1.0_FOUND etc)
IF(GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY AND GSTREAMER_VIDEO_LIBRARY AND GSTREAMER_AUDIO_LIBRARY)
# in cache already
SET(GStreamer_FIND_QUIETLY TRUE)
ELSE(GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY AND GSTREAMER_VIDEO_LIBRARY AND GSTREAMER_AUDIO_LIBRARY)
SET(GStreamer_FIND_QUIETLY FALSE)
ENDIF(GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY AND GSTREAMER_VIDEO_LIBRARY AND GSTREAMER_AUDIO_LIBRARY)
IF(NOT WIN32)
FIND_PACKAGE(PkgConfig REQUIRED)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
# don't make this check required - otherwise you can't use macro_optional_find_package on this one
PKG_CHECK_MODULES(PKG_GSTREAMER gstreamer-1.0)
SET(GSTREAMER_VERSION ${PKG_GSTREAMER_VERSION})
SET(GSTREAMER_DEFINITIONS ${PKG_GSTREAMER_CFLAGS})
ENDIF(NOT WIN32)
FIND_PATH(GSTREAMER_INCLUDE_DIR gst/gst.h
PATHS
${PKG_GSTREAMER_INCLUDE_DIRS}
PATH_SUFFIXES gstreamer-1.0
)
IF(NOT GSTREAMER_INCLUDE_DIR)
MESSAGE(STATUS "GStreamer: WARNING: include dir not found")
ENDIF(NOT GSTREAMER_INCLUDE_DIR)
FIND_PATH(GSTREAMER_WEBRTC_INCLUDE_DIR gst/webrtc/webrtc_fwd.h
PATHS
${PKG_GSTREAMER_INCLUDE_DIRS}
PATH_SUFFIXES gstreamer-1.0
)
# Newer versions of GStreamer put gst-config.h under lib/gstreamer-1.0/include
FIND_PATH(GSTREAMER_CONF_INCLUDE_DIR gst/gstconfig.h
PATHS
${PKG_GSTREAMER_INCLUDE_DIRS}
PATH_SUFFIXES gstreamer-1.0 gstreamer-1.0/include
)
IF(NOT GSTREAMER_CONF_INCLUDE_DIR)
MESSAGE(STATUS "GStreamer: WARNING: gstconfig.h not found")
ENDIF(NOT GSTREAMER_CONF_INCLUDE_DIR)
IF(GSTREAMER_INCLUDE_DIR AND GSTREAMER_CONF_INCLUDE_DIR)
IF(NOT GSTREAMER_CONF_INCLUDE_DIR STREQUAL GSTREAMER_INCLUDE_DIR)
LIST(APPEND GSTREAMER_INCLUDE_DIR "${GSTREAMER_CONF_INCLUDE_DIR}")
ENDIF()
ENDIF(GSTREAMER_INCLUDE_DIR AND GSTREAMER_CONF_INCLUDE_DIR)
FIND_LIBRARY(GSTREAMER_LIBRARIES NAMES gstreamer-1.0
PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_BASE_LIBRARY NAMES gstbase-1.0
PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_APP_LIBRARY NAMES gstapp-1.0
PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_VIDEO_LIBRARY NAMES gstvideo-1.0
PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_AUDIO_LIBRARY NAMES gstaudio-1.0
PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_WEBRTC_LIBRARY NAMES gstwebrtc-1.0
PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_SDP_LIBRARY NAMES gstsdp-1.0
PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}
)
IF(GSTREAMER_LIBRARIES)
ELSE(GSTREAMER_LIBRARIES)
MESSAGE(STATUS "GStreamer: WARNING: library not found")
ENDIF(GSTREAMER_LIBRARIES)
IF(GSTREAMER_APP_LIBRARY)
ELSE(GSTREAMER_APP_LIBRARY)
MESSAGE(STATUS "GStreamer: WARNING: app library not found")
ENDIF(GSTREAMER_APP_LIBRARY)
IF(GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY AND GSTREAMER_VIDEO_LIBRARY AND GSTREAMER_AUDIO_LIBRARY)
SET(GSTREAMER_FOUND TRUE)
ELSE(GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY AND GSTREAMER_VIDEO_LIBRARY AND GSTREAMER_AUDIO_LIBRARY)
SET(GSTREAMER_FOUND FALSE)
ENDIF(GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY AND GSTREAMER_VIDEO_LIBRARY AND GSTREAMER_AUDIO_LIBRARY)
IF(GSTREAMER_WEBRTC_INCLUDE_DIR AND GSTREAMER_WEBRTC_LIBRARY AND GSTREAMER_SDP_LIBRARY)
SET(GSTREAMER_WEBRTC_FOUND TRUE)
ELSE(GSTREAMER_WEBRTC_INCLUDE_DIR AND GSTREAMER_WEBRTC_LIBRARY AND GSTREAMER_SDP_LIBRARY)
SET(GSTREAMER_WEBRTC_FOUND FALSE)
ENDIF(GSTREAMER_WEBRTC_INCLUDE_DIR AND GSTREAMER_WEBRTC_LIBRARY AND GSTREAMER_SDP_LIBRARY)
IF(GSTREAMER_FOUND)
IF(NOT GStreamer_FIND_QUIETLY)
MESSAGE(STATUS "Found GStreamer: ${GSTREAMER_LIBRARIES}")
ENDIF (NOT GStreamer_FIND_QUIETLY)
ELSE(GSTREAMER_FOUND)
IF(GStreamer_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could NOT find GStreamer")
ENDIF (GStreamer_FIND_REQUIRED)
ENDIF (GSTREAMER_FOUND)
INCLUDE(FindPackageHandleStandardArgs)
IF(GSTREAMER_VERSION)
find_package_handle_standard_args(Gstreamer
REQUIRED_VARS
GSTREAMER_LIBRARIES
GSTREAMER_INCLUDE_DIR
VERSION_VAR
GSTREAMER_VERSION
FAIL_MESSAGE
"Could NOT find Gstreamer, try to set the path to Gstreamer root folder in the system variable"
)
ELSE()
find_package_handle_standard_args(Gstreamer "Could NOT find Gstreamer, try to set the path to Gstreamer root folder in the system variable"
GSTREAMER_LIBRARIES
GSTREAMER_INCLUDE_DIR
)
ENDIF()
MARK_AS_ADVANCED(GSTREAMER_INCLUDE_DIR GSTREAMER_WEBRTC_INCLUDE_DIR GSTREAMER_LIBRARIES GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY GSTREAMER_APP_LIBRARY GSTREAMER_VIDEO_LIBRARY GSTREAMER_AUDIO_LIBRARY GSTREAMER_WEBRTC_LIBRARY GSTREAMER_SDP_LIBRARY)