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

Proposed by Tino
Status: Merged
Merged at revision: 5855
Proposed branch: lp:~widelands-dev/widelands/win32_glew
Merge into: lp:widelands
Diff against target: 119 lines (+64/-0)
5 files modified
CMakeLists.txt (+7/-0)
cmake/Modules/FindGLEW.cmake (+47/-0)
src/CMakeLists.txt (+2/-0)
src/graphic/render/gl_picture_texture.h (+4/-0)
src/graphic/render/gl_utils.h (+4/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/win32_glew
Reviewer Review Type Date Requested Status
Nicolai Hähnle Approve
Review via email: mp+50529@code.launchpad.net

Description of the change

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...

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

I have no time to review this right now, but this should definitivly go into build 16. I suggest merging right away and wait for the cries of others.

Revision history for this message
Nicolai Hähnle (nha) wrote :

It looks good to me, /but/ I think it should not be WIN32 specific. I will test this tonight without the if (WIN32) stuff, and if it works fine for me I will merge (unless there are other comments until then).

Revision history for this message
Nicolai Hähnle (nha) wrote :

Merged. I changed things around a little so that GLEW is also used on Linux - after all, we'll probably need it there as well eventually.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2010-12-20 21:14:01 +0000
3+++ CMakeLists.txt 2011-02-20 21:01:46 +0000
4@@ -266,6 +266,13 @@
5 if (OPENGL_FOUND)
6 # OpenGL Headers are not needed directly. Instead SDL_opengl.h should be searched
7 add_definitions("-DUSE_OPENGL")
8+ if (WIN32)
9+ find_package(GLEW)
10+ if (GLEW_FOUND)
11+ else (GLEW FOUND)
12+ message (STATUS "GLEW library not found, check your libraries path and installed packages!")
13+ endif (GLEW_FOUND)
14+ endif (WIN32)
15 else (OPENGL_FOUND)
16 message (STATUS "OpenGL support disabled, check your libraries path and installed packages!")
17 endif (OPENGL_FOUND)
18
19=== added file 'cmake/Modules/FindGLEW.cmake'
20--- cmake/Modules/FindGLEW.cmake 1970-01-01 00:00:00 +0000
21+++ cmake/Modules/FindGLEW.cmake 2011-02-20 21:01:46 +0000
22@@ -0,0 +1,47 @@
23+# - Try to find GLEW
24+# Once done this will define
25+#
26+# GLEW_FOUND - system has GLEW
27+# GLEW_INCLUDE_DIR - the GLEW include directory
28+# GLEW_LIBRARY_DIR - where the libraries are
29+# GLEW_LIBRARY - Link these to use GLEW
30+#
31+
32+IF (GLEW_INCLUDE_DIR)
33+ # Already in cache, be silent
34+ SET(GLEW_FIND_QUIETLY TRUE)
35+ENDIF (GLEW_INCLUDE_DIR)
36+
37+if( WIN32 )
38+ if( MSVC80 )
39+ set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC" )
40+ endif( MSVC80 )
41+ if( MSVC71 )
42+ set( COMPILER_PATH "C:/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003/Vc7" )
43+ endif( MSVC71 )
44+ FIND_PATH( GLEW_INCLUDE_DIR gl/glew.h gl/wglew.h
45+ PATHS c:/glew/include ${COMPILER_PATH}/PlatformSDK/Include )
46+ SET( GLEW_NAMES glew32 )
47+ FIND_LIBRARY( GLEW_LIBRARY
48+ NAMES ${GLEW_NAMES}
49+ PATHS c:/glew/lib ${COMPILER_PATH}/PlatformSDK/Lib )
50+else( WIN32 )
51+ FIND_PATH( GLEW_INCLUDE_DIR glew.h wglew.h
52+ PATHS /usr/local/include /usr/include
53+ PATH_SUFFIXES gl/ GL/ )
54+ SET( GLEW_NAMES glew GLEW )
55+ FIND_LIBRARY( GLEW_LIBRARY
56+ NAMES ${GLEW_NAMES}
57+ PATHS /usr/lib /usr/local/lib )
58+endif( WIN32 )
59+
60+GET_FILENAME_COMPONENT( GLEW_LIBRARY_DIR ${GLEW_LIBRARY} PATH )
61+
62+IF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
63+ SET(GLEW_FOUND TRUE)
64+ SET( GLEW_LIBRARY_DIR ${GLEW_LIBRARY} )
65+ELSE (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
66+ SET( GLEW_FOUND FALSE )
67+ SET( GLEW_LIBRARY_DIR )
68+ENDIF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
69+
70
71=== modified file 'src/CMakeLists.txt'
72--- src/CMakeLists.txt 2011-02-10 20:41:30 +0000
73+++ src/CMakeLists.txt 2011-02-20 21:01:46 +0000
74@@ -114,6 +114,7 @@
75 target_link_libraries(widelands_all ${ZLIB_LIBRARY})
76 target_link_libraries(widelands_all ${GGZ_CORE_LIBRARY})
77 target_link_libraries(widelands_all ${OPENGL_gl_LIBRARY})
78+
79 if (DEFINED WL_EXTRA_LINK_LIBRARIES)
80 target_link_libraries(widelands_all ${WL_EXTRA_LINK_LIBRARIES})
81 endif (DEFINED WL_EXTRA_LINK_LIBRARIES)
82@@ -138,6 +139,7 @@
83 else (DEFINED MSVC)
84 target_link_libraries(widelands_all wsock32)
85 endif (DEFINED MSVC)
86+ target_link_libraries(widelands_all ${GLEW_LIBRARY})
87 endif (WIN32)
88
89 install(TARGETS widelands DESTINATION ${WL_INSTALL_BINDIR} COMPONENT ExecutableFiles)
90
91=== modified file 'src/graphic/render/gl_picture_texture.h'
92--- src/graphic/render/gl_picture_texture.h 2010-11-27 16:23:39 +0000
93+++ src/graphic/render/gl_picture_texture.h 2011-02-20 21:01:46 +0000
94@@ -21,6 +21,10 @@
95
96 #include <boost/scoped_array.hpp>
97
98+#ifdef WIN32
99+#define NO_SDL_GLEXT
100+#include <GL/glew.h>
101+#endif
102 #include <SDL_opengl.h>
103
104 #include "graphic/picture.h"
105
106=== modified file 'src/graphic/render/gl_utils.h'
107--- src/graphic/render/gl_utils.h 2010-11-27 16:23:39 +0000
108+++ src/graphic/render/gl_utils.h 2011-02-20 21:01:46 +0000
109@@ -20,6 +20,10 @@
110 #define GL_UTILS_H
111
112 #include <stdint.h>
113+#ifdef WIN32
114+#define NO_SDL_GLEXT
115+#include <GL/glew.h>
116+#endif
117 #include <SDL_opengl.h>
118
119 struct SDL_PixelFormat;

Subscribers

People subscribed via source and target branches

to status/vote changes: