[libcamera-devel,1/3] apps: qcam: Port to Qt 6
diff mbox series

Message ID 20240121211040.1048509-2-neal@gompa.dev
State Superseded
Headers show
Series
  • apps: qcam: Port to Qt 6
Related show

Commit Message

Neal Gompa Jan. 21, 2024, 9:09 p.m. UTC
Open source Qt 5 has been effectively end of life since the release
of Qt 6, and Qt 6 has current LTS releases now.

This change ports qcam to Qt 6.2 and drops some of the baggage related
to Qt 5 that is no longer applicable.

Signed-off-by: Neal Gompa <neal@gompa.dev>
---
 README.rst                |  2 +-
 src/apps/qcam/meson.build | 45 +++++++++++----------------------------
 2 files changed, 14 insertions(+), 33 deletions(-)

Comments

Barnabás Pőcze Jan. 21, 2024, 9:35 p.m. UTC | #1
Hi


2024. január 21., vasárnap 22:09 keltezéssel, Neal Gompa via libcamera-devel írta:

> Open source Qt 5 has been effectively end of life since the release
> of Qt 6, and Qt 6 has current LTS releases now.
> 
> This change ports qcam to Qt 6.2 and drops some of the baggage related
> to Qt 5 that is no longer applicable.
> 
> Signed-off-by: Neal Gompa <neal@gompa.dev>
> ---
>  README.rst                |  2 +-
>  src/apps/qcam/meson.build | 45 +++++++++++----------------------------
>  2 files changed, 14 insertions(+), 33 deletions(-)
> 
> diff --git a/README.rst b/README.rst
> index 315738ee..6f1c9302 100644
> --- a/README.rst
> +++ b/README.rst
> @@ -88,7 +88,7 @@ for cam: [optional]
>          - libsdl2-dev: Enables the SDL sink
> 
>  for qcam: [optional]
> -        libtiff-dev qtbase5-dev qttools5-dev-tools
> +        libtiff-dev qt6-base-dev qt6-tools-dev-tools
> 
>  for tracing with lttng: [optional]
>          liblttng-ust-dev python3-jinja2 lttng-tools
> diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build
> index 6cf4c171..c7fcfbeb 100644
> --- a/src/apps/qcam/meson.build
> +++ b/src/apps/qcam/meson.build
> @@ -1,13 +1,13 @@
>  # SPDX-License-Identifier: CC0-1.0
> 
> -qt5 = import('qt5')
> -qt5_dep = dependency('qt5',
> +qt6 = import('qt6')
> +qt6_dep = dependency('qt6',
>                       method : 'pkg-config',
> -                     modules : ['Core', 'Gui', 'Widgets'],
> +                     modules : ['Core', 'Gui', 'OpenGL', 'OpenGLWidgets', 'Widgets'],
>                       required : get_option('qcam'),
> -                     version : '>=5.4')
> +                     version : '>=6.2')

https://mesonbuild.com/Qt6-module.html says

  Warning: before version 0.63.0 Meson would fail to find Qt 6.1 or later due to the Qt tools having moved to
  the libexec subdirectory, and tool names being suffixed with only the Qt major version number e.g. qmake6.

And libcamera currently says

  meson_version : '>= 0.60',

Could this be an issue?


> [...]


