Add cmake target to generate API docs and write some basic API docs where needed.
[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/closure.cpp
8     QGlib/signal.cpp
9     QGlib/error.cpp
10
11     QGst/global.cpp
12     QGst/structs.cpp
13     QGst/structure.cpp
14     QGst/caps.cpp
15     QGst/miniobject.cpp
16     QGst/object.cpp
17     QGst/pad.cpp
18     QGst/ghostpad.cpp
19     QGst/element.cpp
20     QGst/pluginfeature.cpp
21     QGst/elementfactory.cpp
22     QGst/bin.cpp
23     QGst/childproxy.cpp
24     QGst/pipeline.cpp
25     QGst/message.cpp
26     QGst/bus.cpp
27     QGst/parse.cpp
28     QGst/urihandler.cpp
29     ${CMAKE_CURRENT_BINARY_DIR}/gen.cpp
30 )
31
32 set(INSTALLED_HEADERS
33     QGlib/global.h
34     QGlib/quark.h       QGlib/Quark
35     QGlib/type.h        QGlib/Type
36     QGlib/refpointer.h  QGlib/RefPointer
37     QGlib/paramspec.h   QGlib/ParamSpec
38     QGlib/object.h      QGlib/Object
39     QGlib/value.h       QGlib/Value
40     QGlib/closure.h     QGlib/Closure
41     QGlib/closureimpl_p.h
42     QGlib/signal.h      QGlib/Signal
43     QGlib/signalimpl_p.h
44     QGlib/error.h       QGlib/Error
45
46     QGst/global.h       QGst/Global
47     QGst/enums.h
48     QGst/structs.h      QGst/Fourcc
49                         QGst/Fraction
50                         QGst/IntRange
51                         QGst/DoubleRange
52                         QGst/FractionRange
53     QGst/structure.h    QGst/Structure
54     QGst/caps.h         QGst/Caps
55     QGst/miniobject.h   QGst/MiniObject
56     QGst/object.h       QGst/Object
57     QGst/pad.h          QGst/Pad
58     QGst/ghostpad.h     QGst/GhostPad
59     QGst/element.h      QGst/Element
60     QGst/pluginfeature.h QGst/PluginFeature
61     QGst/elementfactory.h QGst/ElementFactory
62     QGst/bin.h          QGst/Bin
63     QGst/childproxy.h   QGst/ChildProxy
64     QGst/pipeline.h     QGst/Pipeline
65     QGst/message.h      QGst/Message
66     QGst/bus.h          QGst/Bus
67     QGst/parse.h        QGst/Parse
68     QGst/urihandler.h   QGst/UriHandler
69 )
70
71 set(CODEGEN_HEADERS
72     QGlib/type.h
73     QGlib/paramspec.h
74     QGlib/object.h
75     QGlib/closure.h
76     QGlib/signal.h
77
78     QGst/enums.h
79     QGst/structs.h
80     QGst/structure.h
81     QGst/caps.h
82     QGst/miniobject.h
83     QGst/object.h
84     QGst/pad.h
85     QGst/ghostpad.h
86     QGst/element.h
87     QGst/pluginfeature.h
88     QGst/elementfactory.h
89     QGst/bin.h
90     QGst/childproxy.h
91     QGst/pipeline.h
92     QGst/message.h
93     QGst/bus.h
94     QGst/urihandler.h
95 )
96
97 # Setup the environment
98 include_directories(${CMAKE_CURRENT_BINARY_DIR} ${GSTREAMER_INCLUDE_DIR}
99                     ${GLIB2_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} ${QTGSTREAMER_INCLUDES})
100 add_definitions(${QTGSTREAMER_DEFINITIONS})
101 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QTGSTREAMER_FLAGS}")
102
103
104 # Add command to generate gen.cpp using codegen
105 add_custom_command(OUTPUT gen.cpp
106                    COMMAND codegen
107                    ARGS ${CODEGEN_HEADERS} > ${CMAKE_CURRENT_BINARY_DIR}/gen.cpp
108                    DEPENDS codegen ${CODEGEN_HEADERS}
109                    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
110
111
112 # Build and link QtGstreamer
113 if(STATIC_QTGSTREAMER)
114     automoc4_add_library(QtGstreamer STATIC ${QtGstreamer_SRCS})
115 else()
116     automoc4_add_library(QtGstreamer SHARED ${QtGstreamer_SRCS})
117 endif()
118
119 set_target_properties(QtGstreamer PROPERTIES SOVERSION ${QTGSTREAMER_SOVERSION}
120                                              VERSION ${QTGSTREAMER_VERSION})
121 target_link_libraries(QtGstreamer ${QT_QTCORE_LIBRARY} ${GSTREAMER_LIBRARIES}
122                                   ${GSTREAMER_INTERFACE_LIBRARY} ${GOBJECT_LIBRARIES})
123 target_link_libraries(QtGstreamer LINK_INTERFACE_LIBRARIES ${QT_QTCORE_LIBRARY})
124
125
126 # Install the library
127 install(TARGETS QtGstreamer DESTINATION ${CMAKE_INSTALL_PREFIX}/lib EXPORT QtGstreamerTargets)
128
129 # Install the cmake scripts that are used to find the installed library from external projects
130 install(EXPORT QtGstreamerTargets DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/QtGstreamer)
131 install(FILES ${CMAKE_SOURCE_DIR}/cmake/modules/FindQtGstreamer.cmake
132         DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/QtGstreamer
133         RENAME QtGstreamerConfig.cmake)
134
135 # Install the headers
136 foreach(header ${INSTALLED_HEADERS})
137     get_filename_component(header_path ${header} PATH)
138     install(FILES ${header} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/QtGstreamer/${header_path})
139 endforeach(header ${INSTALLED_HEADERS})