]> OCCT Git - occt.git/commitdiff
0032484: Configuration, CMake fails to find EGL and GLES2 include directory on iOS...
authorkgv <kgv@opencascade.com>
Mon, 13 Dec 2021 21:25:36 +0000 (00:25 +0300)
committersmoskvin <smoskvin@opencascade.com>
Thu, 16 Dec 2021 16:24:31 +0000 (19:24 +0300)
Fixed configuration errors and compilation errors on iOS target due to unexpected EGL usage (non-existing on iOS).

CMakeLists.txt
src/OpenGl/OpenGl_GlFunctions.hxx
src/OpenGl/OpenGl_GraphicDriver.cxx

index 208a5ab255be075d2589dcdf0452be3e32debc68..4b255ca7b5d601c2e18fa028627e6131713e24e3 100644 (file)
@@ -661,8 +661,10 @@ endif()
 if (CAN_USE_GLES2)
   if (USE_GLES2)
     add_definitions (-DHAVE_GLES2_EXT)
-    OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
-    OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
+    if (NOT IOS)
+      OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
+      OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
+    endif()
   else()
     OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
     OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
index 1009a9fe07eabf90467bacb8bf923a36d44bbbcb..8b4e4a6badc5e7e955b3289886c818c2a8b7fd06 100644 (file)
@@ -25,7 +25,9 @@
 
 #if !defined(HAVE_EGL)
 #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)
   #define HAVE_EGL
 #endif
index 4ed778fd2f70f0fc1d33eb31301267f0df96d39a..3535cda0edf405a353f6fc634e35a280aa354060 100644 (file)
@@ -52,7 +52,17 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver)
   #include <GL/glx.h>
 #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>
   #ifndef EGL_OPENGL_ES3_BIT
     #define EGL_OPENGL_ES3_BIT 0x00000040
@@ -67,7 +77,7 @@ namespace
 {
   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.
   static EGLConfig chooseEglSurfConfig (EGLDisplay theDisplay)
   {
@@ -159,7 +169,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
   myMapOfView      (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;
   myEglContext = (Aspect_RenderingContext )EGL_NO_CONTEXT;
 #endif
@@ -254,7 +264,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
     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 (myEglContext != (Aspect_RenderingContext )EGL_NO_CONTEXT)
@@ -289,7 +299,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
 Standard_Boolean OpenGl_GraphicDriver::InitContext()
 {
   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 (myDisplayConnection.IsNull())
@@ -373,7 +383,7 @@ Standard_Boolean OpenGl_GraphicDriver::InitEglContext (Aspect_Display          t
                                                        void*                   theEglConfig)
 {
   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 (myDisplayConnection.IsNull())
   {
@@ -424,7 +434,7 @@ void OpenGl_GraphicDriver::chooseVisualInfo()
 
   XVisualInfo* aVisInfo = NULL;
   Aspect_FBConfig anFBConfig = NULL;
-#if defined(HAVE_EGL) || defined(HAVE_GLES2)
+#if defined(HAVE_EGL)
   XVisualInfo aVisInfoTmp;
   memset (&aVisInfoTmp, 0, sizeof(aVisInfoTmp));
   aVisInfoTmp.screen = DefaultScreen (aDisp);