Regards,
Barnabás Pőcze
Neal Gompa Jan. 21, 2024, 10:32 p.m. UTC | #2
On Sun, Jan 21, 2024 at 4:35 PM Barnabás Pőcze via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> Hi
>
>
> 2024. január 21., vasárnap 22:09 keltezéssel, Neal Gompa via libcamera-devel írta:
>
> > Open source Qt 5 has been effectively end of life since the release
> > of Qt 6, and Qt 6 has current LTS releases now.
> >
> > This change ports qcam to Qt 6.2 and drops some of the baggage related
> > to Qt 5 that is no longer applicable.
> >
> > Signed-off-by: Neal Gompa <neal@gompa.dev>
> > ---
> >  README.rst                |  2 +-
> >  src/apps/qcam/meson.build | 45 +++++++++++----------------------------
> >  2 files changed, 14 insertions(+), 33 deletions(-)
> >
> > diff --git a/README.rst b/README.rst
> > index 315738ee..6f1c9302 100644
> > --- a/README.rst
> > +++ b/README.rst
> > @@ -88,7 +88,7 @@ for cam: [optional]
> >          - libsdl2-dev: Enables the SDL sink
> >
> >  for qcam: [optional]
> > -        libtiff-dev qtbase5-dev qttools5-dev-tools
> > +        libtiff-dev qt6-base-dev qt6-tools-dev-tools
> >
> >  for tracing with lttng: [optional]
> >          liblttng-ust-dev python3-jinja2 lttng-tools
> > diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build
> > index 6cf4c171..c7fcfbeb 100644
> > --- a/src/apps/qcam/meson.build
> > +++ b/src/apps/qcam/meson.build
> > @@ -1,13 +1,13 @@
> >  # SPDX-License-Identifier: CC0-1.0
> >
> > -qt5 = import('qt5')
> > -qt5_dep = dependency('qt5',
> > +qt6 = import('qt6')
> > +qt6_dep = dependency('qt6',
> >                       method : 'pkg-config',
> > -                     modules : ['Core', 'Gui', 'Widgets'],
> > +                     modules : ['Core', 'Gui', 'OpenGL', 'OpenGLWidgets', 'Widgets'],
> >                       required : get_option('qcam'),
> > -                     version : '>=5.4')
> > +                     version : '>=6.2')
>
> https://mesonbuild.com/Qt6-module.html says
>
>   Warning: before version 0.63.0 Meson would fail to find Qt 6.1 or later due to the Qt tools having moved to
>   the libexec subdirectory, and tool names being suffixed with only the Qt major version number e.g. qmake6.
>
> And libcamera currently says
>
>   meson_version : '>= 0.60',
>
> Could this be an issue?
>

Oh yes, I will respin this to update Meson to 0.63. Thanks for catching that.
Kieran Bingham Jan. 22, 2024, 9:22 a.m. UTC | #3
Quoting Neal Gompa via libcamera-devel (2024-01-21 22:32:49)
> On Sun, Jan 21, 2024 at 4:35 PM Barnabás Pőcze via libcamera-devel
> <libcamera-devel@lists.libcamera.org> wrote:
> >
> > Hi
> >
> >
> > 2024. január 21., vasárnap 22:09 keltezéssel, Neal Gompa via libcamera-devel írta:
> >
> > > Open source Qt 5 has been effectively end of life since the release
> > > of Qt 6, and Qt 6 has current LTS releases now.
> > >
> > > This change ports qcam to Qt 6.2 and drops some of the baggage related
> > > to Qt 5 that is no longer applicable.
> > >
> > > Signed-off-by: Neal Gompa <neal@gompa.dev>
> > > ---
> > >  README.rst                |  2 +-
> > >  src/apps/qcam/meson.build | 45 +++++++++++----------------------------
> > >  2 files changed, 14 insertions(+), 33 deletions(-)
> > >
> > > diff --git a/README.rst b/README.rst
> > > index 315738ee..6f1c9302 100644
> > > --- a/README.rst
> > > +++ b/README.rst
> > > @@ -88,7 +88,7 @@ for cam: [optional]
> > >          - libsdl2-dev: Enables the SDL sink
> > >
> > >  for qcam: [optional]
> > > -        libtiff-dev qtbase5-dev qttools5-dev-tools
> > > +        libtiff-dev qt6-base-dev qt6-tools-dev-tools
> > >
> > >  for tracing with lttng: [optional]
> > >          liblttng-ust-dev python3-jinja2 lttng-tools
> > > diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build
> > > index 6cf4c171..c7fcfbeb 100644
> > > --- a/src/apps/qcam/meson.build
> > > +++ b/src/apps/qcam/meson.build
> > > @@ -1,13 +1,13 @@
> > >  # SPDX-License-Identifier: CC0-1.0
> > >
> > > -qt5 = import('qt5')
> > > -qt5_dep = dependency('qt5',
> > > +qt6 = import('qt6')
> > > +qt6_dep = dependency('qt6',
> > >                       method : 'pkg-config',
> > > -                     modules : ['Core', 'Gui', 'Widgets'],
> > > +                     modules : ['Core', 'Gui', 'OpenGL', 'OpenGLWidgets', 'Widgets'],
> > >                       required : get_option('qcam'),
> > > -                     version : '>=5.4')
> > > +                     version : '>=6.2')
> >
> > https://mesonbuild.com/Qt6-module.html says
> >
> >   Warning: before version 0.63.0 Meson would fail to find Qt 6.1 or later due to the Qt tools having moved to
> >   the libexec subdirectory, and tool names being suffixed with only the Qt major version number e.g. qmake6.
> >
> > And libcamera currently says
> >
> >   meson_version : '>= 0.60',
> >
> > Could this be an issue?
> >
> 
> Oh yes, I will respin this to update Meson to 0.63. Thanks for catching that.

