FindOpenGLES.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # - Try to find OpenGLES
  2. # Once done this will define
  3. #
  4. # OPENGLES_FOUND - system has OpenGLES and EGL
  5. # OPENGL_EGL_FOUND - system has EGL
  6. # OPENGLES_INCLUDE_DIR - the GLES include directory
  7. # OPENGLES_LIBRARY - the GLES library
  8. # OPENGLES_EGL_INCLUDE_DIR - the EGL include directory
  9. # OPENGLES_EGL_LIBRARY - the EGL library
  10. # OPENGLES_LIBRARIES - all libraries needed for OpenGLES
  11. # OPENGLES_INCLUDES - all includes needed for OpenGLES
  12. # If OPENGLES_ROOT_DIR was defined in the environment, use it.
  13. IF(NOT OPENGLES_ROOT_DIR AND NOT $ENV{OPENGLES_ROOT_DIR} STREQUAL "")
  14. SET(OPENGLES_ROOT_DIR $ENV{OPENGLES_ROOT_DIR})
  15. ENDIF()
  16. SET(_opengles_SEARCH_DIRS
  17. ${OPENGLES_ROOT_DIR}
  18. /usr/local
  19. )
  20. FIND_PATH(OPENGLES_INCLUDE_DIR
  21. NAMES
  22. GLES2/gl2.h
  23. HINTS
  24. ${_opengles_SEARCH_DIRS}
  25. )
  26. FIND_LIBRARY(OPENGLES_LIBRARY
  27. NAMES
  28. GLESv2
  29. PATHS
  30. ${_opengles_SEARCH_DIRS}
  31. PATH_SUFFIXES
  32. lib64 lib
  33. )
  34. FIND_PATH(OPENGLES_EGL_INCLUDE_DIR
  35. NAMES
  36. EGL/egl.h
  37. HINTS
  38. ${_opengles_SEARCH_DIRS}
  39. )
  40. FIND_LIBRARY(OPENGLES_EGL_LIBRARY
  41. NAMES
  42. EGL
  43. HINTS
  44. ${_opengles_SEARCH_DIRS}
  45. PATH_SUFFIXES
  46. lib64 lib
  47. )
  48. IF(OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
  49. SET(OPENGL_EGL_FOUND "YES")
  50. ELSE()
  51. SET(OPENGL_EGL_FOUND "NO")
  52. ENDIF()
  53. IF(OPENGLES_LIBRARY AND OPENGLES_INCLUDE_DIR AND
  54. OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
  55. SET(OPENGLES_LIBRARIES ${OPENGLES_LIBRARY} ${OPENGLES_LIBRARIES}
  56. ${OPENGLES_EGL_LIBRARY})
  57. SET(OPENGLES_INCLUDES ${OPENGLES_INCLUDE_DIR} ${OPENGLES_EGL_INCLUDE_DIR})
  58. SET(OPENGLES_FOUND "YES")
  59. ELSE()
  60. SET(OPENGLES_FOUND "NO")
  61. ENDIF()
  62. MARK_AS_ADVANCED(
  63. OPENGLES_EGL_INCLUDE_DIR
  64. OPENGLES_EGL_LIBRARY
  65. OPENGLES_LIBRARY
  66. OPENGLES_INCLUDE_DIR
  67. )
  68. UNSET(_opengles_SEARCH_DIRS)