diff options
Diffstat (limited to 'glew.patch')
-rw-r--r-- | glew.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/glew.patch b/glew.patch new file mode 100644 index 000000000000..3f6cbd11cddf --- /dev/null +++ b/glew.patch @@ -0,0 +1,82 @@ +diff --git a/cmake/modules/K3DFindOpenGL.cmake b/cmake/modules/K3DFindOpenGL.cmake +index ea4cf71..0192557 100644 +--- a/cmake/modules/K3DFindOpenGL.cmake ++++ b/cmake/modules/K3DFindOpenGL.cmake +@@ -2,15 +2,13 @@ SET(K3D_OPENGL_FOUND 0) + + FIND_PACKAGE(OpenGL) + +-FIND_LIBRARY(K3D_GLEW_LIBRARY NAMES GLEWmx GLEW +- DOC "The Glew shared library file" +-) +- +-FIND_PATH(K3D_GLEW_INCLUDE_DIR GL/glew.h ${OPENGL_INCLUDE_DIR}) +- +-IF(OPENGL_FOUND AND OPENGL_GLU_FOUND AND K3D_GLEW_LIBRARY AND K3D_GLEW_INCLUDE_DIR) +- SET(K3D_OPENGL_INCLUDE_DIR ${OPENGL_INCLUDE_DIR} ${K3D_GLEW_INCLUDE_DIR}) +- SET(K3D_OPENGL_LIBRARIES ${K3D_GLEW_LIBRARY} ${OPENGL_LIBRARIES}) ++pkg_search_module(GLEW glewmx glew) ++ ++IF(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLEW_FOUND) ++ SET(K3D_OPENGL_INCLUDE_DIR ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIRS}) ++ SET(K3D_OPENGL_LIBRARIES ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES}) ++ SET(K3D_GLEW_VERSION ${GLEW_VERSION}) ++ string(REPLACE "." ";" GLEW_VERSION_LIST ${GLEW_VERSION}) ++ list(GET GLEW_VERSION_LIST 0 K3D_GLEW_MAJOR_VERSION) + SET(K3D_OPENGL_FOUND 1) + ENDIF() +- +diff --git a/k3dsdk/gl/context.h b/k3dsdk/gl/context.h +index 39057d1..6f3cbc6 100644 +--- a/k3dsdk/gl/context.h ++++ b/k3dsdk/gl/context.h +@@ -27,6 +27,10 @@ + #include <k3dsdk/iunknown.h> + #include <boost/scoped_ptr.hpp> + ++#if K3D_GLEW_MAJOR_VERSION > 1 ++ struct GLEWContext {}; ++#endif ++ + namespace k3d + { + +@@ -45,13 +49,13 @@ class context : + + /// Returns the currently-active context, if any, or NULL. + static context* current(); +- ++ + /// Returns the currently-active GLEW context, if any, or NULL. Mostly used internally by GLEW + static GLEWContext* current_glew_context(); + + /// If the context is double-buffered, swaps the front and back buffers. Otherwise, a no-op. + void end(); +- ++ + /// Return the GLEW context associated with this context, or NULL if there is none + GLEWContext* glew_context(); + +@@ -76,4 +80,3 @@ class context : + #define glewGetContext() k3d::gl::context::current_glew_context() + + #endif // !K3DSDK_GL_CONTEXT_H +- +diff --git a/k3dsdk/k3d-platform-config.h.in b/k3dsdk/k3d-platform-config.h.in +index 63fd3ca..68985e6 100644 +--- a/k3dsdk/k3d-platform-config.h.in ++++ b/k3dsdk/k3d-platform-config.h.in +@@ -14,6 +14,8 @@ + #cmakedefine K3D_UINT_T_32_BITS + #cmakedefine K3D_UINT_T_64_BITS + ++#define K3D_GLEW_MAJOR_VERSION @K3D_GLEW_MAJOR_VERSION@ ++ + #define K3D_OSX_MAJOR_VERSION @K3D_OSX_MAJOR_VERSION@ + #define K3D_OSX_MINOR_VERSION @K3D_OSX_MINOR_VERSION@ + +@@ -26,4 +28,3 @@ + #endif + + #endif // !K3DSDK_PLATFORM_CONFIG_H +- |