summaryrefslogtreecommitdiffstats
path: root/cmake/FindGLESv2.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/FindGLESv2.cmake')
-rw-r--r--cmake/FindGLESv2.cmake24
1 files changed, 20 insertions, 4 deletions
diff --git a/cmake/FindGLESv2.cmake b/cmake/FindGLESv2.cmake
index e934170196..4730418209 100644
--- a/cmake/FindGLESv2.cmake
+++ b/cmake/FindGLESv2.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(CheckCXXSourceCompiles)
# No library linkage is necessary to use GLESv2 with Emscripten. The headers are also
@@ -7,8 +10,17 @@ if(EMSCRIPTEN)
else()
find_library(GLESv2_LIBRARY NAMES GLESv2 OpenGLES)
find_path(GLESv2_INCLUDE_DIR NAMES "GLES2/gl2.h" "OpenGLES/ES2/gl.h" DOC "The OpenGLES 2 include path")
+ find_package(EGL)
set(_libraries "${CMAKE_REQUIRED_LIBRARIES}")
- list(APPEND CMAKE_REQUIRED_LIBRARIES "${GLESv2_LIBRARY}")
+ if(GLESv2_LIBRARY)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${GLESv2_LIBRARY}")
+ endif ()
+ if(EGL_LIBRARY)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}")
+ endif()
+ if(_qt_igy_gui_libs)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${_qt_igy_gui_libs}")
+ endif()
set(_includes "${CMAKE_REQUIRED_INCLUDES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${GLESv2_INCLUDE_DIR}")
@@ -20,7 +32,7 @@ else()
# include <GLES2/gl2.h>
#endif
-int main(int argc, char *argv[]) {
+int main(int, char **) {
glUniform1f(1, GLfloat(1.0));
glClear(GL_COLOR_BUFFER_BIT);
}" HAVE_GLESv2)
@@ -54,9 +66,9 @@ find_package_handle_standard_args(GLESv2 DEFAULT_MSG ${package_args})
mark_as_advanced(${package_args})
if(GLESv2_FOUND AND NOT TARGET GLESv2::GLESv2)
- if(EMSCRIPTEN OR UIKIT)
+ if(EMSCRIPTEN OR IOS)
add_library(GLESv2::GLESv2 INTERFACE IMPORTED)
- if(UIKIT)
+ if(IOS)
# For simulator_and_device builds we can't specify the full library path, because
# it's specific to either the device or the simulator. Resort to passing a link
# flag instead.
@@ -67,5 +79,9 @@ if(GLESv2_FOUND AND NOT TARGET GLESv2::GLESv2)
set_target_properties(GLESv2::GLESv2 PROPERTIES
IMPORTED_LOCATION "${GLESv2_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GLESv2_INCLUDE_DIR}")
+
+ if(EGL_LIBRARY)
+ target_link_libraries(GLESv2::GLESv2 INTERFACE "${EGL_LIBRARY}")
+ endif()
endif()
endif()