build: borrow CMake modules from qt-gstreamer for Linux compatibility

Almost certainly breaks Windows compat, but will need to update it anyways to work with the newer GStreamer SDK.
This commit is contained in:
Joshua M. Doe 2012-06-13 06:41:44 -04:00
parent cca79973df
commit 7b8742afd8
9 changed files with 611 additions and 206 deletions

View File

@ -4,31 +4,47 @@ list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
project(gst-plugins-vision)
find_package (Gstreamer REQUIRED)
find_package (Glib2 REQUIRED)
include(MacroLogFeature)
find_package(GStreamer 0.10.29 COMPONENTS base)
macro_log_feature(GSTREAMER_FOUND "GStreamer" "Required to build gst-plugins-vision" "http://gstreamer.freedesktop.org/" TRUE "0.10.29")
macro_log_feature(GSTREAMER_BASE_LIBRARY_FOUND "GStreamer base library" "Required to build gst-plugins-vision" "http://gstreamer.freedesktop.org/" TRUE "0.10.29")
find_package(GStreamerPluginsBase 0.10.29 COMPONENTS video)
macro_log_feature(GSTREAMER_VIDEO_LIBRARY_FOUND "GStreamer video library" "Required to build several video plugins" "http://gstreamer.freedesktop.org/" FALSE "0.10.29")
find_package(GLIB2)
macro_log_feature(GLIB2_FOUND "GLib" "Required to build gst-plugins-vision" "http://www.gtk.org/" TRUE)
find_package(GObject)
macro_log_feature(GOBJECT_FOUND "GObject" "Required to build gst-plugins-vision" "http://www.gtk.org/" TRUE)
find_package(NIIMAQ)
macro_log_feature(NIIMAQ_FOUND "NI-IMAQ" "Required to build National Instruments IMAQ source element" "http://www.ni.com/" FALSE)
find_package(FreeImage)
macro_log_feature(FREEIMAGE_FOUND "FreeImage" "Required to build FreeImage plugin" "http://freeimage.sourceforge.net/" FALSE)
find_package(OpenCV)
macro_log_feature(OPENCV_FOUND "OpenCV" "Required to build sensorfx plugin" "http://opencv.willowgarage.com/" FALSE)
find_package(Euresys)
macro_log_feature(EURESYS_FOUND "Euresys" "Required to build Euresys source element" "http://www.euresys.com/" FALSE)
find_package(IOtechDaqX)
macro_log_feature(IOTECHDAQX_FOUND "IOtech DaqX" "Required to build IOtech DaqX source element" "http://www.euresys.com/" FALSE)
find_package(Phoenix)
# conditional required packages
include (CheckIncludeFiles)
CHECK_INCLUDE_FILES ("${GSTREAMER_INCLUDE_DIR}/gst/gstconfig.h" GST_USING_BINARY_REGISTRY)
if (NOT GST_USING_BINARY_REGISTRY)
find_package (LIBXML2)
find_package (LIBICONV)
include_directories (AFTER
${LIBXML2_INCLUDE_DIR}
${LIBICONV_INCLUDE_DIR})
endif (NOT GST_USING_BINARY_REGISTRY)
macro_log_feature(PHOENIX_FOUND "Active Silicon Phoenix" "Required to build Active Silicon Phoenix source element" "http://www.activesilicon.com/" FALSE)
# Setup common environment
include_directories(
.
${GSTREAMER_INCLUDE_DIR}
${GLIB2_INCLUDE_DIR})
add_definitions(-DGST_DISABLE_XML -DGST_DISABLE_LOADSAVE)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
file(TO_CMAKE_PATH "${GSTREAMER_INCLUDE_DIR}/../.." PREFIX)
@ -36,6 +52,9 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
${PREFIX} CACHE PATH "Directory to install plugins, under lib/gstreamer-0.10" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Build the plugins
add_subdirectory(ext)
add_subdirectory(gst)
add_subdirectory(sys)
macro_display_feature_log()

View File

@ -0,0 +1,64 @@
# - Try to find the GLIB2 libraries
# Once done this will define
#
# GLIB2_FOUND - system has glib2
# GLIB2_INCLUDE_DIR - the glib2 include directory
# GLIB2_LIBRARIES - glib2 library
# Copyright (c) 2008 Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
# Already in cache, be silent
set(GLIB2_FIND_QUIETLY TRUE)
endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
if (NOT WIN32)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PKG_GLIB REQUIRED glib-2.0)
endif(NOT WIN32)
find_path(GLIB2_MAIN_INCLUDE_DIR glib.h
PATH_SUFFIXES glib-2.0
HINTS ${PKG_GLIB_INCLUDE_DIRS} ${PKG_GLIB_INCLUDEDIR})
# search the glibconfig.h include dir under the same root where the library is found
find_library(GLIB2_LIBRARIES
NAMES glib-2.0
HINTS ${PKG_GLIB_LIBRARY_DIRS} ${PKG_GLIB_LIBDIR})
find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
PATH_SUFFIXES glib-2.0/include ../lib/glib-2.0/include
HINTS ${PKG_GLIB_INCLUDE_DIRS} ${PKG_GLIB_LIBRARIES} ${CMAKE_SYSTEM_LIBRARY_PATH})
set(GLIB2_INCLUDE_DIR ${GLIB2_MAIN_INCLUDE_DIR})
# not sure if this include dir is optional or required
# for now it is optional
if(GLIB2_INTERNAL_INCLUDE_DIR)
set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} ${GLIB2_INTERNAL_INCLUDE_DIR})
endif(GLIB2_INTERNAL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)
find_program(GLIB2_GENMARSHAL_UTIL glib-genmarshal)
macro(glib2_genmarshal output_name)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/genmarshal_tmp)
foreach(_declaration ${ARGN})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/genmarshal_tmp "${_declaration}\n")
endforeach()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${output_name}.h ${CMAKE_CURRENT_BINARY_DIR}/${output_name}.c
COMMAND ${GLIB2_GENMARSHAL_UTIL} --header genmarshal_tmp > ${output_name}.h
COMMAND ${GLIB2_GENMARSHAL_UTIL} --body genmarshal_tmp > ${output_name}.c
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endmacro()

View File

@ -0,0 +1,63 @@
# - Try to find GObject
# Once done this will define
#
# GOBJECT_FOUND - system has GObject
# GOBJECT_INCLUDE_DIR - the GObject include directory
# GOBJECT_LIBRARIES - the libraries needed to use GObject
# GOBJECT_DEFINITIONS - Compiler switches required for using GObject
# Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
# in cache already
SET(GObject_FIND_QUIETLY TRUE)
ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
SET(GObject_FIND_QUIETLY FALSE)
ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
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
PKG_CHECK_MODULES(PKG_GOBJECT2 REQUIRED gobject-2.0)
SET(GOBJECT_DEFINITIONS ${PKG_GOBJECT2_CFLAGS})
ENDIF (NOT WIN32)
FIND_PATH(GOBJECT_INCLUDE_DIR gobject/gobject.h
HINTS ${PKG_GOBJECT2_INCLUDE_DIRS} ${PKG_GOBJECT2_INCLUDEDIR}
PATHS /usr/include/glib-2.0/
PATH_SUFFIXES glib-2.0
)
FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
HINTS
${PKG_GOBJECT2_LIBRARY_DIRS}
${PKG_GOBJECT2_LIBDIR}
)
FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
HINTS
${PKG_GOBJECT2_LIBRARY_DIRS}
${PKG_GOBJECT2_LIBDIR}
)
FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
HINTS
${PKG_GOBJECT2_LIBRARY_DIRS}
${PKG_GOBJECT2_LIBDIR}
)
FIND_LIBRARY(_GLibs NAMES glib-2.0
HINTS
${PKG_GOBJECT2_LIBRARY_DIRS}
${PKG_GOBJECT2_LIBDIR}
)
SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs})
MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GObject DEFAULT_MSG GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)

View File

