Added a dedicated FindEGL.cmake script to help with locating the EGL.so library and header
This commit is contained in:
parent
afb046a196
commit
4e5f0fc3a5
@ -273,7 +273,6 @@ IF(APPLE)
|
||||
# libosgViewer would use X11/OpenGL, which causes compatibility
|
||||
# issues for applications using OSG.
|
||||
UNSET(OPENGL_gl_LIBRARY CACHE)
|
||||
UNSET(OPENGL_glu_LIBRARY CACHE)
|
||||
UNSET(OPENGL_INCLUDE_DIR CACHE)
|
||||
IF(OSG_WINDOWING_SYSTEM STREQUAL "X11")
|
||||
FIND_PACKAGE(X11)
|
||||
@ -284,7 +283,6 @@ IF(APPLE)
|
||||
# Use X11 version of OpenGL as seed for CMake FindOpenGL
|
||||
GET_FILENAME_COMPONENT(X11LIBDIR ${X11_X11_LIB} DIRECTORY)
|
||||
FIND_LIBRARY(OPENGL_gl_LIBRARY GL PATHS ${X11LIBDIR} DOC "OpenGL lib for OSX" NO_DEFAULT_PATH)
|
||||
FIND_LIBRARY(OPENGL_glu_LIBRARY GLU PATHS ${X11LIBDIR} DOC "GLU lib for OSX" NO_DEFAULT_PATH)
|
||||
SET(OPENGL_INCLUDE_DIR ${X11_INCLUDE_DIR} CACHE PATH "Include for OpenGL on OSX" FORCE)
|
||||
|
||||
ELSEIF(OSG_WINDOWING_SYSTEM STREQUAL "Carbon")
|
||||
@ -293,6 +291,7 @@ IF(APPLE)
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(OpenGL)
|
||||
FIND_PACKAGE(EGL)
|
||||
ENDIF ()
|
||||
|
||||
OPTION(OSG_COMPILE_FRAMEWORKS "compile frameworks instead of dylibs (experimental)" OFF)
|
||||
@ -300,6 +299,7 @@ IF(APPLE)
|
||||
ELSE()
|
||||
# Non-Apple: Find OpenGL
|
||||
FIND_PACKAGE(OpenGL)
|
||||
FIND_PACKAGE(EGL)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
@ -509,8 +509,6 @@ ENDIF()
|
||||
|
||||
OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF)
|
||||
|
||||
SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
|
||||
|
||||
# Map the OSG_GL*_AVAILABLE settings to OSG_GL_* settings
|
||||
IF (OSG_GLES2_AVAILABLE OR OSG_GL3_AVAILABLE)
|
||||
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF)
|
||||
|
33
CMakeModules/FindEGL.cmake
Normal file
33
CMakeModules/FindEGL.cmake
Normal file
@ -0,0 +1,33 @@
|
||||
# Finds EGL header and library
|
||||
#
|
||||
# This script defines the following:
|
||||
# EGL_FOUND // Set to TRUE if EGL is found
|
||||
# EGL_INCLUDE_DIR // Parent directory of directory EGL/egl.h header.
|
||||
#
|
||||
# EGL_DIR can be set as an environment variable or a CMake variable,
|
||||
# to the parent directory of the EGL header.
|
||||
#
|
||||
|
||||
|
||||
FIND_PATH( EGL_INCLUDE_DIR
|
||||
NAMES EGL/egl.h
|
||||
HINTS ENV EGL_DIR
|
||||
)
|
||||
|
||||
FIND_LIBRARY(EGL_LIBRARY
|
||||
NAMES EGL
|
||||
HINTS ENV EGL_DIR
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set
|
||||
# EGL_FOUND to TRUE as appropriate
|
||||
INCLUDE( FindPackageHandleStandardArgs )
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EGL
|
||||
REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
EGL_INCLUDE_DIR
|
||||
EGL_LIBRARY
|
||||
)
|
@ -82,8 +82,8 @@ ENDMACRO(LINK_EXTERNAL TRGTNAME)
|
||||
MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
|
||||
#SET(ALL_GL_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
SET(ALL_GL_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE)
|
||||
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
|
||||
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE OR OSG_GLES3_AVAILABLE)
|
||||
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${EGL_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES})
|
||||
@ -133,8 +133,8 @@ MACRO(SETUP_LINK_LIBRARIES)
|
||||
|
||||
#SET(ALL_GL_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
SET(ALL_GL_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE)
|
||||
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
|
||||
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE OR OSG_GLES3_AVAILABLE)
|
||||
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${EGL_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
# FOREACH(LINKLIB ${TARGET_LIBRARIES})
|
||||
|
Loading…
Reference in New Issue
Block a user