misc patch to help opengl plugin build on win32 with msvc

Tim-Philipp Müller t.i.m at zen.co.uk
Fri Oct 25 11:45:19 CEST 2013


On Fri, 2013-10-25 at 07:49 +0800, comicfans44 wrote:

Hi,

> and this is the last patch

could you put patches in bugzilla please, so we don't forget about them?
Thanks!

Cheers
 -Tim

> From 793fb96c58d694a8d743035b9a7450771a3ad029 Mon Sep 17 00:00:00 2001 
> From: comicfans44  
> Date: Thu, 24 Oct 2013 16:44:29 +0800 
> Subject: [PATCH] fix MSVC can not link to gstgl bug 
> 
> --- 
>  gst-libs/gst/gl/CMakeLists.txt |    3 +-- 
>  1 file changed, 1 insertion(+), 2 deletions(-) 
> 
> diff --git a/gst-libs/gst/gl/CMakeLists.txt b/gst-libs/gst/gl/CMakeLists.txt 
> index 6ac3013..7a98bae 100644 
> --- a/gst-libs/gst/gl/CMakeLists.txt 
> +++ b/gst-libs/gst/gl/CMakeLists.txt 
> @@ -34,7 +34,7 @@ add_custom_command(OUTPUT ${glconfigpath} 
>   ) 
>   
>   
> -add_library(gstgl SHARED 
> +add_library(gstgl  
>   ${PROJECT_BINARY_DIR}/config.h 
>   ${glconfigpath}  
>      ${srcs} ) 
> @@ -53,7 +53,6 @@ set_target_properties(gstgl PROPERTIES 
>  add_dependencies(gstgl ${glconfigpath} ${PROJECT_BINARY_DIR}/config.h) 
>   
>  install(TARGETS gstgl 
> - LIBRARY DESTINATION bin 
>   ARCHIVE DESTINATION lib) 
>   
>  file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 
> --  
> 1.7.9.5
> 
> ----- Original Message -----  
> From:   comicfans44  
> To:   gstreamer-devel  
> Date:  2013-10-24, 16:23:37 
> Subject:  misc patch to help opengl plugin build on win32 with msvc 
> 
> 
> 
> 原邮件附件清单如下: 
> 0001-improve-CMake-build-system.patch 
> 0002-improve-MSVC-vc10-compatibility.patch 
> 0003-improve-cmake-build-script-add-install-target.patch 
> 
> >Hello , 
> >    I'm trying to implement some element based on opengl plugin on win32, 
> >but I found the CMake build script is incomplete, and some headers are not  
> >compatible with msvc , so I made some patch to complete the CMake build script, 
> >hopes this can help others working with msvc. 
> >    I don't know if it's good to post whole patch here,anyway I posted it. 
> >patch also avaiable as attachments. 
> > 
> >0001-improve-CMake-build-system.patch : 
> > 
> >From e6ba08a4872907a85f795b0a30e6d9babcd39568 Mon Sep 17 00:00:00 2001 
> >From: comicfans44  
> >Date: Tue, 22 Oct 2013 10:33:00 +0800 
> >Subject: [PATCH 1/3] improve CMake build system 
> >gstreamer main modules came with VS project for msvc build, 
> >but gl plugin's VS project is out of date. I made some 
> >improve to current (not-complete) CMake build script,makes 
> >building  msvc version easier. this script can also build in Linux ,but 
> >not behave exactly the same as autoconf. 
> >--- 
> > CMakeLists.txt                    |   61 +++++++---------- 
> > cmake/modules/FindGLIB2.cmake     |   46 +++++++++++++ 
> > cmake/modules/FindGObject.cmake   |   78 +++++++++++++++++++++ 
> > cmake/modules/FindGStreamer.cmake |  135 +++++++++++++++++++++++++++++++++++++ 
> > gst-libs/CMakeLists.txt           |    1 + 
> > gst-libs/gst/CMakeLists.txt       |    1 + 
> > gst-libs/gst/gl/CMakeLists.txt    |   21 ++++++ 
> > gst/CMakeLists.txt                |    1 + 
> > gst/gl/CMakeLists.txt             |   25 +++++++ 
> > 9 files changed, 332 insertions(+), 37 deletions(-) 
> > create mode 100644 cmake/modules/FindGLIB2.cmake 
> > create mode 100644 cmake/modules/FindGObject.cmake 
> > create mode 100644 cmake/modules/FindGStreamer.cmake 
> > create mode 100644 gst-libs/CMakeLists.txt 
> > create mode 100644 gst-libs/gst/CMakeLists.txt 
> > create mode 100644 gst-libs/gst/gl/CMakeLists.txt 
> > create mode 100644 gst/CMakeLists.txt 
> > create mode 100644 gst/gl/CMakeLists.txt 
> >diff --git a/CMakeLists.txt b/CMakeLists.txt 
> >index e633e59..10f14a6 100644 
> >--- a/CMakeLists.txt 
> >+++ b/CMakeLists.txt 
> >@@ -7,46 +7,28 @@ cmake_minimum_required(VERSION "2.8.0") 
> > # pkg_check_modules(GSTREAMER gstreamer-0.10) 
> > # --- 
> >  
> >-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) 
> >+list(APPEND CMAKE_MODULE_PATH  
> >+${CMAKE_SOURCE_DIR}/cmake/modules) 
> >  
> > project (GST-PLUGINS-GL) 
> >  
> >-if (WIN32) 
> >-  set(OSSBUILD_SDK_DIR $ENV{OSSBUILD_GSTREAMER_SDK_DIR}) 
> >-  if (OSSBUILD_SDK_DIR) 
> >-    set(OSSBUILD_SDK_INCLUDE_DIR ${OSSBUILD_SDK_DIR}/include) 
> >-    #set(CMAKE_PREFIX_PATH ${OSSBUILD_SDK_DIR}) 
> >-    set(CMAKE_INCLUDE_PATH ${OSSBUILD_SDK_INCLUDE_DIR}) 
> >-    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${OSSBUILD_SDK_INCLUDE_DIR}/glib-2.0) 
> >-    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${OSSBUILD_SDK_INCLUDE_DIR}/gstreamer-0.10) 
> >-    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${OSSBUILD_SDK_INCLUDE_DIR}/libxml2) 
> >-  endif (OSSBUILD_SDK_DIR) 
> >-  set(OSSBUILD_DIR $ENV{OSSBUILD_GSTREAMER_DIR}) 
> >-  if (OSSBUILD_DIR) 
> >-    #set(ENV{GSTREAMER_DIR} ${OSSBUILD_DIR}) 
> >-    set(CMAKE_LIBRARY_PATH ${OSSBUILD_DIR}/bin) 
> >-    set(JPEG_NAMES jpeg-8) 
> >-    #set(FREETYPE_NAMES freetype-6) 
> >-    message(STATUS ${CMAKE_LIBRARY_PATH}) 
> >-  endif (OSSBUILD_DIR) 
> >-endif (WIN32) 
> >+ 
> >  
> > # built-in 
> > find_package(OpenGL REQUIRED) 
> >-find_package(GTK2 REQUIRED) 
> >-find_package(Glib2 REQUIRED) 
> >+#find_package(GTK2 REQUIRED) 
> >+find_package(GLIB2 REQUIRED) 
> > find_package(LibXml2 REQUIRED) 
> > find_package(JPEG REQUIRED) 
> >-find_package(PNG REQUIRED) 
> >+#find_package(PNG REQUIRED) 
> > find_package(ZLIB REQUIRED) 
> >  
> >-# home made 
> >-find_package(Glib2 REQUIRED) 
> >-find_package(Gstreamer REQUIRED) 
> >-find_package(Glew REQUIRED) 
> >-find_package(LibIconv REQUIRED) 
> >-find_package(ATK REQUIRED) 
> >-find_package(Cairo REQUIRED) 
> >+ 
> >+find_package(GStreamer REQUIRED) 
> >+find_package(GLEW REQUIRED) 
> >+#find_package(LibIconv REQUIRED) 
> >+#find_package(ATK REQUIRED) 
> >+#find_package(Cairo REQUIRED) 
> >  
> > function(check_package name LEVEL) 
> >   if (${name}_FOUND) 
> >@@ -67,8 +49,6 @@ endfunction(check_package) 
> > check_package(GLIB2 1) 
> > check_package(GSTREAMER 1) 
> > check_package(OPENGL 1) 
> >-check_package(GLEW 1) 
> >-check_package(PNG 1) 
> > if (WIN32) 
> > check_package(ZLIB 1) 
> > endif (WIN32) 
> >@@ -78,13 +58,11 @@ INCLUDE (CheckIncludeFiles) 
> > CHECK_INCLUDE_FILES (${GSTREAMER_DIR}/include/gst/gstconfig.h GST_USING_BINARY_REGISTRY) 
> > if (NOT GST_USING_BINARY_REGISTRY) 
> > check_package(LIBXML2 1) 
> >-check_package(LIBICONV 1) 
> >+#check_package(LIBICONV 1) 
> > endif (NOT GST_USING_BINARY_REGISTRY) 
> >  
> > # optionnal packages 
> >-check_package(GTK2 0) 
> >-check_package(ATK 0) 
> >-check_package(CAIRO 0) 
> >+ 
> >  
> > # debug 
> > #message("****" ${GLIB2_INCLUDE_DIR}) 
> >@@ -104,10 +82,19 @@ check_package(CAIRO 0) 
> > #message("****" ${ATK_INCLUDE_DIR}) 
> > #message("****" ${CAIRO_INCLUDE_DIR}) 
> >  
> >+ 
> >+include_directories( 
> >+    ${GSTREAMER_INCLUDE_DIRS} 
> >+    ${GLIB2_INCLUDE_DIR} 
> >+    gst-libs) 
> >+ 
> >+add_definitions(-DHAVE_CONFIG_H) 
> >+ 
> > add_subdirectory (gst-libs) 
> >+ 
> >+ 
> > add_subdirectory (gst) 
> >  
> > #add_dependencies(gstgl) 
> >  
> > #FIXME: generate config.h 
> >-add_definitions(-DHAVE_CONFIG_H) 
> >diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake 
> >new file mode 100644 
> >index 0000000..d747ed5 
> >--- /dev/null 
> >+++ b/cmake/modules/FindGLIB2.cmake 
> >@@ -0,0 +1,46 @@ 
> >+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") 
> >+ 
> >+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 
> >+ 
> >+     /usr/lib/i386-linux-gnu/glib-2.0/include/ 
> >+                                        ENV INCLUDE DOC "Directory containing glibconfig.h include file") 
> >+ 
> >+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) 
> >+ 
> >+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) 
> >+ 
> >+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) 
> >+ 
> >+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) 
> >+ 
> >+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) 
> >diff --git a/cmake/modules/FindGObject.cmake b/cmake/modules/FindGObject.cmake 
> >new file mode 100644 
> >index 0000000..51c63f0 
> >--- /dev/null 
> >+++ b/cmake/modules/FindGObject.cmake 
> >@@ -0,0 +1,78 @@ 
> >+# - 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  
> >+# Copyright (c) 2008 Helio Chissini de Castro,  
> >+# 
> >+# 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 
> >+PATHS 
> >+${PKG_GOBJECT2_INCLUDE_DIRS} 
> >+/usr/include/glib-2.0/ 
> >+PATH_SUFFIXES glib-2.0 
> >+) 
> >+ 
> >+FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0 
> >+PATHS 
> >+${PKG_GOBJECT2_LIBRARY_DIRS} 
> >+) 
> >+FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0 
> >+PATHS 
> >+${PKG_GOBJECT2_LIBRARY_DIRS} 
> >+) 
> >+FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0 
> >+PATHS 
> >+${PKG_GOBJECT2_LIBRARY_DIRS} 
> >+) 
> >+FIND_LIBRARY(_GLibs NAMES glib-2.0 
> >+PATHS 
> >+${PKG_GOBJECT2_LIBRARY_DIRS} 
> >+) 
> >+ 
> >+IF (WIN32) 
> >+SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs}) 
> >+ELSE (WIN32) 
> >+SET (GOBJECT_LIBRARIES ${PKG_GOBJECT2_LIBRARIES}) 
> >+ENDIF (WIN32) 
> >+ 
> >+IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) 
> >+SET(GOBJECT_FOUND TRUE) 
> >+ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) 
> >+SET(GOBJECT_FOUND FALSE) 
> >+ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES) 
> >+ 
> >+IF (GOBJECT_FOUND) 
> >+IF (NOT GObject_FIND_QUIETLY) 
> >+MESSAGE(STATUS "Found GObject libraries: ${GOBJECT_LIBRARIES}") 
> >+MESSAGE(STATUS "Found GObject includes : ${GOBJECT_INCLUDE_DIR}") 
> >+ENDIF (NOT GObject_FIND_QUIETLY) 
> >+ELSE (GOBJECT_FOUND) 
> >+IF (GObject_FIND_REQUIRED) 
> >+MESSAGE(STATUS "Could NOT find GObject") 
> >+ENDIF(GObject_FIND_REQUIRED) 
> >+ENDIF (GOBJECT_FOUND) 
> >+ 
> >+MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES) 
> >\ No newline at end of file 
> >diff --git a/cmake/modules/FindGStreamer.cmake b/cmake/modules/FindGStreamer.cmake 
> >new file mode 100644 
> >index 0000000..4414e62 
> >--- /dev/null 
> >+++ b/cmake/modules/FindGStreamer.cmake 
> >@@ -0,0 +1,135 @@ 
> >+# - Try to find GStreamer and its plugins 
> >+# Once done, this will define 
> >+# 
> >+#  GSTREAMER_FOUND - system has GStreamer 
> >+#  GSTREAMER_INCLUDE_DIRS - the GStreamer include directories 
> >+#  GSTREAMER_LIBRARIES - link these to use GStreamer 
> >+# 
> >+# Additionally, gstreamer-base is always looked for and required, and 
> >+# the following related variables are defined: 
> >+# 
> >+#  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() 
> >+# and GStreamer plugins can be looked for.  Currently, the following 
> >+# plugins can be searched, and they define the following variables if 
> >+# found: 
> >+# 
> >+#  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-pbutils:    GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES 
> >+#  gstreamer-video:      GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES 
> >+#  gstreamer-gl:     GSTREAMER_GL_INCLUDE_DIRS and GSTREAMER_GL_LIBRARIES 
> >+# 
> >+# Copyright (C) 2012 Raphael Kubo da Costa  
> >+# 
> >+# Redistribution and use in source and binary forms, with or without 
> >+# modification, are permitted provided that the following conditions 
> >+# are met: 
> >+# 1.  Redistributions of source code must retain the above copyright 
> >+#     notice, this list of conditions and the following disclaimer. 
> >+# 2.  Redistributions in binary form must reproduce the above copyright 
> >+#     notice, this list of conditions and the following disclaimer in the 
> >+#     documentation and/or other materials provided with the distribution. 
> >+# 
> >+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS 
> >+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
> >+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
> >+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS 
> >+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
> >+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
> >+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
> >+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
> >+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
> >+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
> >+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
> >+ 
> >+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-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}) 
> >+ 
> >+    find_path(${_component_prefix}_INCLUDE_DIRS 
> >+        NAMES ${_header} 
> >+        HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR} 
> >+        PATH_SUFFIXES gstreamer-1.0 
> >+    ) 
> >+ 
> >+    find_library(${_component_prefix}_LIBRARIES 
> >+        NAMES ${_library} 
> >+        HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR} 
> >+    ) 
> >+endmacro() 
> >+ 
> >+# ------------------------ 
> >+# 1. Find GStreamer itself 
> >+# ------------------------ 
> >+ 
> >+# 1.1. Find headers and libraries 
> >+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_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-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) 
> >+FIND_GSTREAMER_COMPONENT(GSTREAMER_GL gstreamer-gl-1.0 gst/gl/gl.h gstgl-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) 
> >+ 
> >+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 () 
> >+ 
> >+include(FindPackageHandleStandardArgs) 
> >+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG ${_GSTREAMER_REQUIRED_VARS}) 
> >diff --git a/gst-libs/CMakeLists.txt b/gst-libs/CMakeLists.txt 
> >new file mode 100644 
> >index 0000000..02b235e 
> >--- /dev/null 
> >+++ b/gst-libs/CMakeLists.txt 
> >@@ -0,0 +1 @@ 
> >+add_subdirectory(gst) 
> >diff --git a/gst-libs/gst/CMakeLists.txt b/gst-libs/gst/CMakeLists.txt 
> >new file mode 100644 
> >index 0000000..ef32dd6 
> >--- /dev/null 
> >+++ b/gst-libs/gst/CMakeLists.txt 
> >@@ -0,0 +1 @@ 
> >+add_subdirectory(gl) 
> >diff --git a/gst-libs/gst/gl/CMakeLists.txt b/gst-libs/gst/gl/CMakeLists.txt 
> >new file mode 100644 
> >index 0000000..9b441bd 
> >--- /dev/null 
> >+++ b/gst-libs/gst/gl/CMakeLists.txt 
> >@@ -0,0 +1,21 @@ 
> >+set(srcs  
> >+    gstglapi.c 
> >+gstglbufferpool.c 
> >+gstglcontext.c 
> >+gstgldisplay.c 
> >+gstgldownload.c 
> >+gstglfeature.c 
> >+gstglfilter.c 
> >+gstglframebuffer.c 
> >+gstglmemory.c 
> >+gstglmixer.c 
> >+gstglshader.c 
> >+gstglshadervariables.c 
> >+gstglupload.c 
> >+gstglutils.c 
> >+gstglwindow.c) 
> >+ 
> >+include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 
> >+ 
> >+add_library(gstgl  
> >+    ${srcs} ) 
> >diff --git a/gst/CMakeLists.txt b/gst/CMakeLists.txt 
> >new file mode 100644 
> >index 0000000..ef32dd6 
> >--- /dev/null 
> >+++ b/gst/CMakeLists.txt 
> >@@ -0,0 +1 @@ 
> >+add_subdirectory(gl) 
> >diff --git a/gst/gl/CMakeLists.txt b/gst/gl/CMakeLists.txt 
> >new file mode 100644 
> >index 0000000..b613ed3 
> >--- /dev/null 
> >+++ b/gst/gl/CMakeLists.txt 
> >@@ -0,0 +1,25 @@ 
> >+set (plugin_srcs 
> >+    gltestsrc.c 
> >+gstglbumper.c 
> >+gstglcolorscale.c 
> >+gstgldeinterlace.c 
> >+gstgldifferencematte.c 
> >+gstgleffects.c 
> >+gstglfilterapp.c 
> >+gstglfilterblur.c 
> >+gstglfiltercube.c 
> >+gstglfilterglass.c 
> >+gstglfilterlaplacian.c 
> >+gstglfilterreflectedscreen.c 
> >+gstglfiltershader.c 
> >+gstglfiltersobel.c 
> >+gstglimagesink.c 
> >+gstglmosaic.c 
> >+gstgloverlay.c 
> >+gstgltestsrc.c 
> >+gstopengl.c) 
> >+ 
> >+ 
> >+add_library(gstglplugin MODULE ${plugin_srcs}) 
> >+ 
> >+target_link_libraries(gstglplugin gstgl) 
> >--  
> >1.7.9.5 
> > 
> > 
> > 
> >本邮件附件清单如下: 
> >  (1) 0001-improve-CMake-build-system.patch (18.7 K) 
> >  (2) 0002-improve-MSVC-vc10-compatibility.patch (7.5 K) 
> >  (3) 0003-improve-cmake-build-script-add-install-target.patch (6.0 K) 
> > 
> > 
> >comicfans44
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list