@ -0,0 +1,135 @@
# - Try to find GStreamer
# Once done this will define
#
# GSTREAMER_FOUND - system has GStreamer
# GSTREAMER_INCLUDE_DIR - the GStreamer include directory
# GSTREAMER_LIBRARY - the main GStreamer library
# GSTREAMER_PLUGIN_DIR - the GStreamer plugin directory
#
# 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.
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})
exec_program(${PKG_CONFIG_EXECUTABLE}
ARGS --variable pluginsdir gstreamer-${GSTREAMER_ABI_VERSION}
OUTPUT_VARIABLE PKG_GSTREAMER_PLUGIN_DIR)
endif()
find_library(GSTREAMER_LIBRARY
NAMES gstreamer-${GSTREAMER_ABI_VERSION}
HINTS ${PKG_GSTREAMER_LIBRARY_DIRS} ${PKG_GSTREAMER_LIBDIR}
PATH_SUFFIXES .libs)
find_path(GSTREAMER_INCLUDE_DIR
gst/gst.h
HINTS ${PKG_GSTREAMER_INCLUDE_DIRS} ${PKG_GSTREAMER_INCLUDEDIR}
PATH_SUFFIXES gstreamer-${GSTREAMER_ABI_VERSION})
if (PKG_GSTREAMER_PLUGIN_DIR)
set(_GSTREAMER_PLUGIN_DIR ${PKG_GSTREAMER_PLUGIN_DIR})
else()
get_filename_component(_GSTREAMER_LIB_DIR ${GSTREAMER_LIBRARY} PATH)
set(_GSTREAMER_PLUGIN_DIR ${_GSTREAMER_LIB_DIR}/gstreamer-${GSTREAMER_ABI_VERSION})
endif()
set(GSTREAMER_PLUGIN_DIR ${_GSTREAMER_PLUGIN_DIR}
CACHE PATH "The path to the gstreamer plugins installation directory")
mark_as_advanced(GSTREAMER_LIBRARY GSTREAMER_INCLUDE_DIR GSTREAMER_PLUGIN_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})

View File

@ -0,0 +1,94 @@
# - 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 "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})

View File

