summaryrefslogtreecommitdiff
path: root/Source/cmake/FindGStreamer.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmake/FindGStreamer.cmake')
-rw-r--r--Source/cmake/FindGStreamer.cmake107
1 files changed, 54 insertions, 53 deletions
diff --git a/Source/cmake/FindGStreamer.cmake b/Source/cmake/FindGStreamer.cmake
index 542ebacb1..c7ab9530a 100644
--- a/Source/cmake/FindGStreamer.cmake
+++ b/Source/cmake/FindGStreamer.cmake
@@ -11,7 +11,7 @@
# GSTREAMER_BASE_INCLUDE_DIRS - gstreamer-base's include directory
# GSTREAMER_BASE_LIBRARIES - link to these to use gstreamer-base
#
-# Optionally, the COMPONENTS keyword can be passed to FIND_PACKAGE()
+# Optionally, the COMPONENTS keyword can be passed to find_package()
# and GStreamer plugins can be looked for. Currently, the following
# plugins can be searched, and they define the following variables if
# found:
@@ -19,7 +19,6 @@
# gstreamer-app: GSTREAMER_APP_INCLUDE_DIRS and GSTREAMER_APP_LIBRARIES
# gstreamer-audio: GSTREAMER_AUDIO_INCLUDE_DIRS and GSTREAMER_AUDIO_LIBRARIES
# gstreamer-fft: GSTREAMER_FFT_INCLUDE_DIRS and GSTREAMER_FFT_LIBRARIES
-# gstreamer-interfaces: GSTREAMER_INTERFACES_INCLUDE_DIRS and GSTREAMER_INTERFACES_LIBRARIES
# gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES
# gstreamer-video: GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES
#
@@ -46,87 +45,89 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-FIND_PACKAGE(PkgConfig)
-
-# The minimum GStreamer version we support.
-SET(GSTREAMER_MINIMUM_VERSION 0.10.30)
+find_package(PkgConfig)
# Helper macro to find a GStreamer plugin (or GStreamer itself)
# _component_prefix is prepended to the _INCLUDE_DIRS and _LIBRARIES variables (eg. "GSTREAMER_AUDIO")
-# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-0.10", or "gstreamer-video-0.10").
-# _header is the component's header, relative to the gstreamer-0.10 directory (eg. "gst/gst.h").
-# _library is the component's library name (eg. "gstreamer-0.10" or "gstvideo-0.10")
-MACRO(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
+# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-1.0", or "gstreamer-video-1.0").
+# _header is the component's header, relative to the gstreamer-1.0 directory (eg. "gst/gst.h").
+# _library is the component's library name (eg. "gstreamer-1.0" or "gstvideo-1.0")
+macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
# FIXME: The QUIET keyword can be used once we require CMake 2.8.2.
- PKG_CHECK_MODULES(PC_${_component_prefix} ${_pkgconfig_name})
+ pkg_check_modules(PC_${_component_prefix} ${_pkgconfig_name})
- FIND_PATH(${_component_prefix}_INCLUDE_DIRS
+ find_path(${_component_prefix}_INCLUDE_DIRS
NAMES ${_header}
HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR}
- PATH_SUFFIXES gstreamer-0.10
+ PATH_SUFFIXES gstreamer-1.0
)
- FIND_LIBRARY(${_component_prefix}_LIBRARIES
+ find_library(${_component_prefix}_LIBRARIES
NAMES ${_library}
HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
)
-ENDMACRO()
+endmacro()
# ------------------------
# 1. Find GStreamer itself
# ------------------------
# 1.1. Find headers and libraries
-FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-0.10 gst/gst.h gstreamer-0.10)
-FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-0.10 gst/gst.h gstbase-0.10)
+FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-1.0 gst/gst.h gstreamer-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-1.0 gst/gst.h gstbase-1.0)
# 1.2. Check GStreamer version
-IF (GSTREAMER_INCLUDE_DIRS)
- IF (EXISTS "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h")
- FILE (READ "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h" GSTREAMER_VERSION_CONTENTS)
-
- STRING(REGEX MATCH "#define +GST_VERSION_MAJOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
- SET(GSTREAMER_VERSION_MAJOR "${CMAKE_MATCH_1}")
-
- STRING(REGEX MATCH "#define +GST_VERSION_MINOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
- SET(GSTREAMER_VERSION_MINOR "${CMAKE_MATCH_1}")
-
- STRING(REGEX MATCH "#define +GST_VERSION_MICRO +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
- SET(GSTREAMER_VERSION_MICRO "${CMAKE_MATCH_1}")
-
- SET(GSTREAMER_VERSION "${GSTREAMER_VERSION_MAJOR}.${GSTREAMER_VERSION_MINOR}.${GSTREAMER_VERSION_MICRO}")
- ENDIF ()
-ENDIF ()
-
-# FIXME: With CMake 2.8.3 we can just pass GSTREAMER_VERSION to FIND_PACKAGE_HANDLE_STARNDARD_ARGS as VERSION_VAR
-# and remove the version check here (GSTREAMER_MINIMUM_VERSION would be passed to FIND_PACKAGE).
-SET(VERSION_OK TRUE)
-IF ("${GSTREAMER_VERSION}" VERSION_LESS "${GSTREAMER_MINIMUM_VERSION}")
- SET(VERSION_OK FALSE)
-ENDIF ()
+if (GSTREAMER_INCLUDE_DIRS)
+ if (EXISTS "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h")
+ file(READ "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h" GSTREAMER_VERSION_CONTENTS)
+
+ string(REGEX MATCH "#define +GST_VERSION_MAJOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
+ set(GSTREAMER_VERSION_MAJOR "${CMAKE_MATCH_1}")
+
+ string(REGEX MATCH "#define +GST_VERSION_MINOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
+ set(GSTREAMER_VERSION_MINOR "${CMAKE_MATCH_1}")
+
+ string(REGEX MATCH "#define +GST_VERSION_MICRO +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
+ set(GSTREAMER_VERSION_MICRO "${CMAKE_MATCH_1}")
+
+ set(GSTREAMER_VERSION "${GSTREAMER_VERSION_MAJOR}.${GSTREAMER_VERSION_MINOR}.${GSTREAMER_VERSION_MICRO}")
+ endif ()
+endif ()
+
+# FIXME: With CMake 2.8.3 we can just pass GSTREAMER_VERSION to FIND_PACKAGE_HANDLE_STANDARD_ARGS as VERSION_VAR
+# and remove the version check here (GSTREAMER_FIND_VERSION would be passed to FIND_PACKAGE).
+set(VERSION_OK TRUE)
+if (GSTREAMER_FIND_VERSION_EXACT)
+ if (NOT(("${GSTREAMER_FIND_VERSION}" VERSION_EQUAL "${GSTREAMER_VERSION}")))
+ set(VERSION_OK FALSE)
+ endif ()
+else ()
+ if ("${GSTREAMER_VERSION}" VERSION_LESS "${GSTREAMER_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+endif ()
# -------------------------
# 2. Find GStreamer plugins
# -------------------------
-FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-0.10 gst/app/gstappsink.h gstapp-0.10)
-FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-0.10 gst/audio/audio.h gstaudio-0.10)
-FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-0.10 gst/fft/gstfft.h gstfft-0.10)
-FIND_GSTREAMER_COMPONENT(GSTREAMER_INTERFACES gstreamer-interfaces-0.10 gst/interfaces/mixer.h gstinterfaces-0.10)
-FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-0.10 gst/pbutils/pbutils.h gstpbutils-0.10)
-FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-0.10 gst/video/video.h gstvideo-0.10)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-1.0 gst/app/gstappsink.h gstapp-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-1.0 gst/audio/audio.h gstaudio-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-1.0 gst/fft/gstfft.h gstfft-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-1.0 gst/pbutils/pbutils.h gstpbutils-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-1.0 gst/video/video.h gstvideo-1.0)
# ------------------------------------------------
# 3. Process the COMPONENTS passed to FIND_PACKAGE
# ------------------------------------------------
-SET(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES VERSION_OK GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES)
+set(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES VERSION_OK GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES)
-FOREACH(_component ${GStreamer_FIND_COMPONENTS})
- SET(_gst_component "GSTREAMER_${_component}")
- STRING(TOUPPER ${_gst_component} _UPPER_NAME)
+foreach (_component ${GStreamer_FIND_COMPONENTS})
+ set(_gst_component "GSTREAMER_${_component}")
+ string(TOUPPER ${_gst_component} _UPPER_NAME)
- LIST(APPEND _GSTREAMER_REQUIRED_VARS ${_UPPER_NAME}_INCLUDE_DIRS ${_UPPER_NAME}_LIBRARIES)
-ENDFOREACH()
+ list(APPEND _GSTREAMER_REQUIRED_VARS ${_UPPER_NAME}_INCLUDE_DIRS ${_UPPER_NAME}_LIBRARIES)
+endforeach ()
-INCLUDE(FindPackageHandleStandardArgs)
+include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG ${_GSTREAMER_REQUIRED_VARS})