diff --git a/README.md b/README.md index a85faa9..9c89385 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/auto/doc/index.html b/auto/doc/index.html index 998b119..ba91705 100644 --- a/auto/doc/index.html +++ b/auto/doc/index.html @@ -60,6 +60,7 @@ An up-to-date copy is also available using git Unsupported snapshots are also available:
diff --git a/auto/src/glew_init_gl.c b/auto/src/glew_init_gl.c index 25c9b74..c153720 100644 --- a/auto/src/glew_init_gl.c +++ b/auto/src/glew_init_gl.c @@ -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); diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index d1c367b..5388b18 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -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 $