@ -1,53 +0,0 @@
if (NOT GLIB2_DIR)
set (GLIB2_DIR "" CACHE PATH "Directory containing glib-2 includes and libraries")
endif ()
FILE(TO_CMAKE_PATH "$ENV{GLIB2_DIR}" TRY1_DIR)
FILE(TO_CMAKE_PATH "${GLIB2_DIR}" TRY2_DIR)
FILE(GLOB GLIB2_DIR ${TRY1_DIR} ${TRY2_DIR})
FIND_PATH(GLIB_glib_2_INCLUDE_DIR glib.h
PATHS ${GLIB2_DIR}/include ${GLIB2_DIR}/include/glib-2.0 /usr/local/include/glib-2.0 /usr/include/glib-2.0 /opt/local/include/glib-2.0
ENV INCLUDE DOC "Directory containing glib.h include file")
mark_as_advanced (GLIB_glib_2_INCLUDE_DIR)
FIND_PATH(GLIB_glibconfig_2_INCLUDE_DIR glibconfig.h
PATHS ${GLIB2_DIR}/include ${GLIB2_DIR}/include/glib-2.0 ${GLIB2_DIR}/lib/include ${GLIB2_DIR}/lib/glib-2.0/include /usr/local/include/glib-2.0 /usr/include/glib-2.0 /usr/lib/glib-2.0/include /usr/local/lib/glib-2.0/include /opt/local/lib/glib-2.0/include
ENV INCLUDE DOC "Directory containing glibconfig.h include file")
mark_as_advanced (GLIB_glibconfig_2_INCLUDE_DIR)
FIND_LIBRARY(GLIB_glib_2_LIBRARY NAMES glib-2.0
PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib /opt/local/lib
ENV LIB
DOC "glib library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
mark_as_advanced (GLIB_glib_2_LIBRARY)
FIND_LIBRARY(GLIB_gmodule_2_LIBRARY NAMES gmodule-2.0
PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib /opt/local/lib
ENV LIB
DOC "gmodule library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
mark_as_advanced (GLIB_gmodule_2_LIBRARY)
FIND_LIBRARY(GLIB_gobject_2_LIBRARY NAMES gobject-2.0
PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib /opt/local/lib
ENV LIB
DOC "gobject library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
mark_as_advanced (GLIB_gobject_2_LIBRARY)
FIND_LIBRARY(GLIB_gthread_2_LIBRARY NAMES gthread-2.0
PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib /opt/local/lib
ENV LIB
DOC "gthread library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
mark_as_advanced (GLIB_gthread_2_LIBRARY)
IF (GLIB_glib_2_INCLUDE_DIR AND GLIB_glibconfig_2_INCLUDE_DIR AND GLIB_glib_2_LIBRARY AND GLIB_gmodule_2_LIBRARY AND GLIB_gobject_2_LIBRARY AND GLIB_gthread_2_LIBRARY)
SET(GLIB2_INCLUDE_DIR ${GLIB_glib_2_INCLUDE_DIR} ${GLIB_glibconfig_2_INCLUDE_DIR})
list(REMOVE_DUPLICATES GLIB2_INCLUDE_DIR)
SET(GLIB2_LIBRARIES ${GLIB_glib_2_LIBRARY} ${GLIB_gmodule_2_LIBRARY} ${GLIB_gobject_2_LIBRARY} ${GLIB_gthread_2_LIBRARY})
list(REMOVE_DUPLICATES GLIB2_LIBRARIES)
SET(GLIB2_FOUND TRUE)
ENDIF (GLIB_glib_2_INCLUDE_DIR AND GLIB_glibconfig_2_INCLUDE_DIR AND GLIB_glib_2_LIBRARY AND GLIB_gmodule_2_LIBRARY AND GLIB_gobject_2_LIBRARY AND GLIB_gthread_2_LIBRARY)

View File

@ -1,123 +0,0 @@
# - Try to find GStreamer
# Once done this will define
#
# 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
# Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
# Copyright (c) 2010, United States Government, Joshua M. Doe <oss@nvl.army.mil>
#
# 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)
SET (GSTREAMER_DIR ${GSTREAMER_DIR} CACHE PATH "Directory containing gstreamer")
IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_GSTREAMER QUIET gstreamer-0.10)
#MESSAGE(STATUS "DEBUG: GStreamer include directory = ${GSTREAMER_INCLUDE_DIRS}")
#MESSAGE(STATUS "DEBUG: GStreamer link directory = ${GSTREAMER_LIBRARY_DIRS}")
#MESSAGE(STATUS "DEBUG: GStreamer CFlags = ${GSTREAMER_CFLAGS_OTHER}")
SET(GSTREAMER_DEFINITIONS ${PC_GSTREAMER_CFLAGS_OTHER})
ELSE (NOT WIN32)
IF (NOT GSTREAMER_DIR)
SET (GSTREAMER_DIR "C:/gstreamer")
ENDIF (NOT GSTREAMER_DIR)
ENDIF (NOT WIN32)
FIND_PATH(GSTREAMER_INCLUDE_DIR gst/gst.h
PATHS
${GSTREAMER_DIR}/include/gstreamer-0.10
${PC_GSTREAMER_INCLUDEDIR}
${PC_GSTREAMER_INCLUDE_DIRS}
#PATH_SUFFIXES gst
)
FIND_LIBRARY(GSTREAMER_LIBRARIES NAMES gstreamer-0.10
PATHS
${GSTREAMER_DIR}/lib
${PC_GSTREAMER_LIBDIR}
${PC_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_BASE_LIBRARY NAMES gstbase-0.10
PATHS
${GSTREAMER_DIR}/lib
${PC_GSTREAMER_LIBDIR}
${PC_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_CONTROLLER_LIBRARY NAMES gstcontroller-0.10
PATHS
${GSTREAMER_DIR}/lib
${PC_GSTREAMER_LIBDIR}
${PC_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_INTERFACE_LIBRARY NAMES gstinterfaces-0.10
PATHS
${GSTREAMER_DIR}/lib
${PC_GSTREAMER_LIBDIR}
${PC_GSTREAMER_LIBRARY_DIRS}
)
FIND_LIBRARY(GSTREAMER_VIDEO_LIBRARY NAMES gstvideo-0.10
PATHS
${GSTREAMER_DIR}/lib
${PC_GSTREAMER_LIBDIR}
${PC_GSTREAMER_LIBRARY_DIRS}
)
IF (GSTREAMER_INCLUDE_DIR)
#MESSAGE(STATUS "DEBUG: Found GStreamer include dir: ${GSTREAMER_INCLUDE_DIR}")
ELSE (GSTREAMER_INCLUDE_DIR)
MESSAGE(STATUS "GStreamer: WARNING: include dir not found")
ENDIF (GSTREAMER_INCLUDE_DIR)
IF (GSTREAMER_LIBRARIES)
#MESSAGE(STATUS "DEBUG: Found GStreamer library: ${GSTREAMER_LIBRARIES}")
ELSE (GSTREAMER_LIBRARIES)
MESSAGE(STATUS "GStreamer: WARNING: library not found")
ENDIF (GSTREAMER_LIBRARIES)
IF (GSTREAMER_BASE_LIBRARY)
#MESSAGE(STATUS "DEBUG: Found GStreamer base library: ${GSTREAMER_BASE_LIBRARY}")
ELSE (GSTREAMER_BASE_LIBRARY)
MESSAGE(STATUS "GStreamer: WARNING: base library not found")
ENDIF (GSTREAMER_BASE_LIBRARY)
IF (GSTREAMER_CONTROLLER_LIBRARY)
#MESSAGE(STATUS "DEBUG: Found GStreamer controller library: ${GSTREAMER_CONTROLLER_LIBRARY}")
ELSE (GSTREAMER_CONTROLLER_LIBRARY)
MESSAGE(STATUS "GStreamer: WARNING: controller library not found")
ENDIF (GSTREAMER_CONTROLLER_LIBRARY)
IF (GSTREAMER_INTERFACE_LIBRARY)
#MESSAGE(STATUS "DEBUG: Found GStreamer interface library: ${GSTREAMER_INTERFACE_LIBRARY}")
ELSE (GSTREAMER_INTERFACE_LIBRARY)
MESSAGE(STATUS "GStreamer: WARNING: interface library not found")
ENDIF (GSTREAMER_INTERFACE_LIBRARY)
IF (GSTREAMER_VIDEO_LIBRARY)
#MESSAGE(STATUS "DEBUG: Found GStreamer video library: ${GSTREAMER_VIDEO_LIBRARY}")
ELSE (GSTREAMER_VIDEO_LIBRARY)
MESSAGE(STATUS "GStreamer: WARNING: video library not found")
ENDIF (GSTREAMER_VIDEO_LIBRARY)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG GSTREAMER_LIBRARIES GSTREAMER_INCLUDE_DIR GSTREAMER_BASE_LIBRARY GSTREAMER_CONTROLLER_LIBRARY GSTREAMER_INTERFACE_LIBRARY GSTREAMER_VIDEO_LIBRARY)
MARK_AS_ADVANCED(GSTREAMER_INCLUDE_DIR GSTREAMER_LIBRARIES GSTREAMER_BASE_LIBRARY GSTREAMER_CONTROLLER_LIBRARY GSTREAMER_INTERFACE_LIBRARY GSTREAMER_VIDEO_LIBRARY)

View File

@ -0,0 +1,60 @@
# - 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_path(GSTREAMER_${_upper_name}_INCLUDE_DIR
gst/${_lower_name}/${_header}
HINTS ${PKG_GSTREAMER_${_upper_name}_INCLUDE_DIRS}
${PKG_GSTREAMER_${_upper_name}_INCLUDEDIR}
PATH_SUFFIXES gstreamer-${_abi_version}
)
find_library(GSTREAMER_${_upper_name}_LIBRARY
NAMES gst${_lower_name}-${_abi_version}
HINTS ${PKG_GSTREAMER_${_upper_name}_LIBRARY_DIRS}
${PKG_GSTREAMER_${_upper_name}_LIBDIR}
${GSTREAMER_${_upper_name}_INCLUDE_DIR}
PATH_SUFFIXES ./ .libs gst/${_lower_name}/.libs
)
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()

View File

@ -0,0 +1,146 @@
# This file defines the Feature Logging macros.
#
# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
# Logs the information so that it can be displayed at the end
# of the configure run
# VAR : TRUE or FALSE, indicating whether the feature is supported
# FEATURE: name of the feature, e.g. "libjpeg"
# DESCRIPTION: description what this feature provides
# URL: home page
# REQUIRED: TRUE or FALSE, indicating whether the featue is required
# MIN_VERSION: minimum version number. empty string if unneeded
# COMMENTS: More info you may want to provide. empty string if unnecessary
#
# MACRO_DISPLAY_FEATURE_LOG()
# Call this to display the collected results.
# Exits CMake with a FATAL error message if a required feature is missing
#
# Example:
#
# INCLUDE(MacroLogFeature)
#
# FIND_PACKAGE(JPEG)
# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
# ...
# MACRO_DISPLAY_FEATURE_LOG()
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2006, Allen Winter, <winter@kde.org>
# Copyright (c) 2009, Sebastian Trueg, <trueg@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT _macroLogFeatureAlreadyIncluded)
SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
IF (EXISTS ${_file})
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
IF (EXISTS ${_file})
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
IF (EXISTS ${_file})
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
SET(_macroLogFeatureAlreadyIncluded TRUE)
ENDIF (NOT _macroLogFeatureAlreadyIncluded)
MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
STRING(TOUPPER "${ARGV4}" _required)
SET(_minvers "${ARGV5}")
SET(_comments "${ARGV6}")
IF (${_var})
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
ELSE (${_var})
IF ("${_required}" STREQUAL "TRUE")
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
ELSE ("${_required}" STREQUAL "TRUE")
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
ENDIF ("${_required}" STREQUAL "TRUE")
ENDIF (${_var})
SET(_logtext " * ${_package}")
IF (NOT ${_var})
IF (${_minvers} MATCHES ".*")
SET(_logtext "${_logtext} (${_minvers} or higher)")
ENDIF (${_minvers} MATCHES ".*")
SET(_logtext "${_logtext} <${_url}>\n ")
ELSE (NOT ${_var})
SET(_logtext "${_logtext} - ")
ENDIF (NOT ${_var})
SET(_logtext "${_logtext}${_description}")
IF (NOT ${_var})
IF (${_comments} MATCHES ".*")
SET(_logtext "${_logtext}\n ${_comments}")
ENDIF (${_comments} MATCHES ".*")
# SET(_logtext "${_logtext}\n") #double-space missing features?
ENDIF (NOT ${_var})
FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
ENDMACRO(MACRO_LOG_FEATURE)
MACRO(MACRO_DISPLAY_FEATURE_LOG)
SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
SET(_printSummary TRUE)
ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
IF(_printSummary)
SET(_missingDeps 0)
IF (EXISTS ${_enabledFile})
FILE(READ ${_enabledFile} _enabled)
FILE(REMOVE ${_enabledFile})
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}")
ENDIF (EXISTS ${_enabledFile})
IF (EXISTS ${_disabledFile})
SET(_missingDeps 1)
FILE(READ ${_disabledFile} _disabled)
FILE(REMOVE ${_disabledFile})
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}")
ENDIF (EXISTS ${_disabledFile})
IF (EXISTS ${_missingFile})
SET(_missingDeps 1)
FILE(READ ${_missingFile} _requirements)
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}")
FILE(REMOVE ${_missingFile})
SET(_haveMissingReq 1)
ENDIF (EXISTS ${_missingFile})
IF (NOT ${_missingDeps})
SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.")
ENDIF (NOT ${_missingDeps})
MESSAGE(${_summary})
MESSAGE("-----------------------------------------------------------------------------\n")
IF(_haveMissingReq)
MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
ENDIF(_haveMissingReq)
ENDIF(_printSummary)
ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)