1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0032484: Configuration, CMake fails to find EGL and GLES2 include directory on iOS platform

Fixed configuration errors and compilation errors on iOS target due to unexpected EGL usage (non-existing on iOS).
This commit is contained in:
kgv 2021-12-14 00:25:36 +03:00 committed by smoskvin
parent 730b9ecc2d
commit e1a92d9ef0
3 changed files with 24 additions and 10 deletions

View File

@ -661,8 +661,10 @@ endif()
if (CAN_USE_GLES2) if (CAN_USE_GLES2)
if (USE_GLES2) if (USE_GLES2)
add_definitions (-DHAVE_GLES2_EXT) add_definitions (-DHAVE_GLES2_EXT)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl") if (NOT IOS)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2") OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
endif()
else() else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL") OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2") OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")

View File

@ -67,7 +67,9 @@
#if !defined(HAVE_EGL) #if !defined(HAVE_EGL)
#if defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(HAVE_GLES2) || defined(OCCT_UWP) #if defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(HAVE_GLES2) || defined(OCCT_UWP)
#define HAVE_EGL #if !defined(__APPLE__)
#define HAVE_EGL // EAGL is used instead of EGL
#endif
#elif !defined(_WIN32) && !defined(__APPLE__) && !defined(HAVE_XLIB) #elif !defined(_WIN32) && !defined(__APPLE__) && !defined(HAVE_XLIB)
#define HAVE_EGL #define HAVE_EGL
#endif #endif

View File

@ -52,7 +52,17 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
#include <GL/glx.h> #include <GL/glx.h>
#endif #endif
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) #if !defined(HAVE_EGL)
#if defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(HAVE_GLES2) || defined(OCCT_UWP)
#if !defined(__APPLE__)
#define HAVE_EGL // EAGL is used instead of EGL
#endif
#elif !defined(_WIN32) && !defined(__APPLE__) && !defined(HAVE_XLIB)
#define HAVE_EGL
#endif
#endif
#if defined(HAVE_EGL)
#include <EGL/egl.h> #include <EGL/egl.h>
#ifndef EGL_OPENGL_ES3_BIT #ifndef EGL_OPENGL_ES3_BIT
#define EGL_OPENGL_ES3_BIT 0x00000040 #define EGL_OPENGL_ES3_BIT 0x00000040
@ -63,7 +73,7 @@ namespace
{ {
static const Handle(OpenGl_Context) TheNullGlCtx; static const Handle(OpenGl_Context) TheNullGlCtx;
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) #if defined(HAVE_EGL)
//! Wrapper over eglChooseConfig() called with preferred defaults. //! Wrapper over eglChooseConfig() called with preferred defaults.
static EGLConfig chooseEglSurfConfig (EGLDisplay theDisplay) static EGLConfig chooseEglSurfConfig (EGLDisplay theDisplay)
{ {
@ -155,7 +165,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
myMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()), myMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()),
myMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator()) myMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator())
{ {
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) #if defined(HAVE_EGL)
myEglDisplay = (Aspect_Display )EGL_NO_DISPLAY; myEglDisplay = (Aspect_Display )EGL_NO_DISPLAY;
myEglContext = (Aspect_RenderingContext )EGL_NO_CONTEXT; myEglContext = (Aspect_RenderingContext )EGL_NO_CONTEXT;
#endif #endif
@ -250,7 +260,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
aWindow->GetGlContext()->forcedRelease(); aWindow->GetGlContext()->forcedRelease();
} }
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) #if defined(HAVE_EGL)
if (myIsOwnContext) if (myIsOwnContext)
{ {
if (myEglContext != (Aspect_RenderingContext )EGL_NO_CONTEXT) if (myEglContext != (Aspect_RenderingContext )EGL_NO_CONTEXT)
@ -285,7 +295,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
Standard_Boolean OpenGl_GraphicDriver::InitContext() Standard_Boolean OpenGl_GraphicDriver::InitContext()
{ {
ReleaseContext(); ReleaseContext();
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) #if defined(HAVE_EGL)
#if defined(HAVE_XLIB) #if defined(HAVE_XLIB)
if (myDisplayConnection.IsNull()) if (myDisplayConnection.IsNull())
@ -369,7 +379,7 @@ Standard_Boolean OpenGl_GraphicDriver::InitEglContext (Aspect_Display t
void* theEglConfig) void* theEglConfig)
{ {
ReleaseContext(); ReleaseContext();
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__) #if defined(HAVE_EGL)
#if defined(HAVE_XLIB) #if defined(HAVE_XLIB)
if (myDisplayConnection.IsNull()) if (myDisplayConnection.IsNull())
{ {
@ -420,7 +430,7 @@ void OpenGl_GraphicDriver::chooseVisualInfo()
XVisualInfo* aVisInfo = NULL; XVisualInfo* aVisInfo = NULL;
Aspect_FBConfig anFBConfig = NULL; Aspect_FBConfig anFBConfig = NULL;
#if defined(HAVE_EGL) || defined(HAVE_GLES2) #if defined(HAVE_EGL)
XVisualInfo aVisInfoTmp; XVisualInfo aVisInfoTmp;
memset (&aVisInfoTmp, 0, sizeof(aVisInfoTmp)); memset (&aVisInfoTmp, 0, sizeof(aVisInfoTmp));
aVisInfoTmp.screen = DefaultScreen (aDisp); aVisInfoTmp.screen = DefaultScreen (aDisp);