For patch #49 Add Haiku platform support

Adpated from patch, infrastructure for Haiku OS support, not yet complete.
This commit is contained in:
Nigel Stewart 2013-12-09 15:20:56 -06:00
parent 98e09c1564
commit 59de259605
9 changed files with 98 additions and 16 deletions

View File

@ -209,7 +209,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
cat $(SRC)/glew_init_wgl.c >> $@
$(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}" >> $@;
echo -e "\n#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
echo -e "\n#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@
$(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@;
@ -224,7 +224,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
$(BIN)/make_list.pl $(GLX_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}" >> $@
echo -e "\n#endif /* !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */\n" >> $@;
echo -e "\n#endif /* !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */\n" >> $@;
cat $(SRC)/glew_init_tail.c >> $@
cat $(SRC)/glew_str_head.c >> $@
$(BIN)/make_str.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@

View File

@ -2,7 +2,7 @@
#if defined(_WIN32)
# include <GL/wglew.h>
#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
# include <GL/glxew.h>
#endif
@ -35,7 +35,7 @@
# define GLXEW_CONTEXT_ARG_DEF_LIST void
#endif /* GLEW_MX */
#if defined(__sgi) || defined (__sun) || defined(GLEW_APPLE_GLX)
#if defined(__sgi) || defined (__sun) || defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
@ -131,7 +131,7 @@ void* NSGLGetProcAddress (const GLubyte *name)
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
# define glewGetProcAddress(name) NSGLGetProcAddress(name)
#elif defined(__sgi) || defined(__sun)
#elif defined(__sgi) || defined(__sun) || defined(__HAIKU__)
# define glewGetProcAddress(name) dlGetProcAddress(name)
#elif defined(__ANDROID__)
# define glewGetProcAddress(name) NULL /* TODO */

View File

@ -36,7 +36,7 @@ GLboolean glewExperimental = GL_FALSE;
#if defined(_WIN32)
extern GLenum GLEWAPIENTRY wglewContextInit (void);
#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
extern GLenum GLEWAPIENTRY glxewContextInit (void);
#endif /* _WIN32 */
@ -47,7 +47,7 @@ GLenum GLEWAPIENTRY glewInit (void)
if ( r != 0 ) return r;
#if defined(_WIN32)
return wglewContextInit();
#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */
return glxewContextInit();
#else
return r;

View File

@ -4,7 +4,7 @@
return ret;
}
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#if defined(GLEW_MX)
GLboolean glxewContextIsSupported (const GLXEWContext* ctx, const char* name)

View File

@ -32,7 +32,7 @@
#include <GL/glew.h>
#if defined(_WIN32)
# include <GL/wglew.h>
#elif !defined(__ANDROID__) && !defined(__native_client__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
# include <GL/glxew.h>
#endif

View File

@ -4,7 +4,7 @@
#include <GL/glew.h>
#if defined(_WIN32)
#include <GL/wglew.h>
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
#include <GL/glxew.h>
#endif
@ -20,7 +20,7 @@ GLEWContext _glewctx;
#ifdef _WIN32
WGLEWContext _wglewctx;
#define wglewGetContext() (&_wglewctx)
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
GLXEWContext _glxewctx;
#define glxewGetContext() (&_glxewctx)
#endif
@ -28,7 +28,7 @@ GLXEWContext _glxewctx;
#if defined(_WIN32)
GLboolean glewCreateContext (int* pixelformat);
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
GLboolean glewCreateContext (const char* display, int* visual);
#else
GLboolean glewCreateContext ();

View File

@ -215,6 +215,21 @@ void glewDestroyContext ()
/* ------------------------------------------------------------------------ */
#elif defined(__HAIKU__)
GLboolean glewCreateContext ()
{
/* TODO: Haiku: We need to call C++ code here */
return GL_FALSE;
}
void glewDestroyContext ()
{
/* TODO: Haiku: We need to call C++ code here */
}
/* ------------------------------------------------------------------------ */
#else /* __UNIX || (__APPLE__ && GLEW_APPLE_GLX) */
Display* dpy = NULL;

29
config/Makefile.haiku Normal file
View File

@ -0,0 +1,29 @@
NAME = $(GLEW_NAME)
CC = cc
LD = cc
ifneq (undefined, $(origin GLEW_MX))
CFLAGS.EXTRA = -DGLEW_MX
endif
LDFLAGS.GL = -lGL
LDFLAGS.STATIC = -Wl,-Bstatic
LDFLAGS.DYNAMIC = -Wl,-Bdynamic
NAME = GLEW
WARN = -Wall -W
POPT = -O2
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(SO_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(SO_VERSION)
LIB.STATIC = lib$(NAME).a
LDFLAGS.SO = -shared -Wl,-soname=$(LIB.SONAME)
LIB.SONAME.MX = lib$(NAME)mx.so.$(SO_MAJOR)
LIB.DEVLNK.MX = lib$(NAME)mx.so
LIB.SHARED.MX = lib$(NAME)mx.so.$(SO_VERSION)
LIB.STATIC.MX = lib$(NAME)mx.a
LDFLAGS.SO.MX = -shared -Wl,-soname=$(LIB.SONAME.MX)

View File

@ -4,6 +4,7 @@
** Copyright (C) Nate Robins, 1997
** Michael Wimmer, 1999
** Milan Ikits, 2002-2008
** Nigel Stewart, 2008-2013
**
** visualinfo is a small utility that displays all available visuals,
** aka. pixelformats, in an OpenGL system along with renderer version
@ -37,7 +38,7 @@
#include <GL/wglew.h>
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
#include <AGL/agl.h>
#else
#elif !defined(__HAIKU__)
#include <GL/glxew.h>
#endif
@ -47,7 +48,7 @@ GLEWContext _glewctx;
# ifdef _WIN32
WGLEWContext _wglewctx;
# define wglewGetContext() (&_wglewctx)
# elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
# elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
GLXEWContext _glxewctx;
# define glxewGetContext() (&_glxewctx)
# endif
@ -61,7 +62,7 @@ typedef struct GLContextStruct
HGLRC rc;
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
AGLContext ctx, octx;
#else
#elif !defined(__HAIKU__)
Display* dpy;
XVisualInfo* vi;
GLXContext ctx;
@ -129,7 +130,7 @@ main (int argc, char** argv)
err = glewContextInit(glewGetContext());
# ifdef _WIN32
err = err || wglewContextInit(wglewGetContext());
# elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
# elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
err = err || glxewContextInit(glxewGetContext());
# endif
#else
@ -182,6 +183,10 @@ main (int argc, char** argv)
}
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
#elif defined(__HAIKU__)
/* TODO */
#else
/* GLX extensions */
fprintf(file, "GLX extensions (GLX_): \n");
@ -598,6 +603,16 @@ VisualInfo (GLContext* ctx)
*/
}
/* ---------------------------------------------------------------------- */
#elif defined(__HAIKU__)
void
VisualInfo (GLContext* ctx)
{
/* TODO */
}
#else /* GLX */
void
@ -1074,6 +1089,29 @@ void DestroyContext (GLContext* ctx)
/* ------------------------------------------------------------------------ */
#elif defined(__HAIKU__)
void
InitContext (GLContext* ctx)
{
/* TODO */
}
GLboolean
CreateContext (GLContext* ctx)
{
/* TODO */
return GL_FALSE;
}
void
DestroyContext (GLContext* ctx)
{
/* TODO */
}
/* ------------------------------------------------------------------------ */
#else /* __UNIX || (__APPLE__ && GLEW_APPLE_GLX) */
void InitContext (GLContext* ctx)