We aim to ensure libcamera can be built on the most recent LTS release
from major distributions.

Could you verify this please? We can then move to the latest Meson
release supported by the most up to date LTS of {Debian/Ubuntu,
Fedora/RedHat} And probably Suse, though I'm not sure I've ever checked
that one in fact.

Regards
--
Kieran

Patch
diff mbox series

diff --git a/README.rst b/README.rst
index 315738ee..6f1c9302 100644
--- a/README.rst
+++ b/README.rst
@@ -88,7 +88,7 @@  for cam: [optional]
         - libsdl2-dev: Enables the SDL sink
 
 for qcam: [optional]
-        libtiff-dev qtbase5-dev qttools5-dev-tools
+        libtiff-dev qt6-base-dev qt6-tools-dev-tools
 
 for tracing with lttng: [optional]
         liblttng-ust-dev python3-jinja2 lttng-tools
diff --git a/src/apps/qcam/meson.build b/src/apps/qcam/meson.build
index 6cf4c171..c7fcfbeb 100644
--- a/src/apps/qcam/meson.build
+++ b/src/apps/qcam/meson.build
@@ -1,13 +1,13 @@ 
 # SPDX-License-Identifier: CC0-1.0
 
-qt5 = import('qt5')
-qt5_dep = dependency('qt5',
+qt6 = import('qt6')
+qt6_dep = dependency('qt6',
                      method : 'pkg-config',
-                     modules : ['Core', 'Gui', 'Widgets'],
+                     modules : ['Core', 'Gui', 'OpenGL', 'OpenGLWidgets', 'Widgets'],
                      required : get_option('qcam'),
-                     version : '>=5.4')
+                     version : '>=6.2')
 
-if not qt5_dep.found()
+if not qt6_dep.found()
     qcam_enabled = false
     subdir_done()
 endif
@@ -20,46 +20,27 @@  qcam_sources = files([
     'main.cpp',
     'main_window.cpp',
     'message_handler.cpp',
+    'viewfinder_gl.cpp',
     'viewfinder_qt.cpp',
 ])
 
 qcam_moc_headers = files([
     'cam_select_dialog.h',
     'main_window.h',
+    'viewfinder_gl.h',
     'viewfinder_qt.h',
 ])
 
 qcam_resources = files([
     'assets/feathericons/feathericons.qrc',
+    'assets/shader/shaders.qrc',
 ])
 
-qt5_cpp_args = [apps_cpp_args, '-DQT_NO_KEYWORDS']
+qt6_cpp_args = [apps_cpp_args, '-DQT_NO_KEYWORDS']
 
-if cxx.has_header_symbol('QOpenGLWidget', 'QOpenGLWidget',
-                         dependencies : qt5_dep, args : '-fPIC')
-    qcam_sources += files([
-        'viewfinder_gl.cpp',
-    ])
-    qcam_moc_headers += files([
-        'viewfinder_gl.h',
-    ])
-    qcam_resources += files([
-        'assets/shader/shaders.qrc'
-    ])
-endif
-
-# gcc 9 introduced a deprecated-copy warning that is triggered by Qt until
-# Qt 5.13. clang 10 introduced the same warning, but detects more issues
-# that are not fixed in Qt yet. Disable the warning manually in both cases.
-if ((cc.get_id() == 'gcc' and cc.version().version_compare('>=9.0') and
-     qt5_dep.version().version_compare('<5.13')) or
-    (cc.get_id() == 'clang' and cc.version().version_compare('>=10.0')))
-    qt5_cpp_args += ['-Wno-deprecated-copy']
-endif
-
-resources = qt5.preprocess(moc_headers : qcam_moc_headers,
+resources = qt6.preprocess(moc_headers : qcam_moc_headers,
                            qresources : qcam_resources,
-                           dependencies : qt5_dep)
+                           dependencies : qt6_dep)
 
 qcam  = executable('qcam', qcam_sources, resources,
                    install : true,
@@ -69,6 +50,6 @@  qcam  = executable('qcam', qcam_sources, resources,
                        libatomic,
                        libcamera_public,
                        libtiff,
-                       qt5_dep,
+                       qt6_dep,
                    ],
-                   cpp_args : qt5_cpp_args)
+                   cpp_args : qt6_cpp_args)