Added CMake test for presence of GLuint64 and GLint64 in OpenGL/GLES headers to better handle when/where GL defines the 64 bit typedefs

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15001 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-07-22 13:49:14 +00:00
parent 7c4b5febcb
commit 000c9af7c2
2 changed files with 34 additions and 5 deletions

View File

@ -574,11 +574,32 @@ ENDIF()
################################################################################
# Set Config/OpenGL header file
# Set Config header file
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
"${OPENSCENEGRAPH_CONFIG_HEADER}")
################################################################################
# Set OpenGL header file
INCLUDE (CheckCXXSourceCompiles)
#SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIR})
check_cxx_source_compiles(
"${OPENGL_HEADER1}
${OPENGL_HEADER2}
int main() { GLint64 test; return 0; }"
GL_HEADER_HAS_GLINT64
)
check_cxx_source_compiles(
"${OPENGL_HEADER1}
${OPENGL_HEADER2}
int main() { GLuint64 test; return 0; }"
GL_HEADER_HAS_GLUINT64
)
SET(OPENSCENEGRAPH_OPENGL_HEADER "${PROJECT_BINARY_DIR}/include/osg/GL")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
@ -588,7 +609,7 @@ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
################################################################################
# Set Vertsion header file
# Set Version header file
SET(OPENSCENEGRAPH_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/osg/Version")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"

View File

@ -36,6 +36,8 @@
#define OSG_GLES1_FEATURES @OSG_GLES1_FEATURES@
#define OSG_GLES2_FEATURES @OSG_GLES2_FEATURES@
#define OSG_GLES3_FEATURES @OSG_GLES3_FEATURES@
#define GL_HEADER_HAS_GLINT64 @GL_HEADER_HAS_GLINT64@
#define GL_HEADER_HAS_GLUINT64 @GL_HEADER_HAS_GLUINT64@
#ifndef WIN32
@ -115,12 +117,18 @@
#endif // GL_APIENTRY
#if !defined(GL_VERSION_3_1)
#if !GL_HEADER_HAS_GLINT64
#ifdef _WIN32
typedef __int64 GLint64;
typedef unsigned __int64 GLuint64;
typedef __int64 GLint64;
#else
typedef long long int GLint64;
#endif
#endif
#if !GL_HEADER_HAS_GLUINT64
#ifdef _WIN32
typedef unsigned __int64 GLuint64;
#else
typedef unsigned long long int GLuint64;
#endif
#endif