From Paul Martz, "There is no standard place for gl/glcorearb.h on Windows. Previously, the only way to get OSG to build for core profile was to append an additional include directory ("/I") onto the CFLAGS variables This submission adds a FindGLCORE.cmake script so that the path to gl/glcorearb.h can be specified with a variable, GLCORE_ROOT, either in CMake or the environment.
Currently this submission is Windows-only. I don't think OSX or Linux require any help in locating gl/glcorearb.h. But if they do, this submission can be easily modified. Files: - "CMakeLists.txt" is the top-level file. - FindGLCORE.cmake" and "OsgMacroUtils.cmake" go in CMakeModules. "
This commit is contained in:
parent
2bb4e0566c
commit
ecd26f9f5b
@ -528,6 +528,9 @@ IF (OSG_GL3_AVAILABLE)
|
|||||||
ELSE()
|
ELSE()
|
||||||
|
|
||||||
IF (OPENGL_PROFILE STREQUAL "GLCORE")
|
IF (OPENGL_PROFILE STREQUAL "GLCORE")
|
||||||
|
IF(WIN32)
|
||||||
|
FIND_PACKAGE(GLCORE REQUIRED)
|
||||||
|
ENDIF()
|
||||||
SET(OPENGL_HEADER1 "#include <GL/glcorearb.h>" CACHE STRING "#include<> line for OpenGL Header")
|
SET(OPENGL_HEADER1 "#include <GL/glcorearb.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
ELSE()
|
ELSE()
|
||||||
|
36
CMakeModules/FindGLCORE.cmake
Normal file
36
CMakeModules/FindGLCORE.cmake
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Finds the OpenGL Core Profile (cp) header file.
|
||||||
|
# Looks for glcorearb.h
|
||||||
|
#
|
||||||
|
# This script defines the following:
|
||||||
|
# GLCORE_FOUND // Set to TRUE if glcorearb.h is found
|
||||||
|
# GLCORE_INCLUDE_DIR // Parent directory of directory (gl, GL3, or OpenGL) containing the CP header.
|
||||||
|
# GLCORE_GLCOREARB_HEADER // advanced
|
||||||
|
#
|
||||||
|
# GLCORE_ROOT can be set as an environment variable or a CMake variable,
|
||||||
|
# to the parent directory of the gl, GL3, or OpenGL directory containing the CP header.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
FIND_PATH( GLCORE_GLCOREARB_HEADER
|
||||||
|
NAMES GL/glcorearb.h GL3/glcorearb.h OpenGL/glcorearb.h gl/glcorearb.h
|
||||||
|
HINTS ${GLCORE_ROOT}
|
||||||
|
PATHS ENV GLCORE_ROOT
|
||||||
|
)
|
||||||
|
|
||||||
|
set( GLCORE_INCLUDE_DIR )
|
||||||
|
if( GLCORE_GLCOREARB_HEADER )
|
||||||
|
set( GLCORE_INCLUDE_DIR ${GLCORE_GLCOREARB_HEADER} )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set
|
||||||
|
# GLCORE_FOUND to TRUE as appropriate
|
||||||
|
INCLUDE( FindPackageHandleStandardArgs )
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS( GLCORE
|
||||||
|
"Set GLCORE_ROOT as the parent of the directory containing the OpenGL core profile header."
|
||||||
|
GLCORE_INCLUDE_DIR )
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
GLCORE_INCLUDE_DIR
|
||||||
|
GLCORE_GLCOREARB_HEADER
|
||||||
|
)
|
@ -212,6 +212,10 @@ ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
|
|||||||
##########################################################################################################
|
##########################################################################################################
|
||||||
|
|
||||||
MACRO(SETUP_LIBRARY LIB_NAME)
|
MACRO(SETUP_LIBRARY LIB_NAME)
|
||||||
|
IF(GLCORE_FOUND)
|
||||||
|
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(ANDROID)
|
IF(ANDROID)
|
||||||
SETUP_ANDROID_LIBRARY(${LIB_NAME})
|
SETUP_ANDROID_LIBRARY(${LIB_NAME})
|
||||||
ELSE()
|
ELSE()
|
||||||
@ -247,6 +251,10 @@ MACRO(SETUP_LIBRARY LIB_NAME)
|
|||||||
ENDMACRO(SETUP_LIBRARY LIB_NAME)
|
ENDMACRO(SETUP_LIBRARY LIB_NAME)
|
||||||
|
|
||||||
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||||
|
IF(GLCORE_FOUND)
|
||||||
|
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(ANDROID)
|
IF(ANDROID)
|
||||||
SETUP_ANDROID_LIBRARY(${TARGET_DEFAULT_PREFIX}${PLUGIN_NAME})
|
SETUP_ANDROID_LIBRARY(${TARGET_DEFAULT_PREFIX}${PLUGIN_NAME})
|
||||||
ELSE()
|
ELSE()
|
||||||
@ -342,6 +350,10 @@ ENDMACRO(SETUP_PLUGIN)
|
|||||||
|
|
||||||
MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
||||||
#MESSAGE("in -->SETUP_EXE<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--")
|
#MESSAGE("in -->SETUP_EXE<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--")
|
||||||
|
IF(GL3_FOUND)
|
||||||
|
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT TARGET_TARGETNAME)
|
IF(NOT TARGET_TARGETNAME)
|
||||||
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}")
|
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}")
|
||||||
ENDIF(NOT TARGET_TARGETNAME)
|
ENDIF(NOT TARGET_TARGETNAME)
|
||||||
|
Loading…
Reference in New Issue
Block a user