mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-26 16:41:57 +00:00
Merge https://github.com/nigels-com/glew.git into master HEAD at Fri Mar 20 17:44:12 GMT 2015
This commit is contained in:
commit
69e31e274f
@ -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);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -12,10 +12,17 @@ endif()
|
||||
|
||||
option (BUILD_UTILS "utilities" ON)
|
||||
|
||||
set (GLEW_VERSION "1.12.0")
|
||||
|
||||
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)
|
||||
@ -30,27 +37,23 @@ endif ()
|
||||
find_package (OpenGL REQUIRED)
|
||||
set (GLEW_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
|
||||
add_definitions (-DGLEW_BUILD -DGLEW_NO_GLU)
|
||||
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})
|
||||
set_target_properties (glew PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME})
|
||||
set_target_properties (glew_s PROPERTIES OUTPUT_NAME ${GLEW_LIB_NAME})
|
||||
set_target_properties (glew PROPERTIES PREFIX "${DLL_PREFIX}")
|
||||
set_target_properties (glew_s PROPERTIES PREFIX lib)
|
||||
|
||||
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})
|
||||
set_target_properties (glewmx PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx)
|
||||
set_target_properties (glewmx_s PROPERTIES COMPILE_FLAGS "-DGLEW_MX" OUTPUT_NAME ${GLEW_LIB_NAME}mx)
|
||||
set_target_properties (glewmx PROPERTIES PREFIX "${DLL_PREFIX}")
|
||||
set_target_properties (glewmx_s PROPERTIES PREFIX lib)
|
||||
|
||||
install ( TARGETS glew glew_s glewmx glewmx_s
|
||||
RUNTIME DESTINATION bin
|
||||
|
Loading…
Reference in New Issue
Block a user