misc patch to help opengl plugin build on win32 with msvc

comicfans44 comicfans44 at gmail.com
Thu Oct 24 10:51:37 CEST 2013


and this is a missed patch

0002-improve-MSVC-vc10-compatibility.patch

 From a4e7648070c84e5c937f4c0fae5eb065a6bd3553 Mon Sep 17 00:00:00 2001 
From: comicfans44  
Date: Thu, 24 Oct 2013 15:57:09 +0800 
Subject: [PATCH 2/3] improve MSVC(vc10) compatibility 

--- 
 gst-libs/gst/gl/gstglapi.h    |    7 +++++-- 
 gst-libs/gst/gl/gstglmemory.c |    4 ++-- 
 gst-libs/gst/gl/gstglshader.c |   24 ++++++++++++------------ 
 gst/gl/gstglfiltershader.c    |    7 ++++++- 
 gst/gl/gstglmosaic.c          |   36 +++++++++++++++++------------------- 
 win32/common/config.h         |    4 ++-- 
 win32/common/gstglconfig.h    |   23 +++++++++++++++++++++++ 
 7 files changed, 67 insertions(+), 38 deletions(-) 
 create mode 100644 win32/common/gstglconfig.h 

diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h 
index b5969c2..274a59c 100644 
--- a/gst-libs/gst/gl/gstglapi.h 
+++ b/gst-libs/gst/gl/gstglapi.h 
@@ -41,9 +41,12 @@ 
 #  include  
 #  include  
 # else 
+#  if defined(__WIN32__) || defined(_WIN32) 
+#   include  
+#  endif 
 #  include  
 #  include  
-#  if __WIN32__ || _WIN32 
+# if defined(__WIN32__) || defined(_WIN32) 
 #   include  
 #  endif 
 # endif 
@@ -83,7 +86,7 @@ typedef enum 
  
 #define GST_GL_EXT_BEGIN(name, min_gl, maj_gl, in_gles, ext_suf, ext_name) 
 #define GST_GL_EXT_FUNCTION(ret, name, args) \ 
-  ret GSTGLAPI (*name) args; 
+  ret (GSTGLAPI *name) args; 
 #define GST_GL_EXT_END() 
  
 typedef struct _GstGLFuncs 
diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c 
index 3130599..b58fee2 100644 
--- a/gst-libs/gst/gl/gstglmemory.c 
+++ b/gst-libs/gst/gl/gstglmemory.c 
@@ -312,8 +312,8 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size) 
     memcpy (dest->data, src->data, src->mem.maxsize); 
     GST_GL_MEMORY_FLAG_SET (dest, GST_GL_MEMORY_FLAG_NEED_UPLOAD); 
   } else { 
-    copy_params = (GstGLMemoryCopyParams) { 
-    src, 0,}; 
+    copy_params.src = src; 
+    copy_params.tex_id = 0; 
  
     gst_gl_context_thread_add (src->context, _gl_mem_copy_thread, ?_params); 
  
diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c 
index 9bf7d59..6e189c1 100644 
--- a/gst-libs/gst/gl/gstglshader.c 
+++ b/gst-libs/gst/gl/gstglshader.c 
@@ -43,22 +43,22 @@ 
  
 typedef struct _GstGLShaderVTable 
 { 
-  GLuint GSTGLAPI (*CreateProgram) (void); 
-  void GSTGLAPI (*DeleteProgram) (GLuint program); 
-  void GSTGLAPI (*UseProgram) (GLuint program); 
-  void GSTGLAPI (*GetAttachedShaders) (GLuint program, GLsizei maxcount, 
+  GLuint (GSTGLAPI * CreateProgram) (void); 
+  void (GSTGLAPI * DeleteProgram) (GLuint program); 
+  void (GSTGLAPI * UseProgram) (GLuint program); 
+  void (GSTGLAPI * GetAttachedShaders) (GLuint program, GLsizei maxcount, 
       GLsizei * count, GLuint * shaders); 
  
-  GLuint GSTGLAPI (*CreateShader) (GLenum shaderType); 
-  void GSTGLAPI (*DeleteShader) (GLuint shader); 
-  void GSTGLAPI (*AttachShader) (GLuint program, GLuint shader); 
-  void GSTGLAPI (*DetachShader) (GLuint program, GLuint shader); 
+    GLuint (GSTGLAPI * CreateShader) (GLenum shaderType); 
+  void (GSTGLAPI * DeleteShader) (GLuint shader); 
+  void (GSTGLAPI * AttachShader) (GLuint program, GLuint shader); 
+  void (GSTGLAPI * DetachShader) (GLuint program, GLuint shader); 
  
-  void GSTGLAPI (*GetShaderiv) (GLuint program, GLenum pname, GLint * params); 
-  void GSTGLAPI (*GetProgramiv) (GLuint program, GLenum pname, GLint * params); 
-  void GSTGLAPI (*GetShaderInfoLog) (GLuint shader, GLsizei maxLength, 
+  void (GSTGLAPI * GetShaderiv) (GLuint program, GLenum pname, GLint * params); 
+  void (GSTGLAPI * GetProgramiv) (GLuint program, GLenum pname, GLint * params); 
+  void (GSTGLAPI * GetShaderInfoLog) (GLuint shader, GLsizei maxLength, 
       GLsizei * length, char *log); 
-  void GSTGLAPI (*GetProgramInfoLog) (GLuint shader, GLsizei maxLength, 
+  void (GSTGLAPI * GetProgramInfoLog) (GLuint shader, GLsizei maxLength, 
       GLsizei * length, char *log); 
 } GstGLShaderVTable; 
  
diff --git a/gst/gl/gstglfiltershader.c b/gst/gl/gstglfiltershader.c 
index ad9b343..6ddba80 100644 
--- a/gst/gl/gstglfiltershader.c 
+++ b/gst/gl/gstglfiltershader.c 
@@ -40,7 +40,12 @@ 
 #include  
 #include  
 #include  
-#include  
+ 
+#  if !defined(__WIN32__) &&  !defined(_WIN32) 
+#   include  
+#  endif 
+ 
+ 
 #include  
  
 #include  
diff --git a/gst/gl/gstglmosaic.c b/gst/gl/gstglmosaic.c 
index aa2ceb7..607ffa2 100644 
--- a/gst/gl/gstglmosaic.c 
+++ b/gst/gl/gstglmosaic.c 
@@ -254,27 +254,15 @@ gst_gl_mosaic_callback (gpointer stuff) 
       gst_gl_shader_get_attribute_location (mosaic->shader, "a_texCoord"); 
  
   while (count < mosaic->input_textures->len && count < 6) { 
-    GstVideoFrame *in_frame; 
+    GstVideoFrame *in_frame = g_ptr_array_index (mosaic->input_frames, count); 
     GLfloat *v_vertices; 
-    guint in_tex; 
-    guint width, height; 
+    guint in_tex = g_array_index (mosaic->input_textures, guint, count); 
+    guint width = GST_VIDEO_FRAME_WIDTH (in_frame); 
+    guint height = GST_VIDEO_FRAME_HEIGHT (in_frame); 
  
-    in_frame = g_ptr_array_index (mosaic->input_frames, count); 
-    in_tex = g_array_index (mosaic->input_textures, guint, count); 
-    width = GST_VIDEO_FRAME_WIDTH (in_frame); 
-    height = GST_VIDEO_FRAME_HEIGHT (in_frame); 
- 
-    if (!in_frame || !in_tex || width <= 0 || height <= 0) { 
-      GST_DEBUG ("skipping texture:%u frame:%p width:%u height %u", 
-          in_tex, in_frame, width, height); 
-      count++; 
-      continue; 
-    } 
- 
-    GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, width, height); 
- 
-    /* *INDENT-OFF* */ 
-    v_vertices = (GLfloat[]) { 
+ /* *INDENT-OFF* */ 
+ GLfloat temp[]= 
+    { 
       /* front face */ 
       1.0f, 1.0f, -1.0f, 
       width, 0.0f, 
@@ -332,6 +320,16 @@ gst_gl_mosaic_callback (gpointer stuff) 
     }; 
     /* *INDENT-ON* */ 
  
+    if (!in_frame || !in_tex || width <= 0 || height <= 0) { 
+      GST_DEBUG ("skipping texture:%u frame:%p width:%u height %u", 
+          in_tex, in_frame, width, height); 
+      count++; 
+      continue; 
+    } 
+ 
+    GST_TRACE ("processing texture:%u dimensions:%ux%u", in_tex, width, height); 
+ 
+    v_vertices = temp; 
     gl->VertexAttribPointer (attr_position_loc, 3, GL_FLOAT, 
         GL_FALSE, 5 * sizeof (GLfloat), &v_vertices[5 * 4 * count]); 
  
diff --git a/win32/common/config.h b/win32/common/config.h 
index d02b566..721bea0 100644 
--- a/win32/common/config.h 
+++ b/win32/common/config.h 
@@ -9,7 +9,7 @@ 
 #define GETTEXT_PACKAGE "gst-plugins-gl-0.10" 
  
 /* PREFIX - specifically added for Windows for easier moving */ 
-#define PREFIX "C:\\gstreamer" 
+#define PREFIX "C:\\gstreamer\\1.0\\x86" 
  
 /* Location of registry */ 
 #define GST_CACHE_DIR PREFIX "\\var\\cache" 
@@ -199,7 +199,7 @@ 
 #undef PACKAGE_VERSION 
  
 /* directory where plugins are located */ 
-#define PLUGINDIR PREFIX "\\lib\\gstreamer-0.10" 
+#define PLUGINDIR PREFIX "\\lib\\gstreamer-1.0" 
  
 /* Define to 1 if you have the ANSI C header files. */ 
 #undef STDC_HEADERS 
diff --git a/win32/common/gstglconfig.h b/win32/common/gstglconfig.h 
new file mode 100644 
index 0000000..25c8e53 
--- /dev/null 
+++ b/win32/common/gstglconfig.h 
@@ -0,0 +1,23 @@ 
+/* gstglconfig.h 
+ * 
+ * This is a generated file.  Please modify `configure.ac' 
+ */ 
+ 
+#ifndef __GST_GL_CONFIG_H__ 
+#define __GST_GL_CONFIG_H__ 
+ 
+#include  
+ 
+G_BEGIN_DECLS 
+ 
+ 
+#define GST_GL_HAVE_OPENGL 1 
+#define GST_GL_HAVE_WINDOW_WIN32 1 
+#define GST_GL_HAVE_PLATFORM_WGL 1 
+#define GST_GL_HAVE_GLCHAR 1 
+#define GST_GL_HAVE_GLSIZEIPTR 1 
+#define GST_GL_HAVE_GLINTPTR 1 
+ 
+G_END_DECLS 
+ 
+#endif  /* __GST_GL_CONFIG_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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-fix-MSVC-can-not-link-to-gstgl-bug.patch
Type: application/octet-stream
Size: 945 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131024/3cd04518/attachment-0001.obj>


More information about the gstreamer-devel mailing list