diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | cmake/modules/FindGStreamer.cmake | 176 | ||||
-rw-r--r-- | cmake/modules/FindGStreamerPlugins.cmake | 112 | ||||
-rw-r--r-- | cmake/modules/FindGStreamerPluginsBase.cmake | 96 | ||||
-rw-r--r-- | cmake/modules/MacroFindGStreamerLibrary.cmake | 55 | ||||
-rw-r--r-- | elements/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/CMakeLists.txt | 5 | ||||
-rw-r--r-- | tests/auto/CMakeLists.txt | 2 |
8 files changed, 272 insertions, 190 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e08ecb6..9ad0856 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,17 +14,13 @@ option(QTGSTREAMER_EXAMPLES "Build QtGStreamer's examples" ON) find_package(Qt4 COMPONENTS QtCore QtGui QtTest REQUIRED) find_package(QtGstreamer REQUIRED) find_package(Automoc4 REQUIRED) -find_package(GStreamer REQUIRED) -find_package(GStreamerPlugins) +find_package(GStreamer 0.10.30 REQUIRED) +find_package(GStreamerPluginsBase 0.10.30 COMPONENTS interfaces video REQUIRED) find_package(GLIB2 REQUIRED) find_package(GObject REQUIRED) find_package(FLEX REQUIRED) find_package(BISON REQUIRED) -if (${GSTREAMER_VERSION} VERSION_LESS "0.10.30") - message(FATAL_ERROR "QtGstreamer requires Gstreamer >= 0.10.30") -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 () diff --git a/cmake/modules/FindGStreamer.cmake b/cmake/modules/FindGStreamer.cmake index a1b6e33..98ce9eb 100644 --- a/cmake/modules/FindGStreamer.cmake +++ b/cmake/modules/FindGStreamer.cmake @@ -3,72 +3,118 @@ # # GSTREAMER_FOUND - system has GStreamer # GSTREAMER_INCLUDE_DIR - the GStreamer include directory -# GSTREAMER_LIBRARIES - the libraries needed to use GStreamer -# GSTREAMER_DEFINITIONS - Compiler switches required for using GStreamer -# GSTREAMER_VERSION - the version of GStreamer - -# Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com> -# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org> +# GSTREAMER_LIBRARY - the main GStreamer library +# +# And for all the plugin libraries specified in the COMPONENTS +# of find_package, this module will define: +# +# GSTREAMER_<plugin_lib>_LIBRARY_FOUND - system has <plugin_lib> +# GSTREAMER_<plugin_lib>_LIBRARY - the <plugin_lib> library +# GSTREAMER_<plugin_lib>_INCLUDE_DIR - the <plugin_lib> include directory +# +# Copyright (c) 2010, Collabora Ltd. +# @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk> # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# TODO: Other versions --> GSTREAMER_X_Y_FOUND (Example: GSTREAMER_0_8_FOUND and GSTREAMER_0_10_FOUND etc) - -IF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) - # in cache already - SET(GStreamer_FIND_QUIETLY TRUE) -ELSE (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) - SET(GStreamer_FIND_QUIETLY FALSE) -ENDIF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) - -IF (NOT WIN32) - FIND_PACKAGE(PkgConfig REQUIRED) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - # don't make this check required - otherwise you can't use macro_optional_find_package on this one - PKG_CHECK_MODULES(PKG_GSTREAMER gstreamer-0.10) - SET(GSTREAMER_VERSION ${PKG_GSTREAMER_VERSION}) - SET(GSTREAMER_DEFINITIONS ${PKG_GSTREAMER_CFLAGS}) -ENDIF (NOT WIN32) - -FIND_PATH(GSTREAMER_INCLUDE_DIR gst/gst.h - PATHS - ${PKG_GSTREAMER_INCLUDE_DIRS} - PATH_SUFFIXES gstreamer-0.10 - ) - -FIND_LIBRARY(GSTREAMER_LIBRARIES NAMES gstreamer-0.10 - PATHS - ${PKG_GSTREAMER_LIBRARY_DIRS} - ) - -FIND_LIBRARY(GSTREAMER_BASE_LIBRARY NAMES gstbase-0.10 - PATHS - ${PKG_GSTREAMER_LIBRARY_DIRS} - ) - -FIND_LIBRARY(GSTREAMER_INTERFACE_LIBRARY NAMES gstinterfaces-0.10 - PATHS - ${PKG_GSTREAMER_LIBRARY_DIRS} - ) - -IF (GSTREAMER_INCLUDE_DIR) -ELSE (GSTREAMER_INCLUDE_DIR) - MESSAGE(STATUS "GStreamer: WARNING: include dir not found") -ENDIF (GSTREAMER_INCLUDE_DIR) - -IF (GSTREAMER_LIBRARIES) -ELSE (GSTREAMER_LIBRARIES) - MESSAGE(STATUS "GStreamer: WARNING: library not found") -ENDIF (GSTREAMER_LIBRARIES) - -IF (GSTREAMER_INTERFACE_LIBRARY) -ELSE (GSTREAMER_INTERFACE_LIBRARY) - MESSAGE(STATUS "GStreamer: WARNING: interface library not found") -ENDIF (GSTREAMER_INTERFACE_LIBRARY) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG GSTREAMER_LIBRARIES GSTREAMER_INCLUDE_DIR GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY) - -MARK_AS_ADVANCED(GSTREAMER_INCLUDE_DIR GSTREAMER_LIBRARIES GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY) +if (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARY) + set(GStreamer_FIND_QUIETLY TRUE) +else() + set(GStreamer_FIND_QUIETLY FALSE) +endif() + +set(GSTREAMER_ABI_VERSION "0.10") + + +# Find the main library +find_package(PkgConfig) + +if (PKG_CONFIG_FOUND) + pkg_check_modules(PKG_GSTREAMER gstreamer-${GSTREAMER_ABI_VERSION}) +endif() + +find_library(GSTREAMER_LIBRARY + NAMES gstreamer-${GSTREAMER_ABI_VERSION} + PATHS ${PKG_GSTREAMER_LIBRARY_DIRS}) + +find_path(GSTREAMER_INCLUDE_DIR + gst/gst.h + PATHS ${PKG_GSTREAMER_INCLUDE_DIRS} + PATH_SUFFIXES gstreamer-${GSTREAMER_ABI_VERSION}) + +mark_as_advanced(GSTREAMER_LIBRARY GSTREAMER_INCLUDE_DIR) + + +# Find additional libraries +include(MacroFindGStreamerLibrary) + +macro(_find_gst_component _name _header) + find_gstreamer_library(${_name} ${_header} ${GSTREAMER_ABI_VERSION}) + set(_GSTREAMER_EXTRA_VARIABLES ${_GSTREAMER_EXTRA_VARIABLES} + GSTREAMER_${_name}_LIBRARY GSTREAMER_${_name}_INCLUDE_DIR) +endmacro() + +foreach(_component ${GStreamer_FIND_COMPONENTS}) + if (${_component} STREQUAL "base") + _find_gst_component(BASE gstbasesink.h) + elseif (${_component} STREQUAL "check") + _find_gst_component(CHECK gstcheck.h) + elseif (${_component} STREQUAL "controller") + _find_gst_component(CONTROLLER gstcontroller.h) + elseif (${_component} STREQUAL "dataprotocol") + _find_gst_component(DATAPROTOCOL dataprotocol.h) + elseif (${_component} STREQUAL "net") + _find_gst_component(NET gstnet.h) + else() + message (AUTHOR_WARNING "FindGStreamerPluginsBase.cmake: Invalid component \"${_component}\" was specified") + endif() +endforeach() + + +# Version check +if (GStreamer_FIND_VERSION) + if (PKG_GSTREAMER_FOUND) + if("${PKG_GSTREAMER_VERSION}" VERSION_LESS "${GStreamer_FIND_VERSION}") + message(STATUS "Found GStreamer version ${PKG_GSTREAMER_VERSION}, but at least version ${GStreamer_FIND_VERSION} is required") + set(GSTREAMER_VERSION_COMPATIBLE FALSE) + else() + set(GSTREAMER_VERSION_COMPATIBLE TRUE) + endif() + elseif(GSTREAMER_INCLUDE_DIR) + include(CheckCXXSourceCompiles) + + set(CMAKE_REQUIRED_INCLUDES ${GSTREAMER_INCLUDE_DIR}) + string(REPLACE "." "," _comma_version ${GStreamer_FIND_VERSION}) + # Hack to invalidate the cached value + set(GSTREAMER_VERSION_COMPATIBLE GSTREAMER_VERSION_COMPATIBLE) + + check_cxx_source_compiles(" +#define G_BEGIN_DECLS +#define G_END_DECLS +#include <gst/gstversion.h> + +#if GST_CHECK_VERSION(${_comma_version}) +int main() { return 0; } +#else +# error \"GStreamer version incompatible\" +#endif +" GSTREAMER_VERSION_COMPATIBLE) + + if (NOT GSTREAMER_VERSION_COMPATIBLE) + message(STATUS "GStreamer ${GStreamer_FIND_VERSION} is required, but the version found is older") + endif() + else() + # We didn't find gstreamer at all + set(GSTREAMER_VERSION_COMPATIBLE FALSE) + endif() +else() + # No version constrain was specified, thus we consider the version compatible + set(GSTREAMER_VERSION_COMPATIBLE TRUE) +endif() + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GStreamer DEFAULT_MSG + GSTREAMER_LIBRARY GSTREAMER_INCLUDE_DIR + GSTREAMER_VERSION_COMPATIBLE ${_GSTREAMER_EXTRA_VARIABLES}) diff --git a/cmake/modules/FindGStreamerPlugins.cmake b/cmake/modules/FindGStreamerPlugins.cmake deleted file mode 100644 index 9e7a4d0..0000000 --- a/cmake/modules/FindGStreamerPlugins.cmake +++ /dev/null @@ -1,112 +0,0 @@ -# - Try to find GStreamer_Plugins -# Once done this will define -# -# GSTREAMERPLUGINSBASE_FOUND - system has GStreamer_Plugins -# GSTREAMERPLUGINSBASE_INCLUDE_DIRS - the GStreamer_Plugins include directories -# GSTREAMERPLUGINSBASE_LIBRARIES - the libraries needed to use GStreamer_Plugins -# -# The following variables are set for each plugin PLUGINNAME: -# -# GSTREAMER_PLUGIN_PLUGINNAME_FOUND - plugin is found -# GSTREAMER_PLUGIN_PLUGINNAME_INCLUDE_DIR - plugin include directory -# GSTREAMER_PLUGIN_PLUGINNAME_LIBRARY - the library needed to use plugin -# -# (c)2009 Nokia Corporation -# (c)2010 Yury G. Kudryashov <urkud@ya.ru> - -FIND_PACKAGE(PkgConfig REQUIRED) - -IF (NOT WIN32) - # don't make this check required - otherwise you can't use macro_optional_find_package on this one - PKG_CHECK_MODULES( PKG_GSTREAMER_PLUGINSBASE gstreamer-plugins-base-0.10 ) -ENDIF (NOT WIN32) - -MACRO(MACRO_FIND_GSTREAMER_PLUGIN _plugin _header) - STRING(TOUPPER ${_plugin} _upper) - IF (NOT WIN32) - # don't make this check required - otherwise you can't use macro_optional_find_package on this one - PKG_CHECK_MODULES( PKG_GSTREAMER_${_upper} gstreamer-${_plugin}-0.10 ) - ENDIF (NOT WIN32) - - FIND_LIBRARY(GSTREAMER_PLUGIN_${_upper}_LIBRARY NAMES gst${_plugin}-0.10 - PATHS - ${PKG_GSTREAMER_PLUGINSBASE_LIBRARY_DIRS} - ${PKG_GSTREAMER_${_upper}_LIBRARY_DIRS} - ) - - FIND_PATH(GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR - NAMES gst/${_plugin}/${_header} - PATHS - ${PKG_GSTREAMER_PLUGINSBASE_INCLUDE_DIRS} - ${PKG_GSTREAMER_${_upper}_INCLUDE_DIRS} - ) - - IF(GSTREAMER_PLUGIN_${_upper}_LIBRARY AND GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR) - SET(GSTREAMER_PLUGIN_${_upper}_FOUND TRUE) - LIST(APPEND GSTREAMERPLUGINSBASE_INCLUDE_DIRS GSTREAMER_${_upper}_INCLUDE_DIR) - LIST(APPEND GSTREAMERPLUGINSBASE_LIBRARIES GSTREAMER_${_upper}_LIBRARY) - ELSE(GSTREAMER_PLUGIN_${_upper}_LIBRARY AND GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR) - MESSAGE(STATUS "Could not find ${_plugin} plugin") - MESSAGE(STATUS "${_upper} library: ${GSTREAMER_${_upper}_LIBRARY}") - MESSAGE(STATUS "${_upper} include dir: ${GSTREAMER_${_upper}_INCLUDE_DIR}") - SET(GSTREAMER_PLUGIN_${_upper}_FOUND FALSE) - SET(GSTREAMER_PLUGIN_${_upper}_LIBRARY GSTREAMER_${_upper}_LIBRARY-NOTFOUND) - SET(GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR GSTREAMER_${_upper}_INCLUDE_DIR-NOTFOUND) - SET(GSTREAMERPLUGINSBASE_FOUND FALSE) - ENDIF(GSTREAMER_PLUGIN_${_upper}_LIBRARY AND GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR) - - MARK_AS_ADVANCED(GSTREAMER_PLUGIN_${_upper}_LIBRARY - GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR) -ENDMACRO(MACRO_FIND_GSTREAMER_PLUGIN) - -# -# Base plugins: -# audio -# cdda -# netbuffer -# pbutils -# riff -# rtp -# rtsp -# sdp -# tag -# video -# -# The gstinterfaces-0.10 library is found by FindGStreamer.cmake -# - -SET(GSTREAMER_PLUGINSBASE_FOUND TRUE) -MACRO_FIND_GSTREAMER_PLUGIN(audio audio.h) -MACRO_FIND_GSTREAMER_PLUGIN(cdda gstcddabasesrc.h) -MACRO_FIND_GSTREAMER_PLUGIN(netbuffer gstnetbuffer.h) -MACRO_FIND_GSTREAMER_PLUGIN(pbutils pbutils.h) -MACRO_FIND_GSTREAMER_PLUGIN(riff riff-ids.h) -MACRO_FIND_GSTREAMER_PLUGIN(rtp gstrtpbuffer.h) -MACRO_FIND_GSTREAMER_PLUGIN(rtsp gstrtspdefs.h) -MACRO_FIND_GSTREAMER_PLUGIN(sdp gstsdp.h) -MACRO_FIND_GSTREAMER_PLUGIN(tag tag.h) -MACRO_FIND_GSTREAMER_PLUGIN(video video.h) - -IF (GSTREAMERPLUGINSBASE_FOUND) - LIST(REMOVE_DUPLICATES GSTREAMERPLUGINSBASE_LIBRARIES) - LIST(REMOVE_DUPLICATES GSTREAMERPLUGINSBASE_INCLUDE_DIRS) - IF (NOT GStreamer_Plugins_FIND_QUIETLY) - MESSAGE(STATUS "Found GStreamer Plugins: - ${GSTREAMER_PLUGIN_AUDIO_LIBRARIES} - ${GSTREAMER_PLUGIN_CDDA_LIBRARIES} - ${GSTREAMER_PLUGIN_NETBUFFER_LIBRARIES} - ${GSTREAMER_PLUGIN_PBUTILS_LIBRARIES} - ${GSTREAMER_PLUGIN_RIFF_LIBRARIES} - ${GSTREAMER_PLUGIN_RTP_LIBRARIES} - ${GSTREAMER_PLUGIN_RTSP_LIBRARIES} - ${GSTREAMER_PLUGIN_SDP_LIBRARIES} - ${GSTREAMER_PLUGIN_TAG_LIBRARIES} - ${GSTREAMER_PLUGIN_VIDEO_LIBRARIES}") - ENDIF (NOT GStreamer_Plugins_FIND_QUIETLY) -ELSE (GSTREAMERPLUGINSBASE_FOUND) - SET(GSTREAMERPLUGINSBASE_LIBRARIES GSTREAMERPLUGINSBASE_LIBRARIES-NOTFOUND) - SET(GSTREAMERPLUGINSBASE_INCLUDE_DIRS GSTREAMERPLUGINSBASE_INCLUDE_DIRS-NOTFOUND) - IF (GStreamer_Plugins_FIND_REQUIRED) - MESSAGE(SEND_ERROR "Could NOT find GStreamer Plugins") - ENDIF (GStreamer_Plugins_FIND_REQUIRED) -ENDIF (GSTREAMERPLUGINSBASE_FOUND) diff --git a/cmake/modules/FindGStreamerPluginsBase.cmake b/cmake/modules/FindGStreamerPluginsBase.cmake new file mode 100644 index 0000000..a795b27 --- /dev/null +++ b/cmake/modules/FindGStreamerPluginsBase.cmake @@ -0,0 +1,96 @@ +# - Try to find gst-plugins-base +# Once done this will define +# +# GSTREAMER_PLUGINS_BASE_FOUND - system has gst-plugins-base +# +# And for all the plugin libraries specified in the COMPONENTS +# of find_package, this module will define: +# +# GSTREAMER_<plugin_lib>_LIBRARY_FOUND - system has <plugin_lib> +# GSTREAMER_<plugin_lib>_LIBRARY - the <plugin_lib> library +# GSTREAMER_<plugin_lib>_INCLUDE_DIR - the <plugin_lib> include directory +# +# Copyright (c) 2010, Collabora Ltd. +# @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +set(GSTREAMER_ABI_VERSION "0.10") + + +# Find the pkg-config file for doing the version check +find_package(PkgConfig) + +if (PKG_CONFIG_FOUND) + pkg_check_modules(PKG_GSTREAMER_PLUGINS_BASE gstreamer-plugins-base-${GSTREAMER_ABI_VERSION}) +endif() + + +# Find the plugin libraries +include(MacroFindGStreamerLibrary) + +macro(_find_gst_plugins_base_component _name _header) + find_gstreamer_library(${_name} ${_header} ${GSTREAMER_ABI_VERSION}) + set(_GSTREAMER_PLUGINS_BASE_EXTRA_VARIABLES ${_GSTREAMER_PLUGINS_BASE_EXTRA_VARIABLES} + GSTREAMER_${_name}_LIBRARY GSTREAMER_${_name}_INCLUDE_DIR) +endmacro() + +foreach(_component ${GStreamerPluginsBase_FIND_COMPONENTS}) + if (${_component} STREQUAL "app") + _find_gst_plugins_base_component(APP gstappsrc.h) + elseif (${_component} STREQUAL "audio") + _find_gst_plugins_base_component(AUDIO audio.h) + elseif (${_component} STREQUAL "cdda") + _find_gst_plugins_base_component(CDDA gstcddabasesrc.h) + elseif (${_component} STREQUAL "fft") + _find_gst_plugins_base_component(FFT gstfft.h) + elseif (${_component} STREQUAL "floatcast") + _find_gst_plugins_base_component(FLOATCAST floatcast.h) + elseif (${_component} STREQUAL "interfaces") + _find_gst_plugins_base_component(INTERFACES xoverlay.h) + elseif (${_component} STREQUAL "netbuffer") + _find_gst_plugins_base_component(NETBUFFER gstnetbuffer.h) + elseif (${_component} STREQUAL "riff") + _find_gst_plugins_base_component(RIFF riff-ids.h) + elseif (${_component} STREQUAL "rtp") + _find_gst_plugins_base_component(RTP gstrtpbuffer.h) + elseif (${_component} STREQUAL "rtsp") + _find_gst_plugins_base_component(RTSP gstrtspdefs.h) + elseif (${_component} STREQUAL "sdp") + _find_gst_plugins_base_component(SDP gstsdp.h) + elseif (${_component} STREQUAL "tag") + _find_gst_plugins_base_component(TAG tag.h) + elseif (${_component} STREQUAL "pbutils") + _find_gst_plugins_base_component(PBUTILS pbutils.h) + elseif (${_component} STREQUAL "video") + _find_gst_plugins_base_component(VIDEO video.h) + else() + message (AUTHOR_WARNING "FindGStreamer.cmake: Invalid component \"${_component}\" was specified") + endif() +endforeach() + + +# Version check +if (GStreamerPluginsBase_FIND_VERSION) + if (PKG_GSTREAMER_PLUGINS_BASE_FOUND) + if("${PKG_GSTREAMER_PLUGINS_BASE_VERSION}" VERSION_LESS "${GStreamerPluginsBase_FIND_VERSION}") + message(STATUS "Found gst-plugins-base version ${PKG_GSTREAMER_PLUGINS_BASE_VERSION}, but at least version ${GStreamerPluginsBase_FIND_VERSION} is required") + set(GSTREAMER_PLUGINS_BASE_VERSION_COMPATIBLE FALSE) + else() + set(GSTREAMER_PLUGINS_BASE_VERSION_COMPATIBLE TRUE) + endif() + else() + # We can't make any version checks without pkg-config, just assume version is compatible and hope... + set(GSTREAMER_PLUGINS_BASE_VERSION_COMPATIBLE TRUE) + endif() +else() + # No version constrain was specified, thus we consider the version compatible + set(GSTREAMER_PLUGINS_BASE_VERSION_COMPATIBLE TRUE) +endif() + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GStreamerPluginsBase DEFAULT_MSG + GSTREAMER_PLUGINS_BASE_VERSION_COMPATIBLE + ${_GSTREAMER_PLUGINS_BASE_EXTRA_VARIABLES}) diff --git a/cmake/modules/MacroFindGStreamerLibrary.cmake b/cmake/modules/MacroFindGStreamerLibrary.cmake new file mode 100644 index 0000000..31ede28 --- /dev/null +++ b/cmake/modules/MacroFindGStreamerLibrary.cmake @@ -0,0 +1,55 @@ +# - macro find_gstreamer_library +# +# Copyright (c) 2010, Collabora Ltd. +# @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +macro(find_gstreamer_library _name _header _abi_version) + string(TOLOWER ${_name} _lower_name) + string(TOUPPER ${_name} _upper_name) + + if (GSTREAMER_${_upper_name}_LIBRARY AND GSTREAMER_${_upper_name}_INCLUDE_DIR) + set(_GSTREAMER_${_upper_name}_QUIET TRUE) + else() + set(_GSTREAMER_${_upper_name}_QUIET FALSE) + endif() + + if (PKG_CONFIG_FOUND) + pkg_check_modules(PKG_GSTREAMER_${_upper_name} gstreamer-${_lower_name}-${_abi_version}) + endif() + + find_library(GSTREAMER_${_upper_name}_LIBRARY + NAMES gst${_lower_name}-${_abi_version} + PATHS ${PKG_GSTREAMER_${_upper_name}_LIBRARY_DIRS} + ) + + find_path(GSTREAMER_${_upper_name}_INCLUDE_DIR + gst/${_lower_name}/${_header} + PATHS ${PKG_GSTREAMER_${_upper_name}_INCLUDE_DIRS} + PATH_SUFFIXES gstreamer-${_abi_version} + ) + + if (GSTREAMER_${_upper_name}_LIBRARY AND GSTREAMER_${_upper_name}_INCLUDE_DIR) + set(GSTREAMER_${_upper_name}_LIBRARY_FOUND TRUE) + else() + set(GSTREAMER_${_upper_name}_LIBRARY_FOUND FALSE) + endif() + + if (NOT _GSTREAMER_${_upper_name}_QUIET) + if (GSTREAMER_${_upper_name}_LIBRARY) + message(STATUS "Found GSTREAMER_${_upper_name}_LIBRARY: ${GSTREAMER_${_upper_name}_LIBRARY}") + else() + message(STATUS "Could NOT find GSTREAMER_${_upper_name}_LIBRARY") + endif() + + if (GSTREAMER_${_upper_name}_INCLUDE_DIR) + message(STATUS "Found GSTREAMER_${_upper_name}_INCLUDE_DIR: ${GSTREAMER_${_upper_name}_INCLUDE_DIR}") + else() + message(STATUS "Could NOT find GSTREAMER_${_upper_name}_INCLUDE_DIR") + endif() + endif() + + mark_as_advanced(GSTREAMER_${_upper_name}_LIBRARY GSTREAMER_${_upper_name}_INCLUDE_DIR) +endmacro() diff --git a/elements/CMakeLists.txt b/elements/CMakeLists.txt index 7a75a7e..199d32b 100644 --- a/elements/CMakeLists.txt +++ b/elements/CMakeLists.txt @@ -1,12 +1,12 @@ -if (GSTREAMER_PLUGIN_VIDEO_FOUND) +if (GSTREAMER_VIDEO_LIBRARY_FOUND) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDE_DIR} ${GSTREAMER_INCLUDE_DIR} - ${GLIB2_INCLUDE_DIR} ${GSTREAMER_PLUGIN_VIDEO_INCLUDE_DIR}) + ${GLIB2_INCLUDE_DIR} ${GSTREAMER_VIDEO_INCLUDE_DIR}) add_definitions(-DGST_DISABLE_DEPRECATED) automoc4_add_library(gstqwidgetvideosink MODULE gstqwidgetvideosink.cpp) -target_link_libraries(gstqwidgetvideosink ${QT_QTGUI_LIBRARY} ${GSTREAMER_LIBRARIES} - ${GOBJECT_LIBRARIES} ${GSTREAMER_PLUGIN_VIDEO_LIBRARY}) +target_link_libraries(gstqwidgetvideosink ${QT_QTGUI_LIBRARY} ${GSTREAMER_LIBRARY} + ${GOBJECT_LIBRARIES} ${GSTREAMER_VIDEO_LIBRARY}) install(TARGETS gstqwidgetvideosink DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/gstreamer-0.10) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5596ab3..2a1aba3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -137,6 +137,7 @@ set(CODEGEN_INCLUDES # 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_DEPRECATED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QTGSTREAMER_FLAGS}") @@ -159,8 +160,8 @@ 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 ${QT_QTCORE_LIBRARY} ${GSTREAMER_LIBRARY} + ${GSTREAMER_INTERFACES_LIBRARY} ${GOBJECT_LIBRARIES}) target_link_libraries(QtGstreamer LINK_INTERFACE_LIBRARIES ${QT_QTCORE_LIBRARY}) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 9988e85..441c846 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QTGSTREAMER_FLAGS}") macro(qgst_test target) automoc4_add_executable(${target} "${target}.cpp") - target_link_libraries(${target} ${QT_QTTEST_LIBRARY} ${GSTREAMER_LIBRARIES} + target_link_libraries(${target} ${QT_QTTEST_LIBRARY} ${GSTREAMER_LIBRARY} ${GOBJECT_LIBRARIES} ${QTGSTREAMER_LIBRARIES}) add_test(NAME ${target} COMMAND ${target}) endmacro(qgst_test) |