summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: bcf0aa2f1409f7c68f06de0c1c8769607babd492 (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
191
192
193
194
195
196
197
198
199
200
201
set(QtGStreamer_SRCS
    QGlib/quark.cpp
    QGlib/type.cpp
    QGlib/paramspec.cpp
    QGlib/object.cpp
    QGlib/value.cpp
    QGlib/signal.cpp
    QGlib/error.cpp
    QGlib/connect.cpp
    QGlib/wrap.cpp
    QGlib/init.cpp

    QGst/global.cpp
    QGst/objectstore.cpp
    QGst/value.cpp
    QGst/structure.cpp
    QGst/caps.cpp
    QGst/miniobject.cpp
    QGst/object.cpp
    QGst/pad.cpp
    QGst/ghostpad.cpp
    QGst/element.cpp
    QGst/pluginfeature.cpp
    QGst/elementfactory.cpp
    QGst/bin.cpp
    QGst/childproxy.cpp
    QGst/pipeline.cpp
    QGst/message.cpp
    QGst/bus.cpp
    QGst/parse.cpp
    QGst/urihandler.cpp
    QGst/videoorientation.cpp
    QGst/xoverlay.cpp
    QGst/streamvolume.cpp
    QGst/colorbalance.cpp
    QGst/propertyprobe.cpp
    QGst/query.cpp
    QGst/clock.cpp
    QGst/buffer.cpp
    QGst/event.cpp
    ${CMAKE_CURRENT_BINARY_DIR}/gen.cpp
)

set(QtGStreamerUi_SRCS
    QGst/Ui/videowidget.cpp
)

set(INSTALLED_HEADERS
    QGlib/global.h
    QGlib/quark.h       QGlib/Quark
    QGlib/type.h        QGlib/Type
    QGlib/refpointer.h  QGlib/RefPointer
    QGlib/wrap.h
    QGlib/paramspec.h   QGlib/ParamSpec
    QGlib/object.h      QGlib/Object
    QGlib/value.h       QGlib/Value
    QGlib/signal.h      QGlib/Signal
    QGlib/emitimpl.h
    QGlib/connect.h     QGlib/Connect
    QGlib/connectimpl.h
    QGlib/error.h       QGlib/Error

    QGst/global.h       QGst/Global
    QGst/enums.h
    QGst/structs.h      QGst/Fourcc
                        QGst/Fraction
                        QGst/IntRange
                        QGst/DoubleRange
                        QGst/FractionRange
    QGst/structure.h    QGst/Structure
    QGst/caps.h         QGst/Caps
    QGst/miniobject.h   QGst/MiniObject
    QGst/object.h       QGst/Object
    QGst/pad.h          QGst/Pad
    QGst/ghostpad.h     QGst/GhostPad
    QGst/element.h      QGst/Element
    QGst/pluginfeature.h QGst/PluginFeature
    QGst/elementfactory.h QGst/ElementFactory
    QGst/bin.h          QGst/Bin
    QGst/childproxy.h   QGst/ChildProxy
    QGst/pipeline.h     QGst/Pipeline
    QGst/message.h      QGst/Message
    QGst/bus.h          QGst/Bus
    QGst/parse.h        QGst/Parse
    QGst/urihandler.h   QGst/UriHandler
    QGst/videoorientation.h   QGst/VideoOrientation
    QGst/xoverlay.h     QGst/XOverlay
    QGst/streamvolume.h QGst/StreamVolume
    QGst/colorbalance.h QGst/ColorBalance
    QGst/propertyprobe.h QGst/PropertyProbe
    QGst/query.h        QGst/Query
    QGst/clock.h        QGst/Clock
    QGst/buffer.h       QGst/Buffer
    QGst/event.h        QGst/Event

    QGst/Ui/videowidget.h QGst/Ui/VideoWidget
)

set(CODEGEN_HEADERS
    QGlib/type.h
    QGlib/paramspec.h
    QGlib/object.h
    QGlib/signal.h
    QGlib/value.h

    QGst/enums.h
    QGst/structs.h
    QGst/structure.h
    QGst/caps.h
    QGst/miniobject.h
    QGst/object.h
    QGst/pad.h
    QGst/ghostpad.h
    QGst/element.h
    QGst/pluginfeature.h
    QGst/elementfactory.h
    QGst/bin.h
    QGst/childproxy.h
    QGst/pipeline.h
    QGst/message.h
    QGst/bus.h
    QGst/urihandler.h
    QGst/videoorientation.h
    QGst/xoverlay.h
    QGst/streamvolume.h
    QGst/colorbalance.h
    QGst/propertyprobe.h
    QGst/query.h
    QGst/clock.h
    QGst/buffer.h
    QGst/event.h
)

set(CODEGEN_INCLUDES
    -Igst/gst.h
    -Igst/interfaces/interfaces-enumtypes.h
    -Igst/interfaces/xoverlay.h
    -Igst/interfaces/streamvolume.h
    -Igst/interfaces/colorbalance.h
    -Igst/interfaces/videoorientation.h
    -Igst/interfaces/propertyprobe.h
)

# Setup the environment
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${GSTREAMER_INCLUDE_DIR}
                    ${GSTREAMER_INTERFACES_INCLUDE_DIR}
                    ${GLIB2_INCLUDE_DIR} ${QTGSTREAMER_INCLUDES})
