pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3897 - in trunk/pingus: . src/display


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3897 - in trunk/pingus: . src/display
Date: Tue, 22 Jul 2008 22:53:37 +0200

Author: grumbel
Date: 2008-07-22 22:53:37 +0200 (Tue, 22 Jul 2008)
New Revision: 3897

Modified:
   trunk/pingus/SConstruct
   trunk/pingus/src/display/display.cpp
Log:
Added switch to disable OpenGL at compile time

Modified: trunk/pingus/SConstruct
===================================================================
--- trunk/pingus/SConstruct     2008-07-22 20:03:19 UTC (rev 3896)
+++ trunk/pingus/SConstruct     2008-07-22 20:53:37 UTC (rev 3897)
@@ -123,9 +123,7 @@
 'src/display/sdl_framebuffer_surface_impl.cpp', 
 'src/display/sdl_framebuffer.cpp', 
 
-'src/display/opengl_framebuffer_surface_impl.cpp', 
-'src/display/opengl_framebuffer.cpp', 
-
+'src/display/null_framebuffer.cpp', 
 'src/display/delta_framebuffer.cpp', 
 'src/display/rect_merger.cpp',
 'src/gui/group_component.cpp', 
@@ -304,11 +302,12 @@
    opts.Add('LIBPATH',    'Additional library paths',      [])
    opts.Add('CPPFLAGS',   'Additional preprocessor flags', [])
    opts.Add('CPPDEFINES', 'defined constants', [])
-   opts.Add('LIBS',       'Additional libraries', ['GL'])
+   opts.Add('LIBS',       'Additional libraries', [])
    opts.Add('CCFLAGS',    'C Compiler flags', [])
    opts.Add('CXXFLAGS',   'C++ Compiler flags', [])
    opts.Add('LINKFLAGS',  'Linker Compiler flags', [])
 
+   opts.Add(BoolOption('with_opengl',        'Build with OpenGL support', 
True))
    opts.Add(BoolOption('with_xinput',        'Build with Xinput support', 
False))
    opts.Add(BoolOption('with_linuxusbmouse', 'Build with Linux USB mouse 
support', True))
    opts.Add(BoolOption('with_linuxevdev',    'Build with Linux evdev support', 
True))
@@ -401,10 +400,19 @@
     # if ret != "":
     #   reports += "  * C++ Compiler missing: " + ret
 
+    if not env['with_opengl']:
+       reports += "  * OpenGL support: disabled\n"
+    else:
+       reports += "  * OpenGL support: enabled\n"
+       config_h_defines  += [('HAVE_OPENGL', 1)]
+       env['LIBS']       += ['GL']
+       env['optional_sources'] += 
['src/display/opengl_framebuffer_surface_impl.cpp', 
+                                   'src/display/opengl_framebuffer.cpp' ]
+
     if not env['with_linuxusbmouse']:
         reports += "  * Linux USB mouse support: disabled\n"
     else:
-        reports += "  * Linux USB mouse support: ok\n"
+        reports += "  * Linux USB mouse support: enabled\n"
         config_h_defines  += [('HAVE_LINUXUSBMOUSE', 1)]
         env['optional_sources'] += ['src/input/usbmouse_driver.cpp']
     

Modified: trunk/pingus/src/display/display.cpp
===================================================================
--- trunk/pingus/src/display/display.cpp        2008-07-22 20:03:19 UTC (rev 
3896)
+++ trunk/pingus/src/display/display.cpp        2008-07-22 20:53:37 UTC (rev 
3897)
@@ -14,9 +14,11 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#include <stdexcept>
 #include <algorithm>
 #include <stdio.h>
 #include <iostream>
+#include "../../config.h"
 #include "../globals.hpp"
 #include "../math/vector2i.hpp"
 #include "../math/rect.hpp"
@@ -24,7 +26,9 @@
 #include "../math.hpp"
 #include "../screen/screen_manager.hpp"
 #include "sdl_framebuffer.hpp"
-#include "opengl_framebuffer.hpp"
+#ifdef HAVE_OPENGL
+#  include "opengl_framebuffer.hpp"
+#endif
 #include "null_framebuffer.hpp"
 #include "delta_framebuffer.hpp"
 #include "display.hpp"
@@ -81,7 +85,11 @@
       switch (framebuffer_type)
         {
           case OPENGL_FRAMEBUFFER:
+#ifdef HAVE_OPENGL
             framebuffer = std::auto_ptr<Framebuffer>(new OpenGLFramebuffer());
+#else
+            throw std::runtime_error("OpenGL support was not compiled in");
+#endif
             break;
 
           case NULL_FRAMEBUFFER:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]