mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-09 22:00:06 +00:00
Moved GL version check out of FindGLEW.cmake
This allows us to make use of this even when we are not using GLEW.
This commit is contained in:
parent
b738fa1225
commit
16a5c3993f
@ -428,6 +428,36 @@ if(GLEW_FOUND)
|
|||||||
add_definitions( -DOSD_USES_GLEW )
|
add_definitions( -DOSD_USES_GLEW )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
macro(osd_detect_gl_version header)
|
||||||
|
|
||||||
|
if (EXISTS "${header}")
|
||||||
|
file(STRINGS "${header}" VERSION_4_2 REGEX "^#define GL_VERSION_4_2.*$")
|
||||||
|
if (VERSION_4_2)
|
||||||
|
set(OPENGL_4_2_FOUND TRUE)
|
||||||
|
else ()
|
||||||
|
message(WARNING "OpenGL 4.2 dependent features not enabled")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
file(STRINGS "${header}" VERSION_4_3 REGEX "^#define GL_VERSION_4_3.*$")
|
||||||
|
if (VERSION_4_3)
|
||||||
|
SET(OPENGL_4_3_FOUND TRUE)
|
||||||
|
else ()
|
||||||
|
message(WARNING "OpenGL 4.3 dependent features not enabled")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(GLEW_FOUND AND GLEW_INCLUDE_DIR)
|
||||||
|
|
||||||
|
osd_detect_gl_version(${GLEW_INCLUDE_DIR}/GL/glew.h)
|
||||||
|
|
||||||
|
elseif(OPENGL_FOUND AND OPENGL_INCLUDE_DIR)
|
||||||
|
|
||||||
|
osd_detect_gl_version(${OPENGL_INCLUDE_DIR}/GL/glext.h)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
# note : (GLSL transform feedback kernels require GL 4.2)
|
# note : (GLSL transform feedback kernels require GL 4.2)
|
||||||
if(GLEW_FOUND AND OPENGL_4_2_FOUND)
|
if(GLEW_FOUND AND OPENGL_4_2_FOUND)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
|
@ -100,28 +100,6 @@ if (${CMAKE_HOST_UNIX})
|
|||||||
DOC "The GLEW library")
|
DOC "The GLEW library")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (GLEW_INCLUDE_DIR AND EXISTS "${GLEW_INCLUDE_DIR}/GL/glew.h")
|
|
||||||
|
|
||||||
file(STRINGS "${GLEW_INCLUDE_DIR}/GL/glew.h" GLEW_4_2 REGEX "^#define GL_VERSION_4_2.*$")
|
|
||||||
if (GLEW_4_2)
|
|
||||||
set(OPENGL_4_2_FOUND TRUE)
|
|
||||||
else ()
|
|
||||||
message(WARNING
|
|
||||||
"glew-1.7.0 or newer needed for supporting OpenGL 4.2 dependent features"
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
file(STRINGS "${GLEW_INCLUDE_DIR}/GL/glew.h" GLEW_4_3 REGEX "^#define GL_VERSION_4_3.*$")
|
|
||||||
if (GLEW_4_3)
|
|
||||||
SET(OPENGL_4_3_FOUND TRUE)
|
|
||||||
else ()
|
|
||||||
message(WARNING
|
|
||||||
"glew-1.9.0 or newer needed for supporting OpenGL 4.3 dependent features"
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
find_package_handle_standard_args(GLEW
|
find_package_handle_standard_args(GLEW
|
||||||
REQUIRED_VARS
|
REQUIRED_VARS
|
||||||
GLEW_INCLUDE_DIR
|
GLEW_INCLUDE_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user