← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/win32_glew into lp:widelands

 

Tino has proposed merging lp:~widelands-dev/widelands/win32_glew into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/win32_glew/+merge/50529

The latest OpenGL related changes to Widelands do require OpenGL >=1.4.

Windows only provides 1.1 (1.2?), so we do have to use GLEW: http://glew.sourceforge.net/

I've tried to break nothing for other platforms, please test this branch...
-- 
https://code.launchpad.net/~widelands-dev/widelands/win32_glew/+merge/50529
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/win32_glew into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2010-12-20 21:14:01 +0000
+++ CMakeLists.txt	2011-02-20 21:01:46 +0000
@@ -266,6 +266,13 @@
 if (OPENGL_FOUND)
   # OpenGL Headers are not needed directly. Instead SDL_opengl.h should be searched
   add_definitions("-DUSE_OPENGL")
+  if (WIN32)
+	find_package(GLEW)
+	if (GLEW_FOUND)
+	else (GLEW FOUND)
+	  message (STATUS "GLEW library not found, check your libraries path and installed packages!")
+	endif (GLEW_FOUND)
+  endif (WIN32)
 else (OPENGL_FOUND)
   message (STATUS "OpenGL support disabled, check your libraries path and installed packages!")
 endif (OPENGL_FOUND)

=== added file 'cmake/Modules/FindGLEW.cmake'
--- cmake/Modules/FindGLEW.cmake	1970-01-01 00:00:00 +0000
+++ cmake/Modules/FindGLEW.cmake	2011-02-20 21:01:46 +0000
@@ -0,0 +1,47 @@
+# - Try to find GLEW
+# Once done this will define
+#  
+#  GLEW_FOUND        - system has GLEW
+#  GLEW_INCLUDE_DIR  - the GLEW include directory
+#  GLEW_LIBRARY_DIR  - where the libraries are
+#  GLEW_LIBRARY      - Link these to use GLEW
+#   
+
+IF (GLEW_INCLUDE_DIR)
+  # Already in cache, be silent
+  SET(GLEW_FIND_QUIETLY TRUE)
+ENDIF (GLEW_INCLUDE_DIR)
+
+if( WIN32 )
+   if( MSVC80 )
+       set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC" )
+   endif( MSVC80 )
+   if( MSVC71 )
+       set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003/Vc7" )
+   endif( MSVC71 )
+   FIND_PATH( GLEW_INCLUDE_DIR gl/glew.h gl/wglew.h
+              PATHS c:/glew/include ${COMPILER_PATH}/PlatformSDK/Include )
+   SET( GLEW_NAMES glew32 )
+   FIND_LIBRARY( GLEW_LIBRARY
+                 NAMES ${GLEW_NAMES}
+                 PATHS c:/glew/lib ${COMPILER_PATH}/PlatformSDK/Lib )
+else( WIN32 )
+   FIND_PATH( GLEW_INCLUDE_DIR glew.h wglew.h
+              PATHS /usr/local/include /usr/include
+              PATH_SUFFIXES gl/ GL/ )
+   SET( GLEW_NAMES glew GLEW )
+   FIND_LIBRARY( GLEW_LIBRARY
+                 NAMES ${GLEW_NAMES}
+                 PATHS /usr/lib /usr/local/lib )
+endif( WIN32 )
+
+GET_FILENAME_COMPONENT( GLEW_LIBRARY_DIR ${GLEW_LIBRARY} PATH )
+
+IF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
+   SET(GLEW_FOUND TRUE)
+    SET( GLEW_LIBRARY_DIR ${GLEW_LIBRARY} )
+ELSE (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
+   SET( GLEW_FOUND FALSE )
+   SET( GLEW_LIBRARY_DIR )
+ENDIF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
+

=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt	2011-02-10 20:41:30 +0000
+++ src/CMakeLists.txt	2011-02-20 21:01:46 +0000
@@ -114,6 +114,7 @@
 target_link_libraries(widelands_all ${ZLIB_LIBRARY})
 target_link_libraries(widelands_all ${GGZ_CORE_LIBRARY})
 target_link_libraries(widelands_all ${OPENGL_gl_LIBRARY})
+
 if (DEFINED WL_EXTRA_LINK_LIBRARIES)
   target_link_libraries(widelands_all ${WL_EXTRA_LINK_LIBRARIES})
 endif (DEFINED WL_EXTRA_LINK_LIBRARIES)
@@ -138,6 +139,7 @@
   else (DEFINED MSVC)
     target_link_libraries(widelands_all wsock32)
   endif (DEFINED MSVC)
+  target_link_libraries(widelands_all ${GLEW_LIBRARY})
 endif (WIN32)
 
 install(TARGETS widelands DESTINATION ${WL_INSTALL_BINDIR} COMPONENT ExecutableFiles)

=== modified file 'src/graphic/render/gl_picture_texture.h'
--- src/graphic/render/gl_picture_texture.h	2010-11-27 16:23:39 +0000
+++ src/graphic/render/gl_picture_texture.h	2011-02-20 21:01:46 +0000
@@ -21,6 +21,10 @@
 
 #include <boost/scoped_array.hpp>
 
+#ifdef WIN32
+#define NO_SDL_GLEXT
+#include <GL/glew.h>
+#endif
 #include <SDL_opengl.h>
 
 #include "graphic/picture.h"

=== modified file 'src/graphic/render/gl_utils.h'
--- src/graphic/render/gl_utils.h	2010-11-27 16:23:39 +0000
+++ src/graphic/render/gl_utils.h	2011-02-20 21:01:46 +0000
@@ -20,6 +20,10 @@
 #define GL_UTILS_H
 
 #include <stdint.h>
+#ifdef WIN32
+#define NO_SDL_GLEXT
+#include <GL/glew.h>
+#endif
 #include <SDL_opengl.h>
 
 struct SDL_PixelFormat;


Follow ups