Skip to contentSkip to conversation

package/cegui: select libglu when libgl is detected

PATCH Superseded Bartosz Bilas 2 participants 6 messages Jun 21, 2020 – Jun 22, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/cegui: select libglu when libgl is detected

Fixes:
http://autobuild.buildroot.net/results/1a8/1a866e8722fe111297e4a99b376cf9975ee92ace

---
Changes v1 -> v2:
- added reviewed by Bernd Kuhls

 package/cegui/Config.in | 1 +
 package/cegui/cegui.mk  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
package/cegui/Config.in +1 -0
index f917be0cc5..0c7932098c 100644
@@ -9,6 +9,7 @@ config BR2_PACKAGE_CEGUI
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_WCHAR
 	select BR2_PACKAGE_GLM
+	select BR2_PACKAGE_LIBGLU if BR2_PACKAGE_HAS_LIBGL
 	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
 	help
 	  Crazy Eddie's GUI System is a free library providing windowing
package/cegui/cegui.mk +2 -1
index 0e3d015948..4aaa065818 100644
@@ -16,7 +16,8 @@ CEGUI_DEPENDENCIES = glm \
 		$(if $(BR2_PACKAGE_HAS_LIBGL),libgl) \
 		$(if $(BR2_PACKAGE_HAS_LIBGLES),libgles) \
 		$(if $(BR2_PACKAGE_LIBGLEW),libglew) \
-		$(if $(BR2_PACKAGE_LIBICONV),libiconv)
+		$(if $(BR2_PACKAGE_LIBICONV),libiconv) \
+		$(if $(BR2_PACKAGE_LIBGLU),libglu)
 
 ifeq ($(BR2_PACKAGE_LIBEPOXY)$(BR2_PACKAGE_LIBGLEW),y)
 CEGUI_DEPENDENCIES += libepoxy
Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 1/1 package/cegui: select libglu when libgl is detected

package/cegui/Config.in config BR2_PACKAGE_CEGUI · line 12

Quoted 9 lines · On Sun, 21 Jun 2020 15:18:32 +0200 Bartosz Bilas <[email protected]>…
package/cegui/Config.in +1 -0
index f917be0cc5..0c7932098c 100644
@@ -9,6 +9,7 @@ config BR2_PACKAGE_CEGUI
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_WCHAR
 	select BR2_PACKAGE_GLM
+	select BR2_PACKAGE_LIBGLU if BR2_PACKAGE_HAS_LIBGL

This doesn't seem correct. According to the CMakeLists.txt, cegui can use either libepoxy *or* glew as an "OpenGL loader" (whatever that means). So with your patch, we would select libglu even if it is not needed because we have libepoxy available.

See the CMakeLists.txt:

if (GLEW_FOUND OR EPOXY_FOUND)
set (OPENGL_LOADER_FOUND TRUE)
else ()
set (OPENGL_LOADER_FOUND FALSE)
endif ()

This is confirmed by ./cegui/include/CEGUI/RendererModules/OpenGL/GL.h, which contains:

#if defined CEGUI_USE_EPOXY

#include <epoxy/gl.h>

#elif defined CEGUI_USE_GLEW

#include <GL/glew.h>

// When using GLEW, there's no need to "#include" the OpenGL headers. #ifndef __APPLE__
[...]
#else
# include <OpenGL/glu.h>
#endif

#else
#error Either "CEGUI_USE_EPOXY" or "CEGUI_USE_GLEW" must be defined. Defining both or none is invalid. #endif

So, shouldn't we make things explicit:

ifeq ($(BR2_PACKAGE_GLEW)$(BR2_PACKAGE_GLU),yy)
CEGUI_CONF_OPTS += -DCEGUI_USE_GLEW=ON
else ifeq ($(BR2_PACKAGE_LIBEPOXY),y)
CEGUI_CONF_OPTS += -DCEGUI_USE_EPOXY=ON
endif

or something like that ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH v2 1/1 package/cegui: select libglu when libgl is detected

Hi Thomas,

Quoted 16 lines · Thomas Petazzoni

package/cegui/Config.in config BR2_PACKAGE_CEGUI · line 12

Quoted 9 lines · On Sun, 21 Jun 2020 15:18:32 +0200 Bartosz Bilas <[email protected]>…
package/cegui/Config.in +1 -0
index f917be0cc5..0c7932098c 100644
@@ -9,6 +9,7 @@ config BR2_PACKAGE_CEGUI
  	depends on BR2_TOOLCHAIN_HAS_THREADS
  	depends on BR2_USE_WCHAR
  	select BR2_PACKAGE_GLM
+	select BR2_PACKAGE_LIBGLU if BR2_PACKAGE_HAS_LIBGL

This doesn't seem correct. According to the CMakeLists.txt, cegui can use either libepoxy *or* glew as an "OpenGL loader" (whatever that means). So with your patch, we would select libglu even if it is not needed because we have libepoxy available.

No, we wouldn't because libglu is selected only when we have BR2_PACKAGE_HAS_LIBGL option set. Libepoxy doesn't provide it so even if we use glew instead of libepoxy we have to select libglu because cegui directly includes GL/glu.h here ->
https://github.com/cegui/cegui/blob/v0-8-7/cegui/include/CEGUI/RendererModules/OpenGL/GL.h#L45

