Merge branch 'master' into subset

This commit is contained in:
Nigel Stewart 2015-03-29 11:57:57 +10:00
commit 9202ec1682
9 changed files with 186 additions and 106 deletions

1
.gitattributes vendored
View File

@ -1,3 +1,4 @@
* text eol=lf
*.png binary
build/*/* text eol=crlf
CMakeLists.txt text eol=lf

4
.gitignore vendored
View File

@ -6,6 +6,10 @@
/build/*/*.suo
/build/*/*.vcxproj.user
/build/*/tmp/
/build/cmake/CMakeFiles/
/build/cmake/CMakeCache.txt
/build/cmake/cmake_install.cmake
/build/cmake/Makefile
/auto/extensions
/auto/registry
/bin

View File

@ -1,82 +0,0 @@
project(GLEW)
cmake_minimum_required(VERSION 2.4)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
set(GLEW_VERSION "1.11.0")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(GLEW_LIB_NAME glew32)
else(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(GLEW_LIB_NAME GLEW)
set(DLL_PREFIX lib)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
#
# All platforms need OpenGL
#
include(FindPkgConfig)
pkg_check_modules( OpenGL REQUIRED gl )
#
# Linux needs X11
#
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
find_package(X11 REQUIRED)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_C_FLAGS "${CFLAGS} ${CMAKE_C_FLAGS} -DGLEW_BUILD -DGLEW_NO_GLU -O2 -Wall -W" )
include_directories( ${PROJECT_SOURCE_DIR}/include )
add_library(GLEW_static STATIC src/glew.c )
add_library(GLEW_shared SHARED src/glew.c )
set_target_properties(GLEW_static PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME} PREFIX lib)
set_target_properties(GLEW_shared PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME} PREFIX "${DLL_PREFIX}")
target_link_libraries(GLEW_shared ${OpenGL_LDFLAGS})
add_library(GLEW_MX_static STATIC src/glew.c )
add_library(GLEW_MX_shared SHARED src/glew.c )
set_target_properties(GLEW_MX_static PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}mx COMPILE_FLAGS "-DGLEW_MX" PREFIX lib)
set_target_properties(GLEW_MX_shared PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME}mx COMPILE_FLAGS "-DGLEW_MX" PREFIX "${DLL_PREFIX}")
target_link_libraries(GLEW_MX_shared ${OpenGL_LDFLAGS})
add_executable(glewinfo src/glewinfo.c)
target_link_libraries(glewinfo GLEW_shared ${OpenGL_LDFLAGS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(glewinfo ${X11_LIBRARIES})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_executable(visualinfo src/visualinfo.c)
target_link_libraries(visualinfo GLEW_shared ${OpenGL_LDFLAGS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(visualinfo ${X11_LIBRARIES})
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(
TARGETS
GLEW_static
GLEW_shared
GLEW_MX_static
GLEW_MX_shared
glewinfo
visualinfo
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(CODE "execute_process( COMMAND bash -x -c \"sed -e 's%@prefix@%${CMAKE_INSTALL_PREFIX}%g' -e 's%@exec_prefix@%\\\${prefix}%g' -e 's%@libdir@%\\\${prefix}/lib%g' -e 's%@includedir@%\\\${prefix}/include%g' -e 's/\@version\@/${GLEW_VERSION}/g' -e 's/\@cflags\@//g' -e 's/\@libname\@/${GLEW_LIB_NAME}/g' -e 's|@requireslib@|glu|g' < ${CMAKE_SOURCE_DIR}/glew.pc.in > ${CMAKE_BINARY_DIR}/glew.pc\" )" )
install(CODE "execute_process( COMMAND bash -x -c \"sed -e 's%@prefix@%${CMAKE_INSTALL_PREFIX}%g' -e 's%@exec_prefix@%\\\${prefix}%g' -e 's%@libdir@%\\\${prefix}/lib%g' -e 's%@includedir@%\\\${prefix}/include%g' -e 's/\@version\@/${GLEW_VERSION}/g' -e 's/\@cflags\@/-DGLEW_MX/g' -e 's/\@libname\@/${GLEW_LIB_NAME}mx/g' -e 's|@requireslib@|glu|g' < ${CMAKE_SOURCE_DIR}/glew.pc.in > ${CMAKE_BINARY_DIR}/glewmx.pc\" )" )
install(FILES ${CMAKE_BINARY_DIR}/glew.pc ${CMAKE_BINARY_DIR}/glewmx.pc DESTINATION lib/pkgconfig)

View File

@ -65,6 +65,7 @@ DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME)
# - use LN= on gmake command-line
AR ?= ar
ARFLAGS ?= cr
INSTALL ?= install
STRIP ?= strip
RM ?= rm -f
@ -104,7 +105,11 @@ lib:
mkdir lib
lib/$(LIB.STATIC): $(LIB.OBJS)
$(AR) cr $@ $^
ifneq ($(AR),)
$(AR) $(ARFLAGS) $@ $^
else ifneq ($(LIBTOOL),)
$(LIBTOOL) $@ $^
endif
ifneq ($(STRIP),)
$(STRIP) -x $@
endif
@ -148,7 +153,14 @@ glew.pc: glew.pc.in
glew.lib.mx: lib lib/$(LIB.SHARED.MX) lib/$(LIB.STATIC.MX) glewmx.pc
lib/$(LIB.STATIC.MX): $(LIB.OBJS.MX)
$(AR) cr $@ $^
ifneq ($(AR),)
$(AR) $(ARFLAGS) $@ $^
else ifneq ($(LIBTOOL),)
$(LIBTOOL) $@ $^
endif
ifneq ($(STRIP),)
$(STRIP) -x $@
endif
lib/$(LIB.SHARED.MX): $(LIB.SOBJS.MX)
$(LD) $(LDFLAGS.SO.MX) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS)

View File

@ -143,8 +143,12 @@ $(I.DEST)/glew.h: $(EXT)/.dummy
$(BIN)/make_struct_var.pl GLEW_VAR_EXPORT $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
echo -e "\n#ifdef GLEW_MX\n}; /* GLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@
perl -e "s/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/" -pi $@
rm -f $@.bak
cat $(SRC)/glew_tail.h >> $@
perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@
perl -e "s/GLEW_VERSION_MAJOR_STRING/$(GLEW_MAJOR)/g" -pi $@
perl -e "s/GLEW_VERSION_MINOR_STRING/$(GLEW_MINOR)/g" -pi $@
perl -e "s/GLEW_VERSION_MICRO_STRING/$(GLEW_MICRO)/g" -pi $@
rm -f $@.bak
$(I.DEST)/wglew.h: $(EXT)/.dummy
@echo "--------------------------------------------------------------------"

View File

@ -13,6 +13,17 @@
#define GLEW_VERSION_MINOR 3
#define GLEW_VERSION_MICRO 4
/* ------------------------------------------------------------------------- */
/* GLEW version info */
/*
VERSION GLEW_VERSION_STRING
VERSION_MAJOR GLEW_VERSION_MAJOR_STRING
VERSION_MINOR GLEW_VERSION_MINOR_STRING
VERSION_MICRO GLEW_VERSION_MICRO_STRING
*/
/* API */
#ifdef GLEW_MX

View File

@ -185,26 +185,34 @@ void glewDestroyContext ()
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
#include <AGL/agl.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/CGLTypes.h>
AGLContext ctx, octx;
CGLContextObj ctx, octx;
GLboolean glewCreateContext ()
{
int attrib[] = { AGL_RGBA, AGL_NONE };
AGLPixelFormat pf;
/*int major, minor;
SetPortWindowPort(wnd);
aglGetVersion(&major, &minor);
fprintf(stderr, "GL %d.%d\n", major, minor);*/
pf = aglChoosePixelFormat(NULL, 0, attrib);
if (NULL == pf) return GL_TRUE;
ctx = aglCreateContext(pf, NULL);
if (NULL == ctx || AGL_NO_ERROR != aglGetError()) return GL_TRUE;
aglDestroyPixelFormat(pf);
/*aglSetDrawable(ctx, GetWindowPort(wnd));*/
octx = aglGetCurrentContext();
if (GL_FALSE == aglSetCurrentContext(ctx)) return GL_TRUE;
const CGLPixelFormatAttribute attrib[4] =
{
kCGLPFAAccelerated, /* No software rendering */
#if 0
kCGLPFAOpenGLProfile, /* OSX 10.7 Lion onwards */
(CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core, /* 3.2 Core Context */
#endif
0
};
CGLPixelFormatObj pf;
GLint npix;
CGLError error;
error = CGLChoosePixelFormat(attrib, &pf, &npix);
if (error) return GL_TRUE;
error = CGLCreateContext(pf, NULL, &ctx);
if (error) return GL_TRUE;
CGLReleasePixelFormat(pf);
octx = CGLGetCurrentContext();
error = CGLSetCurrentContext(ctx);
if (error) return GL_TRUE;
/* Needed for Regal on the Mac */
#if defined(GLEW_REGAL) && defined(__APPLE__)
RegalMakeCurrent(ctx);
@ -214,8 +222,8 @@ GLboolean glewCreateContext ()
void glewDestroyContext ()
{
aglSetCurrentContext(octx);
if (NULL != ctx) aglDestroyContext(ctx);
CGLSetCurrentContext(octx);
CGLReleaseContext(ctx);
}
/* ------------------------------------------------------------------------ */

View File

@ -0,0 +1,91 @@
if ( NOT DEFINED CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" )
endif ()
project (glew)
cmake_minimum_required (VERSION 2.4)
if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
endif()
option (BUILD_UTILS "utilities" ON)
set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
# get version from config/version
file (STRINGS ${GLEW_DIR}/config/version _VERSION_MAJOR_STRING REGEX "GLEW_MAJOR[ ]*=[ ]*[0-9]+.*")
string (REGEX REPLACE "GLEW_MAJOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${_VERSION_MAJOR_STRING})
file (STRINGS ${GLEW_DIR}/config/version _VERSION_MINOR_STRING REGEX "GLEW_MINOR[ ]*=[ ]*[0-9]+.*")
string (REGEX REPLACE "GLEW_MINOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MINOR ${_VERSION_MINOR_STRING})
file (STRINGS ${GLEW_DIR}/config/version _VERSION_PATCH_STRING REGEX "GLEW_MICRO[ ]*=[ ]*[0-9]+.*")
string (REGEX REPLACE "GLEW_MICRO[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${_VERSION_PATCH_STRING})
set (GLEW_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if (WIN32)
set (GLEW_LIB_NAME glew32)
else ()
set (GLEW_LIB_NAME GLEW)
set (DLL_PREFIX lib)
endif ()
find_package (OpenGL REQUIRED)
set (GLEW_LIBRARIES ${OPENGL_LIBRARIES})
add_definitions (-DGLEW_NO_GLU)
include_directories (${GLEW_DIR}/include)
add_library (glew SHARED ${GLEW_DIR}/src/glew.c)
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)
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 )
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 )
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})
install ( TARGETS glew glew_s glewmx glewmx_s
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
)
if (BUILD_UTILS)
add_executable (glewinfo ${GLEW_DIR}/src/glewinfo.c)
target_link_libraries (glewinfo glew)
add_executable (visualinfo ${GLEW_DIR}/src/visualinfo.c)
target_link_libraries (visualinfo glew)
install ( TARGETS glewinfo visualinfo
DESTINATION bin)
endif ()
set (prefix ${CMAKE_INSTALL_PREFIX})
set (exec_prefix \${prefix})
set (libdir \${prefix}/lib)
set (includedir \${prefix}/include)
set (includedir \${prefix}/include)
set (version ${GLEW_VERSION})
set (libname ${GLEW_LIB_NAME})
set (cflags)
set (requireslib glu)
configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glew.pc @ONLY)
set (cflags "-DGLEW_MX")
set (libname ${GLEW_LIB_NAME}mx)
configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glewmx.pc @ONLY)
install(FILES ${GLEW_DIR}/glew.pc ${GLEW_DIR}/glewmx.pc
DESTINATION lib/pkgconfig
)

View File

@ -0,0 +1,31 @@
NAME = $(GLEW_NAME)
CC = cc
LD = cc
AR =
LIBTOOL = libtool -static -o
STRIP =
CFLAGS.EXTRA = -dynamic -fno-common
#CFLAGS.EXTRA += -no-cpp-precomp
CFLAGS.EXTRA += -arch i386 -arch x86_64
LDFLAGS.EXTRA = -arch i386 -arch x86_64
ifneq (undefined, $(origin GLEW_APPLE_GLX))
CFLAGS.EXTRA += -I/usr/X11R6/include -D'GLEW_APPLE_GLX'
LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11
else
LDFLAGS.GL = -framework AGL -framework OpenGL
endif
LDFLAGS.DYNAMIC =
WARN = -Wall -W
POPT = -O2
CFLAGS.EXTRA += -fPIC
BIN.SUFFIX =
LIB.SONAME = lib$(NAME).$(SO_MAJOR).dylib
LIB.DEVLNK = lib$(NAME).dylib
LIB.SHARED = lib$(NAME).$(SO_VERSION).dylib
LIB.STATIC = lib$(NAME).a
LDFLAGS.SO = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
LIB.SONAME.MX = lib$(NAME)mx.$(SO_MAJOR).dylib
LIB.DEVLNK.MX = lib$(NAME)mx.dylib
LIB.SHARED.MX = lib$(NAME)mx.$(SO_VERSION).dylib
LIB.STATIC.MX = lib$(NAME)mx.a
LDFLAGS.SO.MX = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED.MX) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)