Merge https://github.com/nigels-com/glew.git into master HEAD at Sat Apr 2 17:44:22 GMT 2016

This commit is contained in:
omniavinco 2016-04-03 02:44:22 +09:00
commit ebeeabace8
5 changed files with 53 additions and 19 deletions

View File

@ -24,13 +24,14 @@ Windows binaries for [32-bit and 64-bit](https://sourceforge.net/projects/glew/f
Snapshots may contain new features, bug-fixes or new OpenGL extensions ahead of tested, official releases.
[glew-20160402.tgz](http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20160402.tgz/download)
*GLEW 2.0.0 release candidate, Core context, EGL support, no MX*
[glew-20160131.tgz](http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20160131.tgz/download)
*GLEW 2.0.0 release candidate: Core context support, MX discontinued*
[glew-20151117.tgz](http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20151117.tgz/download)
[glew-20150805.tgz](http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20150805.tgz/download)
## Build
From a downloaded tarball or zip archive:

View File

@ -60,6 +60,7 @@ An up-to-date copy is also available using <a href="http://git-scm.com/">git</a>
<a href="https://sourceforge.net/projects/glew/files/glew/snapshots/">Unsupported snapshots</a> are also available:
</p>
<ul>
<li><a href="http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20160402.tgz/download">glew-20160402.tgz</a></li>
<li><a href="http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20160131.tgz/download">glew-20160131.tgz</a></li>
<li><a href="http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20151117.tgz/download">glew-20151117.tgz</a></li>
</ul>

View File

@ -81,11 +81,15 @@ static GLenum GLEWAPIENTRY glewContextInit ()
GLint major, minor;
size_t n;
/* query opengl version */
getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString");
#ifdef _WIN32
getString = glGetString;
#else
getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString");
if (!getString)
return GLEW_ERROR_NO_GL_VERSION;
#endif
/* query opengl version */
s = getString(GL_VERSION);
dot = _glewStrCLen(s, '.');
if (dot == 0)
@ -137,7 +141,12 @@ static GLenum GLEWAPIENTRY glewContextInit ()
const char *ext;
GLboolean *enable;
#ifdef _WIN32
getIntegerv = glGetIntegerv;
#else
getIntegerv = (PFNGLGETINTEGERVPROC) glewGetProcAddress((const GLubyte*)"glGetIntegerv");
#endif
if (getIntegerv)
getIntegerv(GL_NUM_EXTENSIONS, &n);

View File

@ -6,6 +6,8 @@ project (glew)
cmake_minimum_required (VERSION 2.8.7)
include(GNUInstallDirs)
if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
endif()
@ -13,8 +15,11 @@ endif()
set(CMAKE_DEBUG_POSTFIX d)
option (BUILD_UTILS "utilities" ON)
option (GLEW_REGAL "Regal mode" FALSE)
option (GLEW_OSMESA "OSMesa mode" FALSE)
option (GLEW_REGAL "Regal mode" OFF)
option (GLEW_OSMESA "OSMesa mode" OFF)
if (APPLE)
option (BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
endif ()
set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
@ -74,16 +79,18 @@ endif ()
include_directories (${GLEW_DIR}/include)
set (GLEW_PUBLIC_HEADERS_FILES ${GLEW_DIR}/include/GL/wglew.h ${GLEW_DIR}/include/GL/glew.h ${GLEW_DIR}/include/GL/glxew.h)
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})
add_library (glew SHARED ${GLEW_PUBLIC_HEADERS_FILES} ${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_SRC_FILES})
add_library (glew_s STATIC ${GLEW_PUBLIC_HEADERS_FILES} ${GLEW_SRC_FILES})
set_target_properties (glew_s PROPERTIES COMPILE_DEFINITIONS "GLEW_STATIC" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX lib)
if (MSVC)
# add options from visual studio project
target_compile_definitions (glew PRIVATE "GLEW_BUILD;VC_EXTRALEAN")
@ -101,6 +108,20 @@ elseif (WIN32 AND ((CMAKE_C_COMPILER_ID MATCHES "GNU") OR (CMAKE_C_COMPILER_ID M
target_compile_options (glew_s PRIVATE -fno-builtin -fno-stack-protector)
target_link_libraries (glew LINK_PRIVATE -nostdlib)
endif ()
if (BUILD_FRAMEWORK)
set_target_properties(glew PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${GLEW_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER net.sourceforge.glew
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${GLEW_VERSION}
MACOSX_FRAMEWORK_BUNDLE_VERSION ${GLEW_VERSION}
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
PUBLIC_HEADER "${GLEW_PUBLIC_HEADERS_FILES}"
OUTPUT_NAME GLEW
)
endif()
target_link_libraries (glew LINK_PUBLIC ${GLEW_LIBRARIES})
target_link_libraries (glew_s ${GLEW_LIBRARIES})
@ -108,7 +129,7 @@ if(CMAKE_VERSION VERSION_LESS 2.8.12)
set(MAYBE_EXPORT "")
else()
target_compile_definitions(glew_s INTERFACE "GLEW_STATIC")
foreach(t glew glew_s )
foreach(t glew glew_s)
target_include_directories(${t} PUBLIC $<INSTALL_INTERFACE:include>)
endforeach()
set(MAYBE_EXPORT EXPORT glew-targets)
@ -116,18 +137,19 @@ endif()
set(targets_to_install "")
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
list(APPEND targets_to_install glew )
list(APPEND targets_to_install glew)
endif()
if(NOT DEFINED BUILD_SHARED_LIBS OR NOT BUILD_SHARED_LIBS)
list(APPEND targets_to_install glew_s )
list(APPEND targets_to_install glew_s)
endif()
install ( TARGETS ${targets_to_install}
${MAYBE_EXPORT}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION lib${LIB_SUFFIX}
)
if (BUILD_UTILS)
@ -152,7 +174,7 @@ if (BUILD_UTILS)
endif ()
install ( TARGETS glewinfo visualinfo
DESTINATION bin)
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
set (prefix ${CMAKE_INSTALL_PREFIX})
@ -167,20 +189,20 @@ set (requireslib glu)
configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glew.pc @ONLY)
install(FILES ${GLEW_DIR}/glew.pc
DESTINATION lib/pkgconfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
install (FILES
${GLEW_DIR}/include/GL/wglew.h
${GLEW_DIR}/include/GL/glew.h
${GLEW_DIR}/include/GL/glxew.h
DESTINATION include/GL)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL)
if(MAYBE_EXPORT)
install(EXPORT glew-targets DESTINATION lib/cmake/glew
install(EXPORT glew-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
NAMESPACE GLEW::)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/glew-config.cmake
${CMAKE_CURRENT_SOURCE_DIR}/CopyImportedTargetProperties.cmake
DESTINATION lib/cmake/glew)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew)
endif()

View File

@ -158,6 +158,7 @@ An up-to-date copy is also available using <a href="http://git-scm.com/">git</a>
<a href="https://sourceforge.net/projects/glew/files/glew/snapshots/">Unsupported snapshots</a> are also available:
</p>
<ul>
<li><a href="http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20160402.tgz/download">glew-20160402.tgz</a></li>
<li><a href="http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20160131.tgz/download">glew-20160131.tgz</a></li>
<li><a href="http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20151117.tgz/download">glew-20151117.tgz</a></li>
</ul>