Mesa (gallium-0.1): glut: MinGW portability fixes.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Dec 12 08:30:07 UTC 2008


Module: Mesa
Branch: gallium-0.1
Commit: d725537dbadc9a69446bc9e21aa31fdae7aa3339
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d725537dbadc9a69446bc9e21aa31fdae7aa3339

Author: José Fonseca <jrfonseca at tungstengraphics.com>
Date:   Fri Nov 21 05:26:52 2008 +0900

glut: MinGW portability fixes.

Still, it doesn't run as well as the glut binaries...

---

 include/GL/glut.h         |    2 +-
 src/SConscript            |    2 +
 src/glut/glx/SConscript   |   89 +++++++++++++++++++++++++++++++++++++++++++++
 src/glut/glx/glutint.h    |    2 +-
 src/glut/glx/glutstroke.h |    2 +-
 src/glut/glx/glutwin32.h  |    1 +
 src/glut/glx/win32_x11.h  |    2 +-
 7 files changed, 96 insertions(+), 4 deletions(-)

diff --git a/include/GL/glut.h b/include/GL/glut.h
index e286349..92eb6cf 100644
--- a/include/GL/glut.h
+++ b/include/GL/glut.h
@@ -53,7 +53,7 @@ extern "C" {
 /* To disable supression of annoying warnings about floats being promoted
    to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
    options. */
-# ifndef GLUT_NO_WARNING_DISABLE
+# if defined(_MSC_VER) && !defined(GLUT_NO_WARNING_DISABLE)
 #  pragma warning (disable:4244)  /* Disable bogus VC++ 4.2 conversion warnings. */
 #  pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */
 # endif
diff --git a/src/SConscript b/src/SConscript
index 8e914af..9116e9b 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -5,4 +5,6 @@ SConscript('gallium/SConscript')
 if 'mesa' in env['statetrackers']:
 	SConscript('mesa/SConscript')
 
+SConscript('glut/glx/SConscript')
+
 SConscript('gallium/winsys/SConscript')
diff --git a/src/glut/glx/SConscript b/src/glut/glx/SConscript
new file mode 100644
index 0000000..99b3bb7
--- /dev/null
+++ b/src/glut/glx/SConscript
@@ -0,0 +1,89 @@
+Import('*')
+
+env = env.Clone()
+
+if env['platform'] != 'windows':
+    Return()
+
+target = 'glut32'
+
+env.Replace(CPPDEFINES = [
+    'BUILD_GLUT32', 
+    'GLUT_BUILDING_LIB', 
+    'MESA', 
+    '_DLL',
+    'NDEBUG',
+    'GLUT_NO_WARNING_DISABLE',
+])
+
+env.AppendUnique(CPPPATH = [
+    '#/include',
+])
+
+env.PrependUnique(LIBS = [
+    'winmm', 
+    'gdi32', 
+    'user32', 
+    'opengl32', 
+    'glu32',
+])
+
+sources = [
+    'glut_bitmap.c',
+    'glut_bwidth.c',
+    'glut_cindex.c',
+    'glut_cmap.c',
+    'glut_cursor.c',
+    'glut_dials.c',
+    'glut_dstr.c',
+    'glut_event.c',
+    'glut_ext.c',
+    'glut_fcb.c',
+    'glut_fullscrn.c',
+    'glut_gamemode.c',
+    'glut_get.c',
+    'glut_init.c',
+    'glut_input.c',
+    'glut_joy.c',
+    'glut_key.c',
+    'glut_keyctrl.c',
+    'glut_keyup.c',
+    'glut_mesa.c',
+    'glut_modifier.c',
+    'glut_overlay.c',
+    'glut_shapes.c',
+    'glut_space.c',
+    'glut_stroke.c',
+    'glut_swap.c',
+    'glut_swidth.c',
+    'glut_tablet.c',
+    'glut_teapot.c',
+    'glut_util.c',
+    'glut_vidresize.c',
+    'glut_warp.c',
+    'glut_win.c',
+    'glut_winmisc.c',
+
+    'win32_glx.c',
+    'win32_menu.c',
+    'win32_util.c',
+    'win32_winproc.c',
+    'win32_x11.c',
+    
+    'glut_8x13.c',
+    'glut_9x15.c',
+    'glut_hel10.c',
+    'glut_hel12.c',
+    'glut_hel18.c',
+    'glut_mroman.c',
+    'glut_roman.c',
+    'glut_tr10.c',
+    'glut_tr24.c',
+
+    'glut.def',
+]
+
+env.SharedLibrary(
+    target = target,
+    source = sources,
+)
diff --git a/src/glut/glx/glutint.h b/src/glut/glx/glutint.h
index a962c78..de506a5 100644
--- a/src/glut/glx/glutint.h
+++ b/src/glut/glx/glutint.h
@@ -33,7 +33,7 @@
 #include <GL/glut.h>
 
 #if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__)
-#include <gl/mesa_wgl.h>
+#include <GL/mesa_wgl.h>
 #endif
 
 #ifndef _WIN32
diff --git a/src/glut/glx/glutstroke.h b/src/glut/glx/glutstroke.h
index cbc9e15..74b6031 100644
--- a/src/glut/glx/glutstroke.h
+++ b/src/glut/glx/glutstroke.h
@@ -7,7 +7,7 @@
    and is provided without guarantee or warrantee expressed or 
    implied. This program is -not- in the public domain. */
 
-#if defined(_WIN32)
+#if defined(_MSC_VER)
 #pragma warning (disable:4244)  /* disable bogus conversion warnings */
 #pragma warning (disable:4305)  /* VC++ 5.0 version of above warning. */
 #endif
diff --git a/src/glut/glx/glutwin32.h b/src/glut/glx/glutwin32.h
index 304eeb2..01db99f 100644
--- a/src/glut/glx/glutwin32.h
+++ b/src/glut/glx/glutwin32.h
@@ -41,6 +41,7 @@
 
 /* Private routines from win32_util.c */
 #ifndef __CYGWIN32__
+struct timeval;
 extern int gettimeofday(struct timeval* tp, void* tzp);
 #endif
 extern void *__glutFont(void *font);
diff --git a/src/glut/glx/win32_x11.h b/src/glut/glx/win32_x11.h
index 6f5c3a9..daf065e 100644
--- a/src/glut/glx/win32_x11.h
+++ b/src/glut/glx/win32_x11.h
@@ -228,7 +228,7 @@ typedef struct {
   SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)
 
 #define XSetWMName(display, window, tp) \
-  SetWindowText(window, (tp)->value)
+  SetWindowText(window, (const char *)(tp)->value)
 
 /* There really isn't a way to set the icon name separate from the
    windows name in Win32, so, just set the windows name. */




More information about the mesa-commit mailing list