Quoted 39 lines

See the CMakeLists.txt:

if (GLEW_FOUND OR EPOXY_FOUND)
set (OPENGL_LOADER_FOUND TRUE)
else ()
set (OPENGL_LOADER_FOUND FALSE)
endif ()

This is confirmed by ./cegui/include/CEGUI/RendererModules/OpenGL/GL.h, which contains:

#if defined CEGUI_USE_EPOXY

#include <epoxy/gl.h>

#elif defined CEGUI_USE_GLEW

#include <GL/glew.h>

// When using GLEW, there's no need to "#include" the OpenGL headers. #ifndef __APPLE__
[...]
#else
# include <OpenGL/glu.h>
#endif

#else
#error Either "CEGUI_USE_EPOXY" or "CEGUI_USE_GLEW" must be defined. Defining both or none is invalid. #endif

So, shouldn't we make things explicit:

ifeq ($(BR2_PACKAGE_GLEW)$(BR2_PACKAGE_GLU),yy)
CEGUI_CONF_OPTS += -DCEGUI_USE_GLEW=ON
else ifeq ($(BR2_PACKAGE_LIBEPOXY),y)
CEGUI_CONF_OPTS += -DCEGUI_USE_EPOXY=ON
endif

Quoted 3 lines

or something like that ?

Thomas

Best
Bartek

#3 lore raw

PATCH v2 1/1 package/cegui: select libglu when libgl is detected

Quoted 2 lines · On Mon, 22 Jun 2020 21:37:15 +0200 Bartosz Bilas <[email protected]>…

No, we wouldn't because libglu is selected only when we have BR2_PACKAGE_HAS_LIBGL option set.

libepoxy is a library for handling the load of OpenGL library, and has:

        depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL

So basically, when you have HAS_LIBGL=y, you can have either libepoxy *OR* libglew/libglu used by Irrlicht.

Quoted 4 lines

Libepoxy doesn't provide it so even if
we use glew instead of libepoxy we have to select libglu because cegui directly includes GL/glu.h here ->
https://github.com/cegui/cegui/blob/v0-8-7/cegui/include/CEGUI/RendererModules/OpenGL/GL.h#L45

That is exactly the code I have pasted below, please see my comments inline.

Quoted 4 lines
Quoted 4 lines

This is confirmed by ./cegui/include/CEGUI/RendererModules/OpenGL/GL.h, which contains:

#if defined CEGUI_USE_EPOXY

So if the OpenGL loader is libepoxy, we are here...

Quoted 4 lines
Quoted 4 lines

#include <epoxy/gl.h>

#elif defined CEGUI_USE_GLEW

*OR* if the OpenGL loader is glew, we are here, and we indeed include GLU unconditionally.

So I stand to my position: according to the code, if you're using libepoxy as the OpenGL loader, you don't need Glew, and you don't need GLU.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH v2 1/1 package/cegui: select libglu when libgl is detected

Quoted 11 lines · Thomas Petazzoni
Quoted 2 lines · On Mon, 22 Jun 2020 21:37:15 +0200 Bartosz Bilas <[email protected]>…

No, we wouldn't because libglu is selected only when we have BR2_PACKAGE_HAS_LIBGL option set.

libepoxy is a library for handling the load of OpenGL library, and has:

         depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL

So basically, when you have HAS_LIBGL=y, you can have either libepoxy *OR* libglew/libglu used by Irrlicht.

Oh right, somehow I hadn't seen this line before...

Quoted 14 lines
Quoted 4 lines

Libepoxy doesn't provide it so even if
we use glew instead of libepoxy we have to select libglu because cegui directly includes GL/glu.h here ->
https://github.com/cegui/cegui/blob/v0-8-7/cegui/include/CEGUI/RendererModules/OpenGL/GL.h#L45

That is exactly the code I have pasted below, please see my comments inline.

Quoted 4 lines
Quoted 4 lines

This is confirmed by ./cegui/include/CEGUI/RendererModules/OpenGL/GL.h, which contains:

#if defined CEGUI_USE_EPOXY

So if the OpenGL loader is libepoxy, we are here...

Quoted 2 lines
Quoted 2 lines

#include <epoxy/gl.h>

Quoted 7 lines
Quoted 1 line
Quoted 1 line

#elif defined CEGUI_USE_GLEW

*OR* if the OpenGL loader is glew, we are here, and we indeed include GLU unconditionally.

So I stand to my position: according to the code, if you're using libepoxy as the OpenGL loader, you don't need Glew, and you don't need GLU.

I agree with you now, so basically we have to select glu only when glew is used and that should solve the problem discussed...

Quoted 2 lines

Thomas

Best
Bartek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200622/1c36a348/attachment.html>

#5 lore raw

PATCH v2 1/1 package/cegui: select libglu when libgl is detected

Quoted 2 lines · On Mon, 22 Jun 2020 22:11:31 +0200 Bartosz Bilas <[email protected]>…

I agree with you now, so basically we have to select glu only when glew is used and that should solve the problem discussed...

See the solution I have proposed: to be more explicit about which OpenGL loader is used. See my initial reply.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com