Fix compilation.
[qtgstreamer:qtgstreamer.git] / src / CMakeLists.txt
1 set(QtGstreamer_SRCS
2     QGlib/quark.cpp
3     QGlib/type.cpp
4     QGlib/paramspec.cpp
5     QGlib/object.cpp
6     QGlib/value.cpp
7     QGlib/signal.cpp
8     QGlib/error.cpp
9
10     QGst/global.cpp
11     QGst/structs.cpp
12     QGst/structure.cpp
13     QGst/caps.cpp
14     QGst/miniobject.cpp
15     QGst/object.cpp
16     QGst/pad.cpp
17     QGst/ghostpad.cpp
18     QGst/element.cpp
19     QGst/pluginfeature.cpp
20     QGst/elementfactory.cpp
21     QGst/bin.cpp
22     QGst/childproxy.cpp
23     QGst/pipeline.cpp
24     QGst/message.cpp
25     QGst/bus.cpp
26     QGst/parse.cpp
27     QGst/urihandler.cpp
28     QGst/videoorientation.cpp
29     QGst/xoverlay.cpp
30     QGst/streamvolume.cpp
31     QGst/colorbalance.cpp
32     QGst/propertyprobe.cpp
33     QGst/query.cpp
34     QGst/clock.cpp
35     QGst/buffer.cpp
36     QGst/event.cpp
37     ${CMAKE_CURRENT_BINARY_DIR}/gen.cpp
38 )
39
40 set(QtGstreamerUi_SRCS
41     QGst/Ui/videowidget.cpp
42 )
43
44 set(INSTALLED_HEADERS
45     QGlib/global.h
46     QGlib/quark.h       QGlib/Quark
47     QGlib/type.h        QGlib/Type
48     QGlib/refpointer.h  QGlib/RefPointer
49     QGlib/paramspec.h   QGlib/ParamSpec
50     QGlib/object.h      QGlib/Object
51     QGlib/value.h       QGlib/Value
52     QGlib/signal.h      QGlib/Signal
53     QGlib/emitimpl_p.h
54     QGlib/connectimpl_p.h
55     QGlib/error.h       QGlib/Error
56
57     QGst/global.h       QGst/Global
58     QGst/enums.h
59     QGst/structs.h      QGst/Fourcc
60                         QGst/Fraction
61                         QGst/IntRange
62                         QGst/DoubleRange
63                         QGst/FractionRange
64     QGst/structure.h    QGst/Structure
65     QGst/caps.h         QGst/Caps
66     QGst/miniobject.h   QGst/MiniObject
67     QGst/object.h       QGst/Object
68     QGst/pad.h          QGst/Pad
69     QGst/ghostpad.h     QGst/GhostPad
70     QGst/element.h      QGst/Element
71     QGst/pluginfeature.h QGst/PluginFeature
72     QGst/elementfactory.h QGst/ElementFactory
73     QGst/bin.h          QGst/Bin
74     QGst/childproxy.h   QGst/ChildProxy
75     QGst/pipeline.h     QGst/Pipeline
76     QGst/message.h      QGst/Message
77     QGst/bus.h          QGst/Bus
78     QGst/parse.h        QGst/Parse
79     QGst/urihandler.h   QGst/UriHandler
80     QGst/videoorientation.h   QGst/VideoOrientation
81     QGst/xoverlay.h     QGst/XOverlay
82     QGst/streamvolume.h QGst/StreamVolume
83     QGst/colorbalance.h QGst/ColorBalance
84     QGst/propertyprobe.h QGst/PropertyProbe
85     QGst/query.h        QGst/Query
86     QGst/clock.h        QGst/Clock
87     QGst/buffer.h       QGst/Buffer
88     QGst/event.h        QGst/Event
89
90     QGst/Ui/videowidget.h QGst/Ui/VideoWidget
91 )
92
93 set(CODEGEN_HEADERS
94     QGlib/type.h
95     QGlib/paramspec.h
96     QGlib/object.h
97     QGlib/signal.h
98
99     QGst/enums.h
100     QGst/structs.h
101     QGst/structure.h
102     QGst/caps.h
103     QGst/miniobject.h
104     QGst/object.h
105     QGst/pad.h
106     QGst/ghostpad.h
107     QGst/element.h
108     QGst/pluginfeature.h
109     QGst/elementfactory.h
110     QGst/bin.h
111     QGst/childproxy.h
112     QGst/pipeline.h
113     QGst/message.h
114     QGst/bus.h
115     QGst/urihandler.h
116     QGst/videoorientation.h
117     QGst/xoverlay.h
118     QGst/streamvolume.h
119     QGst/colorbalance.h
120     QGst/propertyprobe.h
121     QGst/query.h
122     QGst/clock.h
123     QGst/buffer.h
124     QGst/event.h
125 )
126
127 set(CODEGEN_INCLUDES
128     -Igst/gst.h
129     -Igst/interfaces/interfaces-enumtypes.h
130     -Igst/interfaces/xoverlay.h
131     -Igst/interfaces/streamvolume.h
132     -Igst/interfaces/colorbalance.h
133     -Igst/interfaces/videoorientation.h
134     -Igst/interfaces/propertyprobe.h
135 )
136
137 # Setup the environment
138 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${GSTREAMER_INCLUDE_DIR}
139                     ${GLIB2_INCLUDE_DIR} ${QTGSTREAMER_INCLUDES})
140 add_definitions(${QTGSTREAMER_DEFINITIONS} -DGST_DISABLE_DEPRECATED)
141 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QTGSTREAMER_FLAGS}")
142
143
144 # Add command to generate gen.cpp using codegen
145 add_custom_command(OUTPUT gen.cpp
146                    COMMAND codegen
147                    ARGS ${CODEGEN_INCLUDES} ${CODEGEN_HEADERS} > ${CMAKE_CURRENT_BINARY_DIR}/gen.cpp
148                    DEPENDS codegen ${CODEGEN_HEADERS}
149                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
150
151
152 # Build and link QtGstreamer
153 if(STATIC_QTGSTREAMER)
154     automoc4_add_library(QtGstreamer STATIC ${QtGstreamer_SRCS})
155 else()
156     automoc4_add_library(QtGstreamer SHARED ${QtGstreamer_SRCS})
157 endif()
158
159 set_target_properties(QtGstreamer PROPERTIES SOVERSION ${QTGSTREAMER_SOVERSION}
160                                              VERSION ${QTGSTREAMER_VERSION})
161 target_link_libraries(QtGstreamer ${QT_QTCORE_LIBRARY} ${GSTREAMER_LIBRARIES}
162                                   ${GSTREAMER_INTERFACE_LIBRARY} ${GOBJECT_LIBRARIES})
163 target_link_libraries(QtGstreamer LINK_INTERFACE_LIBRARIES ${QT_QTCORE_LIBRARY})
164
165
166 # Build and link QtGstreamerUi
167 if(STATIC_QTGSTREAMER)
168     automoc4_add_library(QtGstreamerUi STATIC ${QtGstreamerUi_SRCS})
169 else()
170     automoc4_add_library(QtGstreamerUi SHARED ${QtGstreamerUi_SRCS})
171 endif()
172
173 set_target_properties(QtGstreamerUi PROPERTIES SOVERSION ${QTGSTREAMER_SOVERSION}
174                                                VERSION ${QTGSTREAMER_VERSION})
175 target_link_libraries(QtGstreamerUi ${QT_QTGUI_LIBRARY} QtGstreamer)
176 target_link_libraries(QtGstreamerUi LINK_INTERFACE_LIBRARIES ${QT_QTGUI_LIBRARY} QtGstreamer)
177
178
179 # Install the library
180 install(TARGETS QtGstreamer DESTINATION ${CMAKE_INSTALL_PREFIX}/lib EXPORT QtGstreamerTargets)
181 install(TARGETS QtGstreamerUi DESTINATION ${CMAKE_INSTALL_PREFIX}/lib EXPORT QtGstreamerTargets)
182
183 # Install the cmake scripts that are used to find the installed library from external projects
184 install(EXPORT QtGstreamerTargets DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/QtGstreamer)
185 install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/FindQtGstreamer.cmake
186         DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/QtGstreamer
187         RENAME QtGstreamerConfig.cmake)
188
189 # Install the headers
190 foreach(header ${INSTALLED_HEADERS})
191     get_filename_component(header_path ${header} PATH)
192     install(FILES ${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/QtGstreamer/${header_path})
193 endforeach(header ${INSTALLED_HEADERS})