mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-23 07:05:07 +00:00
Merge https://github.com/nigels-com/glew.git into master HEAD at Sat Oct 10 17:44:18 GMT 2015
This commit is contained in:
commit
bd5d498437
@ -1,12 +1,15 @@
|
||||
language: cpp
|
||||
#sudo: false
|
||||
install:
|
||||
- sudo apt-get install git dos2unix
|
||||
- sudo apt-get install git cmake dos2unix libosmesa-dev
|
||||
script:
|
||||
- make -C auto clobber
|
||||
- make extensions
|
||||
- make
|
||||
- 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
|
||||
|
92
Makefile
92
Makefile
@ -64,12 +64,14 @@ DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME)
|
||||
# To disable symlinks:
|
||||
# - use LN= on gmake command-line
|
||||
|
||||
AR ?= ar
|
||||
ARFLAGS ?= cr
|
||||
INSTALL ?= install
|
||||
STRIP ?= strip
|
||||
RM ?= rm -f
|
||||
LN ?= ln -sf
|
||||
AR ?= ar
|
||||
ARFLAGS ?= cr
|
||||
INSTALL ?= install
|
||||
STRIP ?= strip
|
||||
RM ?= rm -f
|
||||
LN ?= ln -sf
|
||||
UNIX2DOS ?= unix2dos -q
|
||||
DOS2UNIX ?= dos2unix -q
|
||||
|
||||
ifneq (,$(filter debug,$(MAKECMDGOALS)))
|
||||
OPT = -g
|
||||
@ -349,12 +351,12 @@ dist-win32:
|
||||
$(RM) -f $(DIST_DIR)/bin/*/*/*.pdb $(DIST_DIR)/bin/*/*/*.exp
|
||||
$(RM) -f $(DIST_DIR)/bin/*/*/glewinfo-*.exe $(DIST_DIR)/bin/*/*/visualinfo-*.exe
|
||||
$(RM) -f $(DIST_DIR)/lib/*/*/*.pdb $(DIST_DIR)/lib/*/*/*.exp
|
||||
unix2dos $(DIST_DIR)/include/GL/*.h
|
||||
unix2dos $(DIST_DIR)/doc/*.txt
|
||||
unix2dos $(DIST_DIR)/doc/*.html
|
||||
unix2dos $(DIST_DIR)/*.txt
|
||||
$(UNIX2DOS) $(DIST_DIR)/include/GL/*.h
|
||||
$(UNIX2DOS) $(DIST_DIR)/doc/*.txt
|
||||
$(UNIX2DOS) $(DIST_DIR)/doc/*.html
|
||||
$(UNIX2DOS) $(DIST_DIR)/*.txt
|
||||
rm -f $(DIST_WIN32)
|
||||
cd $(DIST_DIR)/.. && zip -rv9 $(DIST_WIN32) $(DIST_NAME)
|
||||
cd $(DIST_DIR)/.. && zip -rq9 $(DIST_WIN32) $(DIST_NAME)
|
||||
$(RM) -r $(DIST_DIR)
|
||||
|
||||
dist-src:
|
||||
@ -377,42 +379,42 @@ dist-src:
|
||||
find $(DIST_DIR) -name CVS -o -name .cvsignore | xargs $(RM) -r
|
||||
find $(DIST_DIR) -name .svn | xargs $(RM) -r
|
||||
find $(DIST_DIR) -name "*.patch" | xargs $(RM) -r
|
||||
dos2unix $(DIST_DIR)/Makefile
|
||||
dos2unix $(DIST_DIR)/auto/Makefile
|
||||
dos2unix $(DIST_DIR)/config/*
|
||||
unix2dos $(DIST_DIR)/auto/core/*
|
||||
unix2dos $(DIST_DIR)/auto/extensions/*
|
||||
find $(DIST_DIR) -name '*.h' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.c' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.txt' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.html' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.css' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.sh' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.pl' | xargs unix2dos
|
||||
find $(DIST_DIR) -name 'Makefile' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.in' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.pm' | xargs unix2dos
|
||||
find $(DIST_DIR) -name '*.rc' | xargs unix2dos
|
||||
$(DOS2UNIX) $(DIST_DIR)/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/config/*
|
||||
$(UNIX2DOS) $(DIST_DIR)/auto/core/*
|
||||
$(UNIX2DOS) $(DIST_DIR)/auto/extensions/*
|
||||
find $(DIST_DIR) -name '*.h' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.c' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.txt' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.html' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.css' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.sh' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.pl' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name 'Makefile' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.in' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.pm' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.rc' | xargs $(UNIX2DOS)
|
||||
rm -f $(DIST_SRC_ZIP)
|
||||
cd $(DIST_DIR)/.. && zip -rv9 $(DIST_SRC_ZIP) $(DIST_NAME)
|
||||
dos2unix $(DIST_DIR)/Makefile
|
||||
dos2unix $(DIST_DIR)/auto/Makefile
|
||||
dos2unix $(DIST_DIR)/config/*
|
||||
dos2unix $(DIST_DIR)/auto/core/*
|
||||
dos2unix $(DIST_DIR)/auto/extensions/*
|
||||
find $(DIST_DIR) -name '*.h' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.c' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.txt' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.html' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.css' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.sh' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.pl' | xargs dos2unix
|
||||
find $(DIST_DIR) -name 'Makefile' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.in' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.pm' | xargs dos2unix
|
||||
find $(DIST_DIR) -name '*.rc' | xargs dos2unix
|
||||
cd $(DIST_DIR)/.. && zip -rq9 $(DIST_SRC_ZIP) $(DIST_NAME)
|
||||
$(DOS2UNIX) $(DIST_DIR)/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/config/*
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/core/*
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/extensions/*
|
||||
find $(DIST_DIR) -name '*.h' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.c' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.txt' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.html' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.css' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.sh' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.pl' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name 'Makefile' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.in' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.pm' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.rc' | xargs $(DOS2UNIX)
|
||||
rm -f $(DIST_SRC_TGZ)
|
||||
cd $(DIST_DIR)/.. && env GZIP=-9 tar cvzf $(DIST_SRC_TGZ) $(DIST_NAME)
|
||||
cd $(DIST_DIR)/.. && env GZIP=-9 tar czf $(DIST_SRC_TGZ) $(DIST_NAME)
|
||||
$(RM) -r $(DIST_DIR)
|
||||
|
||||
extensions:
|
||||
|
@ -204,7 +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(_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) >> $@
|
||||
@ -213,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)" >> $@;
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include <GL/glew.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
# define GLAPI extern
|
||||
# include <GL/osmesa.h>
|
||||
#elif defined(_WIN32)
|
||||
# include <GL/wglew.h>
|
||||
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
|
||||
# include <GL/glxew.h>
|
||||
@ -138,7 +141,9 @@ void* NSGLGetProcAddress (const GLubyte *name)
|
||||
* Define glewGetProcAddress.
|
||||
*/
|
||||
#if defined(GLEW_REGAL)
|
||||
# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *) name)
|
||||
# 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)
|
||||
|
@ -39,9 +39,11 @@ GLenum GLEWAPIENTRY glewInit (void)
|
||||
GLenum r;
|
||||
r = glewContextInit();
|
||||
if ( r != 0 ) return r;
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
|
||||
return r;
|
||||
#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;
|
||||
|
@ -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)
|
||||
|
@ -4,7 +4,7 @@
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(GLEW_OSMESA)
|
||||
|
||||
#if defined(GLEW_MX)
|
||||
GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext* ctx, const char* name)
|
||||
|
@ -1,6 +1,6 @@
|
||||
}
|
||||
|
||||
#else /* _UNIX */
|
||||
#elif !defined(GLEW_OSMESA) /* _UNIX */
|
||||
|
||||
static void glxewInfo ()
|
||||
{
|
||||
|
@ -2,7 +2,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glew.h>
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#define GLAPI extern
|
||||
#include <GL/osmesa.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
|
||||
#include <GL/glxew.h>
|
||||
@ -21,10 +24,10 @@ static FILE* f;
|
||||
#ifdef GLEW_MX
|
||||
GLEWContext _glewctx;
|
||||
#define glewGetContext() (&_glewctx)
|
||||
#ifdef _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
|
||||
@ -34,7 +37,8 @@ GLXEWContext _glxewctx;
|
||||
|
||||
struct createParams
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#elif defined(_WIN32)
|
||||
int pixelformat;
|
||||
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
|
||||
const char* display;
|
||||
|
@ -9,7 +9,8 @@ int main (int argc, char** argv)
|
||||
GLuint err;
|
||||
struct createParams params =
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#elif defined(_WIN32)
|
||||
-1, /* pixelformat */
|
||||
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||
"", /* display */
|
||||
@ -24,7 +25,8 @@ int main (int argc, char** argv)
|
||||
if (glewParseArgs(argc-1, argv+1, ¶ms))
|
||||
{
|
||||
fprintf(stderr, "Usage: glewinfo "
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#elif defined(_WIN32)
|
||||
"[-pf <pixelformat>] "
|
||||
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||
"[-display <display>] "
|
||||
@ -46,7 +48,8 @@ int main (int argc, char** argv)
|
||||
glewExperimental = GL_TRUE;
|
||||
#ifdef GLEW_MX
|
||||
err = glewContextInit(glewGetContext());
|
||||
#ifdef _WIN32
|
||||
#if defined(GLEW_OSMESA)
|
||||
#elif defined(_WIN32)
|
||||
err = err || wglewContextInit(wglewGetContext());
|
||||
#elif !defined(__HAIKU__) && !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||
err = err || glxewContextInit(glxewGetContext());
|
||||
@ -76,7 +79,8 @@ int main (int argc, char** argv)
|
||||
fprintf(f, " GLEW Extension Info\n");
|
||||
fprintf(f, "---------------------------\n\n");
|
||||
fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION));
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#elif defined(_WIN32)
|
||||
fprintf(f, "Reporting capabilities of pixelformat %d\n", params.pixelformat);
|
||||
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
|
||||
fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n",
|
||||
@ -86,7 +90,8 @@ int main (int argc, char** argv)
|
||||
glGetString(GL_RENDERER), glGetString(GL_VENDOR));
|
||||
fprintf(f, "OpenGL version %s is supported\n", glGetString(GL_VERSION));
|
||||
glewInfo();
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#elif defined(_WIN32)
|
||||
wglewInfo();
|
||||
#else
|
||||
glxewInfo();
|
||||
@ -124,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;
|
||||
@ -150,7 +156,22 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params)
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
OSMesaContext ctx;
|
||||
|
||||
GLboolean glewCreateContext (struct createParams *params)
|
||||
{
|
||||
ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
|
||||
if (NULL == ctx) return GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
void glewDestroyContext ()
|
||||
{
|
||||
if (NULL != ctx) OSMesaDestroyContext(ctx);
|
||||
}
|
||||
|
||||
#elif defined(_WIN32)
|
||||
|
||||
HWND wnd = NULL;
|
||||
HDC dc = NULL;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(GLEW_OSMESA)
|
||||
|
||||
static void wglewInfo ()
|
||||
{
|
||||
|
@ -13,6 +13,8 @@ endif()
|
||||
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}/../..)
|
||||
|
||||
@ -41,18 +43,50 @@ set (GLEW_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
|
||||
add_definitions (-DGLEW_NO_GLU)
|
||||
|
||||
#### Regal mode ####
|
||||
|
||||
if (GLEW_REGAL)
|
||||
if (WIN32)
|
||||
set (REGAL_LIB_NAME regal32)
|
||||
else ()
|
||||
set (REGAL_LIB_NAME Regal)
|
||||
endif ()
|
||||
add_definitions (-DGLEW_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)
|
||||
|
||||
add_library (glew SHARED ${GLEW_DIR}/src/glew.c)
|
||||
set (GLEW_SRC_FILES ${GLEW_DIR}/src/glew.c)
|
||||
|
||||
if (WIN32)
|
||||
list (APPEND GLEW_SRC_FILES ${GLEW_DIR}/build/glew.rc)
|
||||
endif ()
|
||||
|
||||
add_library (glew SHARED ${GLEW_SRC_FILES})
|
||||
set_target_properties (glew PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX "${DLL_PREFIX}")
|
||||
add_library (glew_s STATIC ${GLEW_DIR}/src/glew.c)
|
||||
add_library (glew_s STATIC ${GLEW_SRC_FILES})
|
||||
set_target_properties (glew_s PROPERTIES COMPILE_DEFINITIONS "GLEW_STATIC" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX lib)
|
||||
target_link_libraries (glew ${GLEW_LIBRARIES})
|
||||
target_link_libraries (glew_s ${GLEW_LIBRARIES})
|
||||
|
||||
add_library(glewmx SHARED ${GLEW_DIR}/src/glew.c )
|
||||
add_library(glewmx SHARED ${GLEW_SRC_FILES})
|
||||
set_target_properties (glewmx PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD;GLEW_MX" OUTPUT_NAME "${GLEW_LIB_NAME}mx" PREFIX "${DLL_PREFIX}")
|
||||
add_library(glewmx_s STATIC ${GLEW_DIR}/src/glew.c )
|
||||
add_library(glewmx_s STATIC ${GLEW_SRC_FILES})
|
||||
set_target_properties (glewmx_s PROPERTIES COMPILE_DEFINITIONS "GLEW_STATIC;GLEW_MX" OUTPUT_NAME "${GLEW_LIB_NAME}mx" PREFIX lib)
|
||||
target_link_libraries (glewmx ${GLEW_LIBRARIES})
|
||||
target_link_libraries (glewmx_s ${GLEW_LIBRARIES})
|
||||
@ -86,10 +120,18 @@ install ( TARGETS ${targets_to_install}
|
||||
)
|
||||
|
||||
if (BUILD_UTILS)
|
||||
add_executable (glewinfo ${GLEW_DIR}/src/glewinfo.c)
|
||||
set (GLEWINFO_SRC_FILES ${GLEW_DIR}/src/glewinfo.c)
|
||||
if (WIN32)
|
||||
list (APPEND GLEWINFO_SRC_FILES ${GLEW_DIR}/build/glewinfo.rc)
|
||||
endif ()
|
||||
add_executable (glewinfo ${GLEWINFO_SRC_FILES})
|
||||
target_link_libraries (glewinfo glew)
|
||||
|
||||
add_executable (visualinfo ${GLEW_DIR}/src/visualinfo.c)
|
||||
set (VISUALINFO_SRC_FILES ${GLEW_DIR}/src/visualinfo.c)
|
||||
if (WIN32)
|
||||
list (APPEND VISUALINFO_SRC_FILES ${GLEW_DIR}/build/visualinfo.rc)
|
||||
endif ()
|
||||
add_executable (visualinfo ${VISUALINFO_SRC_FILES})
|
||||
target_link_libraries (visualinfo glew)
|
||||
|
||||
install ( TARGETS glewinfo visualinfo
|
||||
|
4
config/Makefile.linux-osmesa
Normal file
4
config/Makefile.linux-osmesa
Normal file
@ -0,0 +1,4 @@
|
||||
include config/Makefile.linux
|
||||
|
||||
LDFLAGS.GL = -lOSMesa
|
||||
CFLAGS.EXTRA += -DGLEW_OSMESA
|
@ -34,7 +34,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glew.h>
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#define GLAPI extern
|
||||
#include <GL/osmesa.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
|
||||
#include <OpenGL/OpenGL.h>
|
||||
@ -57,7 +60,9 @@ GLXEWContext _glxewctx;
|
||||
|
||||
typedef struct GLContextStruct
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined(GLEW_OSMESA)
|
||||
OSMesaContext ctx;
|
||||
#elif defined(_WIN32)
|
||||
HWND wnd;
|
||||
HDC dc;
|
||||
HGLRC rc;
|
||||
@ -180,7 +185,8 @@ main (int argc, char** argv)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* extensions string */
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
#elif defined(_WIN32)
|
||||
/* WGL extensions */
|
||||
if (WGLEW_ARB_extensions_string || WGLEW_EXT_extensions_string)
|
||||
{
|
||||
@ -258,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)
|
||||
@ -1003,7 +1016,26 @@ VisualInfo (GLContext* ctx)
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(GLEW_OSMESA)
|
||||
void InitContext (GLContext* ctx)
|
||||
{
|
||||
ctx->ctx = NULL;
|
||||
}
|
||||
|
||||
GLboolean CreateContext (GLContext* ctx)
|
||||
{
|
||||
if (NULL == ctx) return GL_TRUE;
|
||||
ctx->ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
|
||||
if (NULL == ctx->ctx) return GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
void DestroyContext (GLContext* ctx)
|
||||
{
|
||||
if (NULL == ctx) return;
|
||||
if (NULL != ctx->ctx) OSMesaDestroyContext(ctx->ctx);
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
|
||||
void InitContext (GLContext* ctx)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user