Touch-ups for GLEW_OSMESA build support

This commit is contained in:
Nigel Stewart 2015-10-08 22:03:16 +10:00
parent 11e24d4a9b
commit fd49b2baff
13 changed files with 43 additions and 56 deletions

View File

@ -7,7 +7,9 @@ script:
- make extensions
- make dist-src
- make clean; SYSTEM=linux make
- make clean; SYSTEM=linux-osmesa make
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' . ; make; popd
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' -DGLEW_OSMESA=1 .; make; popd
addons:
artifacts:
bucket: glew

View File

@ -204,8 +204,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
$(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@
$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}\n" >> $@
echo -e "\n#if defined(GLEW_OSMESA)" >> $@
echo -e "\n#elif defined(_WIN32)" >> $@
echo -e "\n#if defined(_WIN32) && ! defined(GLEW_OSMESA)" >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@
$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@
@ -214,7 +213,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(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
echo -e "\n#elif !defined(GLEW_OSMESA) && !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)" >> $@;

View File

@ -140,10 +140,10 @@ void* NSGLGetProcAddress (const GLubyte *name)
/*
* Define glewGetProcAddress.
*/
#if defined(GLEW_OSMESA)
# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
#elif defined(GLEW_REGAL)
#if defined(GLEW_REGAL)
# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name)
#elif defined(GLEW_OSMESA)
# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
#elif defined(_WIN32)
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)

View File

@ -39,11 +39,11 @@ GLenum GLEWAPIENTRY glewInit (void)
GLenum r;
r = glewContextInit();
if ( r != 0 ) return r;
#if defined(GLEW_OSMESA)
#if defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
return r;
#if defined(_WIN32)
#elif defined(_WIN32)
return wglewInit();
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
return glxewInit();
#else
return r;

View File

@ -4,7 +4,7 @@
return ret;
}
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
#elif !defined(GLEW_OSMESA) && !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

@ -4,8 +4,7 @@
return ret;
}
#if defined(GLEW_OSMESA)
#elif defined(_WIN32)
#if defined(_WIN32) && !defined(GLEW_OSMESA)
#if defined(GLEW_MX)
GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext* ctx, const char* name)

View File

@ -1,6 +1,6 @@
}
#else /* _UNIX */
#elif !defined(GLEW_OSMESA) /* _UNIX */
static void glxewInfo ()
{

View File

@ -24,11 +24,10 @@ static FILE* f;
#ifdef GLEW_MX
GLEWContext _glewctx;
#define glewGetContext() (&_glewctx)
#if defined(GLEW_OSMESA)
#elif defined(_WIN32)
#if defined(_WIN32)
WGLEWContext _wglewctx;
#define wglewGetContext() (&_wglewctx)
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
#elif !defined(GLEW_OSMESA) && !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
GLXEWContext _glxewctx;
#define glxewGetContext() (&_glxewctx)
#endif

View File

@ -129,7 +129,8 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params)
else return GL_TRUE;
++p;
}
#if defined(_WIN32)
#if defined(GLEW_OSMESA)
#elif defined(_WIN32)
else if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat"))
{
if (++p >= argc) return GL_TRUE;
@ -158,7 +159,7 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params)
#if defined(GLEW_OSMESA)
OSMesaContext ctx;
GLboolean glewCreateContext ()
GLboolean glewCreateContext (struct createParams *params)
{
ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
if (NULL == ctx) return GL_TRUE;

View File

@ -2,8 +2,7 @@
/* ------------------------------------------------------------------------ */
#if defined(GLEW_OSMESA)
#elif defined(_WIN32)
#if defined(_WIN32) && !defined(GLEW_OSMESA)
static void wglewInfo ()
{

View File

@ -14,6 +14,7 @@ set(CMAKE_DEBUG_POSTFIX d)
option (BUILD_UTILS "utilities" ON)
option (GLEW_REGAL "Regal mode" FALSE)
option (GLEW_OSMESA "OSMesa mode" FALSE)
set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
@ -54,6 +55,18 @@ if (GLEW_REGAL)
set (GLEW_LIBRARIES ${REGAL_LIB_NAME})
endif ()
#### OSMesa mode ####
if (GLEW_OSMESA)
if (WIN32)
set (OSMESA_LIB_NAME osmesa)
else ()
set (OSMESA_LIB_NAME OSMesa)
endif ()
add_definitions (-DGLEW_OSMESA)
set (GLEW_LIBRARIES ${OSMESA_LIB_NAME} ${OPENGL_LIBRARIES})
endif ()
#### GLEW ####
include_directories (${GLEW_DIR}/include)

View File

@ -1,36 +1,4 @@
NAME = $(GLEW_NAME)
CC = cc
LD = cc
M_ARCH ?= $(shell uname -m)
ARCH64 = false
ifeq (x86_64,${M_ARCH})
ARCH64 = true
endif
ifeq (ppc64,${M_ARCH})
ARCH64 = true
endif
ifeq (${ARCH64},true)
LDFLAGS.EXTRA = -L/usr/lib64
LIBDIR = $(GLEW_DEST)/lib64
else
LDFLAGS.EXTRA = -L/usr/lib
LIBDIR = $(GLEW_DEST)/lib
endif
include config/Makefile.linux
LDFLAGS.GL = -lOSMesa
LDFLAGS.STATIC = -Wl,-Bstatic
LDFLAGS.DYNAMIC = -Wl,-Bdynamic
NAME = GLEW
WARN = -Wall -W
POPT = -O2
CFLAGS.EXTRA += -fPIC -DGLEW_OSMESA
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)
CFLAGS.EXTRA += -DGLEW_OSMESA

View File

@ -264,7 +264,14 @@ void PrintExtensions (const char* s)
/* ---------------------------------------------------------------------- */
#if defined(_WIN32)
#if defined(GLEW_OSMESA)
void
VisualInfo (GLContext* ctx)
{
}
#elif defined(_WIN32)
void
VisualInfoARB (GLContext* ctx)