xref: /aosp_15_r20/external/libultrahdr/cmake/FindOpenGLES3.cmake (revision 89a0ef05262152531a00a15832a2d3b1e3990773)
1#
2# Copyright (C) 2024 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may not
5# use this file except in compliance with the License. You may obtain a copy of
6# the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations under
14# the License.
15#
16
17#
18# Finds the OpenGLES3 library. This module defines:
19#
20#  OpenGLES3_FOUND            - True if OpenGLES 3 library is found, False otherwise
21#  OPENGLES3_LIBRARIES        - OpenGLES3 library
22#  OPENGLES3_INCLUDE_DIRS     - Include dir
23#  OpenGLES3_API_VERSION      - OpenGLES3 Supported API version
24#
25
26find_path(OPENGLES3_INCLUDE_DIRS GLES3/gl3.h)
27
28# Android has separate library for OpenGLES3 in the form GLESv3
29# Many platforms support OpenGLES3 via OpenGLES2 lib. In this case, presence of GLES3/gl*.h will be indicative of GLES3 support
30find_library(OPENGLES3_LIBRARIES NAMES GLESv3 GLESv2 libGLESv2)
31
32if(OPENGLES3_INCLUDE_DIRS)
33  if(EXISTS ${OPENGLES3_INCLUDE_DIRS}/GLES3/gl32.h)
34    set(OpenGLES3_API_VERSION "3.2")
35  elseif(EXISTS ${OPENGLES3_INCLUDE_DIRS}/GLES3/gl31.h)
36    set(OpenGLES3_API_VERSION "3.1")
37  else()
38    set(OpenGLES3_API_VERSION "3.0")
39  endif()
40endif()
41
42include(FindPackageHandleStandardArgs)
43find_package_handle_standard_args(OpenGLES3 OPENGLES3_INCLUDE_DIRS OPENGLES3_LIBRARIES)
44
45mark_as_advanced(OPENGLES3_INCLUDE_DIRS OPENGLES3_LIBRARIES)
46