add_definitions(${QTGSTREAMER_DEFINITIONS} -DGST_DISABLE_XML -DGST_DISABLE_LOADSAVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QTGSTREAMER_FLAGS}")


# Add command to generate gen.cpp using codegen
add_custom_command(OUTPUT gen.cpp
                   COMMAND codegen
                   ARGS ${CODEGEN_INCLUDES} ${CODEGEN_HEADERS} > ${CMAKE_CURRENT_BINARY_DIR}/gen.cpp
                   DEPENDS codegen ${CODEGEN_HEADERS}
                   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})


# Build and link QtGStreamer
if(QTGSTREAMER_STATIC)
    automoc4_add_library(QtGStreamer STATIC ${QtGStreamer_SRCS})
else()
    automoc4_add_library(QtGStreamer SHARED ${QtGStreamer_SRCS})
endif()

set_target_properties(QtGStreamer PROPERTIES SOVERSION ${QTGSTREAMER_SOVERSION}
                                             VERSION ${QTGSTREAMER_VERSION})
target_link_libraries(QtGStreamer ${QT_QTCORE_LIBRARY} ${GSTREAMER_LIBRARY}
                                  ${GSTREAMER_INTERFACES_LIBRARY} ${GOBJECT_LIBRARIES})
target_link_libraries(QtGStreamer LINK_INTERFACE_LIBRARIES ${QT_QTCORE_LIBRARY})


# Build and link QtGStreamerUi
if(QTGSTREAMER_STATIC)
    automoc4_add_library(QtGStreamerUi STATIC ${QtGStreamerUi_SRCS})
else()
    automoc4_add_library(QtGStreamerUi SHARED ${QtGStreamerUi_SRCS})
endif()

set_target_properties(QtGStreamerUi PROPERTIES SOVERSION ${QTGSTREAMER_SOVERSION}
                                               VERSION ${QTGSTREAMER_VERSION})
target_link_libraries(QtGStreamerUi ${QT_QTGUI_LIBRARY} QtGStreamer)
target_link_libraries(QtGStreamerUi LINK_INTERFACE_LIBRARIES ${QT_QTGUI_LIBRARY} QtGStreamer)


# Install the library
install(TARGETS QtGStreamer DESTINATION ${CMAKE_INSTALL_PREFIX}/lib EXPORT QtGStreamerTargets)
install(TARGETS QtGStreamerUi DESTINATION ${CMAKE_INSTALL_PREFIX}/lib EXPORT QtGStreamerTargets)

# Install the cmake scripts that are used to find the installed library from external projects
install(EXPORT QtGStreamerTargets DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/QtGStreamer)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/FindQtGStreamer.cmake
        DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/QtGStreamer
        RENAME QtGStreamerConfig.cmake)

# Install the headers
foreach(header ${INSTALLED_HEADERS})
    get_filename_component(header_path ${header} PATH)
    install(FILES ${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/QtGStreamer/${header_path})
endforeach(header ${INSTALLED_HEADERS})