]> git.lizzy.rs Git - minetest.git/blob - cmake/Modules/FindOpenGLES2.cmake
Add vector.offset (#10321)
[minetest.git] / cmake / Modules / FindOpenGLES2.cmake
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
6 # - Try to find OpenGLES and EGL
7 # Once done this will define
8 #
9 #  OPENGLES2_FOUND        - system has OpenGLES
10 #  OPENGLES2_INCLUDE_DIR  - the GL include directory
11 #  OPENGLES2_LIBRARIES    - Link these to use OpenGLES
12 #
13 #  EGL_FOUND        - system has EGL
14 #  EGL_INCLUDE_DIR  - the EGL include directory
15 #  EGL_LIBRARIES    - Link these to use EGL
16
17 # Win32 and Apple are not tested!
18 # Linux tested and works
19
20 if(WIN32)
21         find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h)
22         find_library(OPENGLES2_LIBRARY libGLESv2)
23 elseif(APPLE)
24         create_search_paths(/Developer/Platforms)
25         findpkg_framework(OpenGLES2)
26         set(OPENGLES2_LIBRARY "-framework OpenGLES")
27 else()
28         # Unix
29         find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
30                 PATHS /usr/openwin/share/include
31                         /opt/graphics/OpenGL/include
32                         /usr/X11R6/include
33                         /usr/include
34         )
35
36         find_library(OPENGLES2_LIBRARY
37                 NAMES GLESv2
38                 PATHS /opt/graphics/OpenGL/lib
39                         /usr/openwin/lib
40                         /usr/X11R6/lib
41                         /usr/lib
42         )
43
44         include(FindPackageHandleStandardArgs)
45         find_package_handle_standard_args(OPENGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR)
46
47         find_path(EGL_INCLUDE_DIR EGL/egl.h
48                 PATHS /usr/openwin/share/include
49                         /opt/graphics/OpenGL/include
50                         /usr/X11R6/include
51                         /usr/include
52         )
53
54         find_library(EGL_LIBRARY
55                 NAMES EGL
56                 PATHS /opt/graphics/OpenGL/lib
57                         /usr/openwin/lib
58                         /usr/X11R6/lib
59                         /usr/lib
60         )
61
62         include(FindPackageHandleStandardArgs)
63         find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
64 endif()
65
66 set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY})
67 set(EGL_LIBRARIES ${EGL_LIBRARY})
68
69 mark_as_advanced(
70         OPENGLES2_INCLUDE_DIR
71         OPENGLES2_LIBRARY
72         EGL_INCLUDE_DIR
73         EGL_LIBRARY
74 )