summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 6000ed60f85f20ce77fc8d6d25e11be8d648beb6 (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
project(QtGStreamer)
cmake_minimum_required(VERSION 2.8)
enable_testing()

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
set(QTGSTREAMER_VERSION 0.10.1.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 plugins together with the other gstreamer plugins" ON)

include(MacroLogFeature)

find_package(Qt4 COMPONENTS QtCore QtGui QtTest)
macro_log_feature(QT4_FOUND "Qt 4" "Required for building everything" "http://qt.nokia.com/" TRUE "4.5")
macro_log_feature(QT_QTOPENGL_FOUND "QtOpenGL" "Required for OpenGL rendering support in qtvideosink"
                                    "http://qt.nokia.com/" FALSE "4.5")

find_package(Boost 1.39)
macro_log_feature(Boost_FOUND "Boost" "Required for building QtGLib" "http://www.boost.org/" TRUE "1.39")

# this just sets the QTGSTREAMER_* cmake variables
set(BUILDING_QTGSTREAMER TRUE)
find_package(QtGStreamer REQUIRED)

find_package(Automoc4)
macro_log_feature(Automoc4_FOUND "Automoc 4" "Required for the build system to generate moc files properly"
                                 "https://projects.kde.org/projects/kdesupport/automoc" TRUE "0.9.88")

find_package(GStreamer 0.10.31 COMPONENTS base)
macro_log_feature(GSTREAMER_FOUND "GStreamer" "Required to build QtGStreamer"
                                  "http://gstreamer.freedesktop.org/" TRUE "0.10.31")
macro_log_feature(GSTREAMER_BASE_LIBRARY_FOUND "GStreamer base library"
                                               "Used for building the qwidgetvideosink element"
                                               "http://gstreamer.freedesktop.org/" FALSE "0.10.31")

find_package(GStreamerPluginsBase 0.10.31 COMPONENTS app interfaces video)
macro_log_feature(GSTREAMER_APP_LIBRARY_FOUND "GStreamer app library"
                                              "Required to build QtGStreamerUtils"
                                              "http://gstreamer.freedesktop.org/" TRUE "0.10.31")
macro_log_feature(GSTREAMER_INTERFACES_LIBRARY_FOUND "GStreamer interfaces library"
                                                "Required to build QtGStreamer"
                                                "http://gstreamer.freedesktop.org/" TRUE "0.10.31")
macro_log_feature(GSTREAMER_VIDEO_LIBRARY_FOUND "GStreamer video library"
                                                "Used for building the qwidgetvideosink element"
                                                "http://gstreamer.freedesktop.org/" FALSE "0.10.31")

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)

find_package(OpenGL)
macro_log_feature(OPENGL_FOUND "OpenGL" "Required for OpenGL rendering support in qtvideosink" FALSE)

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 -Wcast-align -fno-common")
endif ()

set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE STRING "Destination directory for libraries")
set(INCLUDES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/QtGStreamer)

if (USE_GST_PLUGIN_DIR)
    set(PLUGINS_INSTALL_DIR ${GSTREAMER_PLUGIN_DIR})
else()
    set(PLUGINS_INSTALL_DIR ${LIB_INSTALL_DIR}/gstreamer-0.10)
endif()

if (QTGSTREAMER_CODEGEN AND FLEX_FOUND AND BISON_FOUND)
    add_subdirectory(codegen)
endif()

if (Automoc4_FOUND) # avoid errors about missing automoc4_add_* macros
    add_subdirectory(src)
    add_subdirectory(elements)

    if (QTGSTREAMER_TESTS)
        add_subdirectory(tests)
    endif()

    if (QTGSTREAMER_EXAMPLES)
        add_subdirectory(examples)
    endif()
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()