blob: ccc42260db7d4e35141278615da1c97e9c590c6e (
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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
project(QtGStreamer)
cmake_minimum_required(VERSION 2.8.9)
enable_testing()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
set(QTGSTREAMER_VERSION 0.10.3.1)
option(QTGSTREAMER_STATIC "Build QtGStreamer as a static library" OFF)
option(QTGSTREAMER_TESTS "Build QtGStreamer's tests" OFF)
option(QTGSTREAMER_EXAMPLES "Build QtGStreamer's examples" ON)
option(QTGSTREAMER_CODEGEN "Build and use QtGStreamer's codegen" OFF)
option(USE_GST_PLUGIN_DIR "Install gstreamer plugins at the system location" ON)
option(USE_QT_PLUGIN_DIR "Install qt plugins at the system location" ON)
include(GNUInstallDirs)
include(MacroLogFeature)
set(Qt4_MIN_VERSION 4.7)
set(Qt5_MIN_VERSION 5.0.0)
find_package(Qt4or5 COMPONENTS Core Gui Widgets OPTIONAL_COMPONENTS OpenGL Quick1 Test)
macro_log_feature(Qt4or5_FOUND "Qt" "Required for building everything"
"http://qt-project.org/" TRUE "${Qt4or5_MIN_VERSION}")
macro_log_feature(Qt4or5_OpenGL_FOUND "QtOpenGL"
"Required for OpenGL acceleration in qtvideosink and QtGStreamerUi"
"http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
macro_log_feature(Qt4or5_Quick1_FOUND "QtQuick1 (QtDeclarative)"
"Required for building QtQuick1 support"
"http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
if (QTGSTREAMER_TESTS)
macro_log_feature(Qt4or5_Test_FOUND "QtTest" "Required for building unit tests"
"http://qt-project.org/" FALSE "${Qt4or5_MIN_VERSION}")
if (NOT Qt4or5_Test_FOUND)
set(QTGSTREAMER_TESTS OFF)
endif()
endif()
find_package(Boost 1.39)
macro_log_feature(Boost_FOUND "Boost" "Required for building QtGLib" "http://www.boost.org/" TRUE "1.39")
# set the QTGSTREAMER_* cmake variables
set(BUILDING_QTGSTREAMER TRUE)
if (${QT_VERSION} STREQUAL "5")
set(USE_QT5 TRUE)
set(QTGLIB_LIBRARY Qt5GLib)
set(QTGSTREAMER_LIBRARY Qt5GStreamer)
set(QTGSTREAMER_UI_LIBRARY Qt5GStreamerUi)
set(QTGSTREAMER_UTILS_LIBRARY Qt5GStreamerUtils)
set(QTGSTREAMER_PACKAGE_NAME Qt5GStreamer)
set(QTVIDEOSINK_NAME qt5videosink)
set(QTGLVIDEOSINK_NAME qt5glvideosink)
set(QWIDGETVIDEOSINK_NAME qwidget5videosink)
elseif (${QT_VERSION} STREQUAL "4")
set(USE_QT4 TRUE)
set(QTGLIB_LIBRARY QtGLib)
set(QTGSTREAMER_LIBRARY QtGStreamer)
set(QTGSTREAMER_UI_LIBRARY QtGStreamerUi)
set(QTGSTREAMER_UTILS_LIBRARY QtGStreamerUtils)
set(QTGSTREAMER_PACKAGE_NAME QtGStreamer)
set(QTVIDEOSINK_NAME qtvideosink)
set(QTGLVIDEOSINK_NAME qtglvideosink)
set(QWIDGETVIDEOSINK_NAME qwidgetvideosink)
endif()
set(QTGSTREAMER_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src)
include(QtGStreamerConfigCommon)
find_package(GStreamer 0.10.33 COMPONENTS base)
macro_log_feature(GSTREAMER_FOUND "GStreamer" "Required to build QtGStreamer"
"http://gstreamer.freedesktop.org/" TRUE "0.10.33")
macro_log_feature(GSTREAMER_BASE_LIBRARY_FOUND "GStreamer base library"
"Used for building the ${QTVIDEOSINK_NAME} element"
"http://gstreamer.freedesktop.org/" FALSE "0.10.33")
find_package(GStreamerPluginsBase 0.10.36 COMPONENTS app interfaces video pbutils)
macro_log_feature(GSTREAMER_APP_LIBRARY_FOUND "GStreamer app library"
"Required to build QtGStreamerUtils"
"http://gstreamer.freedesktop.org/" TRUE "0.10.33")
macro_log_feature(GSTREAMER_INTERFACES_LIBRARY_FOUND "GStreamer interfaces library"
"Required to build QtGStreamer"
"http://gstreamer.freedesktop.org/" TRUE "0.10.33")
macro_log_feature(GSTREAMER_VIDEO_LIBRARY_FOUND "GStreamer video library"
"Used for building the ${QTVIDEOSINK_NAME} element"
"http://gstreamer.freedesktop.org/" FALSE "0.10.33")
macro_log_feature(GSTREAMER_PBUTILS_LIBRARY_FOUND "GStreamer pbutils library"
"Used for building the Discoverer API"
"http://gstreamer.freedesktop.org/" TRUE "0.10.36")
find_package(GLIB2)
macro_log_feature(GLIB2_FOUND "GLib" "Required to build QtGLib" "http://www.gtk.org/" TRUE)
find_package(GObject)
macro_log_feature(GOBJECT_FOUND "GObject" "Required to build QtGLib" "http://www.gtk.org/" TRUE)
set(CMAKE_REQUIRED_INCLUDES ${QTGSTREAMER_INCLUDES})
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <QtCore/QtGlobal>
#if !defined(QT_OPENGL_ES)
#error \"No OpenGLES\"
#endif
int main() {}
" USE_OPENGLES)
if (USE_OPENGLES)
find_package(OpenGLES2)
macro_log_feature(OPENGLES2_FOUND "OpenGLES"
"Required for OpenGLES rendering support in ${QTVIDEOSINK_NAME}"
"http://www.opengl.org" FALSE "2.0")
else()
find_package(OpenGL)
macro_log_feature(OPENGL_FOUND "OpenGL"
"Required for OpenGL rendering support in ${QTVIDEOSINK_NAME}"
"http://www.opengl.org" FALSE)
endif()
if (QTGSTREAMER_CODEGEN AND CMAKE_CROSSCOMPILING)
message(WARNING "Codegen use requested, but we are crosscompiling. Disabling...")
set(QTGSTREAMER_CODEGEN OFF)
endif()
if (QTGSTREAMER_CODEGEN)
find_package(FLEX)
macro_log_feature(FLEX_FOUND "Flex" "Required to build codegen, a helper code generator"
"http://flex.sourceforge.net/" TRUE)
find_package(BISON)
macro_log_feature(BISON_FOUND "Bison" "Required to build codegen, a helper code generator"
"http://www.gnu.org/software/bison/" TRUE)
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat-security -Wundef -Wpointer-arith -fno-common")
endif ()
set(QTGSTREAMER_INSTALL_TARGET_DEFAULT_ARGS
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
set(QTGSTREAMER_PC_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
set(QTGSTREAMER_CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${QTGSTREAMER_PACKAGE_NAME})
set(QTGSTREAMER_INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR}/${QTGSTREAMER_PACKAGE_NAME})
if (USE_GST_PLUGIN_DIR)
set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${GSTREAMER_PLUGIN_DIR})
else()
set(QTGSTREAMER_GST_PLUGINS_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/gstreamer-0.10)
endif()
if (USE_QT_PLUGIN_DIR)
set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${QT_IMPORTS_DIR})
else()
if (USE_QT5)
set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt5/imports)
else()
set(QTGSTREAMER_QTQUICK1_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/qt4/imports)
endif()
endif()
if (QTGSTREAMER_CODEGEN AND FLEX_FOUND AND BISON_FOUND)
add_subdirectory(codegen)
endif()
add_subdirectory(src)
add_subdirectory(elements)
if (QTGSTREAMER_TESTS)
add_subdirectory(tests)
endif()
if (QTGSTREAMER_EXAMPLES)
add_subdirectory(examples)
endif()
# Add uninstall target. Taken from the KDE4 scripts
configure_file("${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" @ONLY)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
# Add doc target
include(UseDoxygen)
macro_log_feature(DOXYGEN_FOUND "Doxygen" "Used to generate the API documentation"
"http://www.doxygen.org/" FALSE)
macro_display_feature_log()
|