diff mbox series

[v6,06/13] package/qt6/qt6base: add opengl support

Message ID 20230207171721.2973997-7-angelo@amarulasolutions.com
State Accepted
Headers show
Series Extend Qt6 configuration | expand

Commit Message

Angelo Compagnucci Feb. 7, 2023, 5:17 p.m. UTC
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
v6:
* Moving eglfs backend selection here (Thomas P.)

 package/qt6/Config.in          |  5 ++++
 package/qt6/qt6base/Config.in  | 49 +++++++++++++++++++++++++++++++++-
 package/qt6/qt6base/qt6base.mk | 17 ++++++++++++
 3 files changed, 70 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Feb. 8, 2023, 11:11 a.m. UTC | #1
On Tue,  7 Feb 2023 18:17:14 +0100
Angelo Compagnucci <angelo@amarulasolutions.com> wrote:

> +if BR2_PACKAGE_QT6BASE_OPENGL
> +
> +choice
> +	prompt "OpenGL API"
> +	help
> +	  Select OpenGL API.
> +
> +config BR2_PACKAGE_QT6BASE_OPENGL_DESKTOP
> +	bool "Desktop OpenGL"
> +	depends on BR2_PACKAGE_HAS_LIBGL
> +	help
> +	  Use desktop OpenGL.
> +
> +config BR2_PACKAGE_QT6BASE_OPENGL_ES2
> +	bool "OpenGL ES 2.0+"
> +	depends on BR2_PACKAGE_HAS_LIBGLES
> +	help
> +	  Use OpenGL ES 2.0 and later versions.
> +
> +endchoice
> +
> +config BR2_PACKAGE_QT6BASE_OPENGL_LIB
> +	bool "opengl module"
> +	select BR2_PACKAGE_QT6BASE_WIDGETS
> +	help
> +	  This option enables the Qt6OpenGL library. This library
> +	  includes OpenGL support classes provided to ease porting
> +	  from Qt 4.x.

This option didn't do anything: there is nothing in the .mk file that
did something about this option, so I dropped it.

> +
> +config BR2_PACKAGE_QT6BASE_EGLFS
> +	bool "eglfs support"
> +	default y

I dropped the "default y", there is no need for that.

> +	depends on BR2_PACKAGE_HAS_LIBGBM

It also needs EGL.

> +	select BR2_PACKAGE_QT6BASE_OPENGL

I also moved this option closer to the other graphics backends
(linuxfb, xcb).

>  config BR2_PACKAGE_QT6BASE_FONTCONFIG
>  	bool "fontconfig support"
>  	select BR2_PACKAGE_FONTCONFIG
> diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
> index f936d19c68..e9a3396fb6 100644
> --- a/package/qt6/qt6base/qt6base.mk
> +++ b/package/qt6/qt6base/qt6base.mk
> @@ -228,6 +228,23 @@ else
>  QT6BASE_CONF_OPTS += -DFEATURE_widgets=OFF
>  endif
>  
> +ifeq ($(BR2_PACKAGE_QT6BASE_EGLFS),y)
> +QT6BASE_CONF_OPTS += -DFEATURE_egl=ON -DFEATURE_eglfs=ON
> +QT6BASE_DEPENDENCIES += libegl

libgbm added here, since according to Config.in we need it.

Applied with those fixes, thanks!

Thomas
diff mbox series

Patch

diff --git a/package/qt6/Config.in b/package/qt6/Config.in
index b0cc008df5..655fa8392a 100644
--- a/package/qt6/Config.in
+++ b/package/qt6/Config.in
@@ -12,6 +12,11 @@  config BR2_PACKAGE_QT6_ARCH_SUPPORTS
 	default y if BR2_sparc64
 	depends on BR2_USE_MMU
 
+config BR2_PACKAGE_QT6_GL_SUPPORTS
+	bool
+	default y
+	depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
+
 comment "qt6 needs a toolchain w/ C++, threads, wchar, dynamic library, gcc >= 8, host gcc >= 8"
 	depends on !BR2_PACKAGE_QT5
 	depends on BR2_PACKAGE_QT6_ARCH_SUPPORTS
