FindOpenGLES2.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #-------------------------------------------------------------------
  2. # The contents of this file are placed in the public domain. Feel
  3. # free to make use of it in any way you like.
  4. #-------------------------------------------------------------------
  5. # - Try to find OpenGLES and EGL
  6. # Once done this will define
  7. #
  8. # OPENGLES2_FOUND - system has OpenGLES
  9. # OPENGLES2_INCLUDE_DIR - the GL include directory
  10. # OPENGLES2_LIBRARIES - Link these to use OpenGLES
  11. #
  12. # EGL_FOUND - system has EGL
  13. # EGL_INCLUDE_DIR - the EGL include directory
  14. # EGL_LIBRARIES - Link these to use EGL
  15. # Win32 and Apple are not tested!
  16. # Linux tested and works
  17. if(WIN32)
  18. find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h)
  19. find_library(OPENGLES2_LIBRARY libGLESv2)
  20. elseif(APPLE)
  21. create_search_paths(/Developer/Platforms)
  22. findpkg_framework(OpenGLES2)
  23. set(OPENGLES2_LIBRARY "-framework OpenGLES")
  24. else()
  25. # Unix
  26. find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
  27. PATHS /usr/openwin/share/include
  28. /opt/graphics/OpenGL/include
  29. /usr/X11R6/include
  30. /usr/include
  31. )
  32. find_library(OPENGLES2_LIBRARY
  33. NAMES GLESv2
  34. PATHS /opt/graphics/OpenGL/lib
  35. /usr/openwin/lib
  36. /usr/X11R6/lib
  37. /usr/lib
  38. )
  39. include(FindPackageHandleStandardArgs)
  40. find_package_handle_standard_args(OPENGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR)
  41. find_path(EGL_INCLUDE_DIR EGL/egl.h
  42. PATHS /usr/openwin/share/include
  43. /opt/graphics/OpenGL/include
  44. /usr/X11R6/include
  45. /usr/include
  46. )
  47. find_library(EGL_LIBRARY
  48. NAMES EGL
  49. PATHS /opt/graphics/OpenGL/lib
  50. /usr/openwin/lib
  51. /usr/X11R6/lib
  52. /usr/lib
  53. )
  54. include(FindPackageHandleStandardArgs)
  55. find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
  56. endif()
  57. set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY})
  58. set(EGL_LIBRARIES ${EGL_LIBRARY})
  59. mark_as_advanced(
  60. OPENGLES2_INCLUDE_DIR
  61. OPENGLES2_LIBRARY
  62. EGL_INCLUDE_DIR
  63. EGL_LIBRARY
  64. )