summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: 5596ab311f00d110b8314dfc16570c2eebd10822 (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
set(QtGstreamer_SRCS
    QGlib/quark.cpp
    QGlib/type.cpp
    QGlib/paramspec.cpp
    QGlib/object.cpp
    QGlib/value.cpp
    QGlib/signal.cpp
    QGlib/error.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/paramspec.h   QGlib/ParamSpec
    QGlib/object.h      QGlib/Object
    QGlib/value.h       QGlib/Value
    QGlib/signal.h      QGlib/Signal
    QGlib/emitimpl.h
    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

    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}
                    ${GLIB2_INCLUDE_DIR} ${QTGSTREAMER_INCLUDES})
add_definitions(${QTGSTREAMER_DEFINITIONS} -DGST_DISABLE_DEPRECATED)
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_LIBRARIES}
                                  ${GSTREAMER_INTERFACE_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})