diff --git a/package/qt6/qt6base/Config.in b/package/qt6/qt6base/Config.in
index 0f7e936162..a33ffcd511 100644
--- a/package/qt6/qt6base/Config.in
+++ b/package/qt6/qt6base/Config.in
@@ -36,7 +36,8 @@  config BR2_PACKAGE_QT6BASE_GUI
 	# At least one graphic backend must be enabled, so enable
 	# linuxfb if nothing is enabled.
 	select BR2_PACKAGE_QT6BASE_LINUXFB if \
-	       !BR2_PACKAGE_QT6BASE_XCB
+	       !BR2_PACKAGE_QT6BASE_XCB && \
+	       !BR2_PACKAGE_QT6BASE_EGLFS
 	help
 	  This option enables the Qt6Gui library.
 
@@ -59,6 +60,52 @@  config BR2_PACKAGE_QT6BASE_XCB
 comment "X.org XCB backend available if X.org is enabled"
 	depends on !BR2_PACKAGE_XORG7
 
+config BR2_PACKAGE_QT6BASE_OPENGL
+	bool "OpenGL support"
+	depends on BR2_PACKAGE_QT6_GL_SUPPORTS
+	help
+	  This option enables OpenGL support.
+
+comment "OpenGL support needs an OpenGL-capable backend"
+	depends on !BR2_PACKAGE_QT6_GL_SUPPORTS
+
+if BR2_PACKAGE_QT6BASE_OPENGL
+
+choice
+	prompt "OpenGL API"
+	help
+	  Select OpenGL API.
+
+config BR2_PACKAGE_QT6BASE_OPENGL_DESKTOP
+	bool "Desktop OpenGL"
+	depends on BR2_PACKAGE_HAS_LIBGL
+	help
+	  Use desktop OpenGL.
+
+config BR2_PACKAGE_QT6BASE_OPENGL_ES2
+	bool "OpenGL ES 2.0+"
+	depends on BR2_PACKAGE_HAS_LIBGLES
+	help
+	  Use OpenGL ES 2.0 and later versions.
+
+endchoice
+
+config BR2_PACKAGE_QT6BASE_OPENGL_LIB
+	bool "opengl module"
+	select BR2_PACKAGE_QT6BASE_WIDGETS
+	help
+	  This option enables the Qt6OpenGL library. This library
+	  includes OpenGL support classes provided to ease porting
+	  from Qt 4.x.
+
+config BR2_PACKAGE_QT6BASE_EGLFS
+	bool "eglfs support"
+	default y
+	depends on BR2_PACKAGE_HAS_LIBGBM
+	select BR2_PACKAGE_QT6BASE_OPENGL
+
+endif
+
 config BR2_PACKAGE_QT6BASE_FONTCONFIG
 	bool "fontconfig support"
 	select BR2_PACKAGE_FONTCONFIG
diff --git a/package/qt6/qt6base/qt6base.mk b/package/qt6/qt6base/qt6base.mk
index f936d19c68..e9a3396fb6 100644
--- a/package/qt6/qt6base/qt6base.mk
+++ b/package/qt6/qt6base/qt6base.mk
@@ -228,6 +228,23 @@  else
 QT6BASE_CONF_OPTS += -DFEATURE_widgets=OFF
 endif
 
+ifeq ($(BR2_PACKAGE_QT6BASE_EGLFS),y)
+QT6BASE_CONF_OPTS += -DFEATURE_egl=ON -DFEATURE_eglfs=ON
+QT6BASE_DEPENDENCIES += libegl
+else
+QT6BASE_CONF_OPTS += -DFEATURE_eglfs=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_QT6BASE_OPENGL_DESKTOP),y)
+QT6BASE_CONF_OPTS += -DFEATURE_opengl=ON -DFEATURE_opengl_desktop=ON
+QT6BASE_DEPENDENCIES += libgl
+else ifeq ($(BR2_PACKAGE_QT6BASE_OPENGL_ES2),y)
+QT6BASE_CONF_OPTS += -DFEATURE_opengl=ON -DFEATURE_opengles2=ON
+QT6BASE_DEPENDENCIES += libgles
+else
+QT6BASE_CONF_OPTS += -DFEATURE_opengl=OFF -DINPUT_opengl=no
+endif
+
 else
 QT6BASE_CONF_OPTS += -DFEATURE_gui=OFF
 endif