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