forked from Mirrorlandia_minetest/minetest
Clean up FindOpenGLES2.cmake
This commit is contained in:
parent
6c2ded4cac
commit
d0246cfdcc
@ -1,6 +1,4 @@
|
|||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
# This file is stolen from part of the CMake build system for OGRE (Object-oriented Graphics Rendering Engine) http://www.ogre3d.org/
|
|
||||||
#
|
|
||||||
# The contents of this file are placed in the public domain. Feel
|
# The contents of this file are placed in the public domain. Feel
|
||||||
# free to make use of it in any way you like.
|
# free to make use of it in any way you like.
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
@ -16,26 +14,18 @@
|
|||||||
# EGL_INCLUDE_DIR - the EGL include directory
|
# EGL_INCLUDE_DIR - the EGL include directory
|
||||||
# EGL_LIBRARIES - Link these to use EGL
|
# EGL_LIBRARIES - Link these to use EGL
|
||||||
|
|
||||||
# Win32, Apple, and Android are not tested!
|
# Win32 and Apple are not tested!
|
||||||
# Linux tested and works
|
# Linux tested and works
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(CYGWIN)
|
find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h)
|
||||||
find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h)
|
find_library(OPENGLES2_LIBRARY libGLESv2)
|
||||||
find_library(OPENGLES2_LIBRARY libGLESv2)
|
|
||||||
else()
|
|
||||||
if(BORLAND)
|
|
||||||
set(OPENGLES2_LIBRARY import32 CACHE STRING "OpenGL ES 2.x library for Win32")
|
|
||||||
else()
|
|
||||||
# TODO
|
|
||||||
# set(OPENGLES_LIBRARY ${SOURCE_DIR}/Dependencies/lib/release/libGLESv2.lib CACHE STRING "OpenGL ES 2.x library for win32"
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
create_search_paths(/Developer/Platforms)
|
create_search_paths(/Developer/Platforms)
|
||||||
findpkg_framework(OpenGLES2)
|
findpkg_framework(OpenGLES2)
|
||||||
set(OPENGLES2_LIBRARY "-framework OpenGLES")
|
set(OPENGLES2_LIBRARY "-framework OpenGLES")
|
||||||
else()
|
else()
|
||||||
|
# Unix
|
||||||
find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
|
find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
|
||||||
PATHS /usr/openwin/share/include
|
PATHS /usr/openwin/share/include
|
||||||
/opt/graphics/OpenGL/include
|
/opt/graphics/OpenGL/include
|
||||||
@ -47,55 +37,34 @@ else()
|
|||||||
NAMES GLESv2
|
NAMES GLESv2
|
||||||
PATHS /opt/graphics/OpenGL/lib
|
PATHS /opt/graphics/OpenGL/lib
|
||||||
/usr/openwin/lib
|
/usr/openwin/lib
|
||||||
/usr/shlib /usr/X11R6/lib
|
/usr/X11R6/lib
|
||||||
/usr/lib
|
/usr/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT BUILD_ANDROID)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_path(EGL_INCLUDE_DIR EGL/egl.h
|
find_package_handle_standard_args(OPENGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR)
|
||||||
PATHS /usr/openwin/share/include
|
|
||||||
/opt/graphics/OpenGL/include
|
|
||||||
/usr/X11R6/include
|
|
||||||
/usr/include
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(EGL_LIBRARY
|
find_path(EGL_INCLUDE_DIR EGL/egl.h
|
||||||
NAMES EGL
|
PATHS /usr/openwin/share/include
|
||||||
PATHS /opt/graphics/OpenGL/lib
|
/opt/graphics/OpenGL/include
|
||||||
/usr/openwin/lib
|
/usr/X11R6/include
|
||||||
/usr/shlib
|
/usr/include
|
||||||
/usr/X11R6/lib
|
)
|
||||||
/usr/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
# On Unix OpenGL usually requires X11.
|
find_library(EGL_LIBRARY
|
||||||
# It doesn't require X11 on OSX.
|
NAMES EGL
|
||||||
|
PATHS /opt/graphics/OpenGL/lib
|
||||||
|
/usr/openwin/lib
|
||||||
|
/usr/X11R6/lib
|
||||||
|
/usr/lib
|
||||||
|
)
|
||||||
|
|
||||||
if(OPENGLES2_LIBRARY)
|
include(FindPackageHandleStandardArgs)
|
||||||
if(NOT X11_FOUND)
|
find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
|
||||||
include(FindX11)
|
|
||||||
endif()
|
|
||||||
if(X11_FOUND)
|
|
||||||
set(OPENGLES2_LIBRARIES ${X11_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARIES} ${OPENGLES2_LIBRARY})
|
set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY})
|
||||||
|
set(EGL_LIBRARIES ${EGL_LIBRARY})
|
||||||
if(BUILD_ANDROID)
|
|
||||||
if(OPENGLES2_LIBRARY)
|
|
||||||
set(EGL_LIBRARIES)
|
|
||||||
set(OPENGLES2_FOUND TRUE)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if(OPENGLES2_LIBRARY AND EGL_LIBRARY)
|
|
||||||
set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${OPENGLES2_LIBRARIES})
|
|
||||||
set(EGL_LIBRARIES ${EGL_LIBRARY} ${EGL_LIBRARIES})
|
|
||||||
set(OPENGLES2_FOUND TRUE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
OPENGLES2_INCLUDE_DIR
|
OPENGLES2_INCLUDE_DIR
|
||||||
@ -103,10 +72,3 @@ mark_as_advanced(
|
|||||||
EGL_INCLUDE_DIR
|
EGL_INCLUDE_DIR
|
||||||
EGL_LIBRARY
|
EGL_LIBRARY
|
||||||
)
|
)
|
||||||
|
|
||||||
if(OPENGLES2_FOUND)
|
|
||||||
message(STATUS "Found system OpenGL ES 2 library: ${OPENGLES2_LIBRARIES}")
|
|
||||||
else()
|
|
||||||
set(OPENGLES2_LIBRARIES "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user