From patchwork Sun Dec 3 12:56:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 749951 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=ps.report@gmx.net header.b="t8IfZe8m" Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A815FA for ; Sun, 3 Dec 2023 04:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1701608165; x=1702212965; i=ps.report@gmx.net; bh=BqHRV9sTCiORRTurWG/z73DfmxmZ3bDglRz7izoDzH0=; h=X-UI-Sender-Class:From:To:Subject:Date; b=t8IfZe8mv5VXLjbucdZJKwGI0Xj1AuODk4Prm1YwCC4BhhEizdFD+0t3qNQRtqpC sRApGbyV8nLjbNwFVPBAe4v0Jyczt1cdkCi9DWDFy9HUeu8eS25kRUXGtWqxmdVu0 DnD5aRKn1XV6xgxa5UyyYoRWOauVRlbNHB/yeTnIb7S8zpZcOdL7Dv1oaAadP4/Rm UBEJae4M+udJD58jbLdA8LOoAfaz0BomPMFN+0YtleWH3VoO3SC3WQlcO3TyRd23/ CWt/8t77FvYruPA4h0zqRSf8RMcDZ49r4rZoQe0kupsAGZxwCxOA4LpE1CCZ8R28h 64Hg+08FbJO5sxAlJw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([62.216.209.34]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M2f9b-1r7IF82apr-004EdS for ; Sun, 03 Dec 2023 13:56:05 +0100 From: Peter Seiderer To: linux-media@vger.kernel.org Subject: [PATCH v4l-utils v1] meson: add optional Qt6 support Date: Sun, 3 Dec 2023 13:56:05 +0100 Message-ID: <20231203125605.31926-1-ps.report@gmx.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:c73XXkqjwyDSVs1HRpxIIKMOIq33pnbht77GwuJhs9KFukdi5nJ hV2LCoC87C+UsL0ThpFN85Fmv3JjZLDM8JlVAmspA/UNBpFwACnQhWdWU5tKTyKSol8yhyC B3rLaEYg4Cb+BT51PIKrFLGNnEr6bW3bzD07b7OEKRslw8p3W068qe4NsNaBXTWn7jEZ8xS ymDWakrNfeYfJMpgnJ55g== UI-OutboundReport: notjunk:1;M01:P0:0MPdIWSBO3g=;nXH9OyOV9BsH0yQRm0RQqVKRjhU 8jfK0DqzdCTkxcsCl9SVLM+3H+Ow2IqI7ElcdaOyw1JAH31HnijjnOBMxh0Ud7YCK88HgW8Kl KYkNxLR/eVTmhhdx8fiOtlD9aBYmQLvtVrgpim5m/ireeenNqm3a+vhlGv6ww2WOxXIVhSsrG YUN+R6Kb5NgQYH3A4KHx53XEGXVgd7IOGwi31Ipv28Wny1ZKm/IToSJbxC+PVcyLM+G74rCNz RAmmPMvekiDxuna9MVxPQoXye4egDGRCYoAgz2dcJsHBXDl0Rwq37vL2MPyP/eNaaR1MuEFkH 1zpmwXC3cemtgOi1PIygVRPOHASTS38ftFhsd27Ww+rvmBoHBftY5e5y4DQgBBET1tjnvwLWQ qR1LR4a6bIjazIXma/wBThgKMUrj8sYBbgzwVjd6L1iZl3N6GFbtCyMLsygFSBpWolXLNLh5r 2NmuWGWcEQfc6NYdiM0qgPp3uvJH/o2QUf7rqHNcRJHbPDJj3oGekiS8r3KUIh1gqoKb9cNJu 3k4vfKhfrCY2b3ZWg0QdeT1gO1peaY6BqQEQeQ9B/ovfJyL1bIauIflz/4Bd7JEAsECZdFNmH g0x2yNC31Ajbvzx3Rcxj8OJ7SNJgbrrPh29IfDNULdzOTG2MV2jpyD+adyGuipmdlvIm0rkYG gvMJicedhUJj7p9b1F8w74hqnlNie5+6JEqzHR73mhndRkuSz73OoTORg1MJyiG2Vomr5fOSS CTO6IPMKWsNBWXisGy/yo0USfuKMLaIDdaG26oiRLgP5EVEn+9EfL2/JdQQ6qEV/fOabnWb8S R7gxJ/AqXnJYCbQ1oIs+iaWlJ+XP0ic3zODLVEdPlbbX9VHQojWn3K7EwSH2nVxzfu+gl7tnd KKx7BZ0EgBpaBEV/Nmgxor7VFU372PwHbwCuf2UTxEdJBJEmud9uoMxvTLghYj458iMBiUl2Y 2R/HPjh6gL66051vtJQt2bjeg/Y= - bump meson minimum version to 0.57 for module qt6 feature - add optional Qt6 detection - add optional C++ standard gnu++17 as needed for Qt6 - adjust qt_opengl_test inline source code and compile arguments ('-std=gnu++17') for optional Qt6 Signed-off-by: Peter Seiderer --- meson.build | 52 ++++++++++++++++++++++++++++----------- utils/qv4l2/meson.build | 24 ++++++++++++------ utils/qvidcap/meson.build | 22 +++++++++++------ 3 files changed, 69 insertions(+), 29 deletions(-) diff --git a/meson.build b/meson.build index 233cbab0..b4018c82 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project('v4l-utils', 'c', 'cpp', version: '1.27.0', - meson_version : '>= 0.54', + meson_version : '>= 0.57', default_options : [ 'buildtype=debugoptimized', 'warning_level=1', @@ -23,6 +23,7 @@ sys_root = meson.get_external_property('sys_root', '/') fs = import('fs') i18n = import('i18n') pkg = import('pkgconfig') +qt6 = import('qt6') qt5 = import('qt5') as_version = meson.project_version() @@ -89,11 +90,27 @@ dep_libdl = cc.find_library('dl') dep_libelf = cc.find_library('elf', required : get_option('bpf')) dep_libm = cc.find_library('m') dep_librt = cc.find_library('rt') -dep_qt5 = dependency('qt5', modules: ['Core', 'Gui', 'Widgets'], - required : get_option('qvidcap').enabled() or get_option('qv4l2').enabled()) - -dep_qt5_opengl = dependency('qt5', modules: ['OpenGL'], - required : get_option('qvidcap').enabled()) +dep_qt6 = dependency('qt6', modules: ['Core', 'Gui', 'Widgets', 'Core5Compat'], required: false) +if dep_qt6.found() + dep_qt_opengl = dependency('qt6', modules: ['OpenGL', 'OpenGLWidgets'], + required : get_option('qvidcap').enabled()) + dep_qt = dep_qt6 + dep_qt_version = 'Qt6' + dep_qt_options = ['cpp_std=gnu++17'] + dep_qt_args = ['-std=gnu++17'] +else + dep_qt = dependency('qt5', modules: ['Core', 'Gui', 'Widgets'], + required : get_option('qvidcap').enabled() or get_option('qv4l2').enabled()) + if dep_qt.found() + dep_qt_version = 'Qt5' + else + dep_qt_version = '' + endif + dep_qt_opengl = dependency('qt5', modules: ['OpenGL'], + required : get_option('qvidcap').enabled()) + dep_qt_options = [] + dep_qt_args = [] +endif dep_libbpf = dependency('libbpf', required : get_option('bpf'), version : '>=0.7') @@ -289,23 +306,30 @@ if udevdir == '' udevdir = '/lib/udev' endif -qt5_opengl_test = ''' +qt_opengl_test = ''' #define GL_GLEXT_PROTOTYPES #define QT_NO_OPENGL_ES_2 +#include +#if QT_VERSION < 0x060000 #include #include #include #include +#else +#include +#include +#include +#endif #ifndef GL_UNSIGNED_INT_8_8_8_8 #error Missing OpenGL Extensions #endif ''' -have_qt5_opengl = cpp.compiles(qt5_opengl_test, - dependencies : [dep_gl, dep_qt5, dep_qt5_opengl], - args : '-fPIC') -if have_qt5_opengl +have_qt_opengl = cpp.compiles(qt_opengl_test, + dependencies : [dep_gl, dep_qt, dep_qt_opengl], + args : ['-fPIC'] + dep_qt_args) +if have_qt_opengl conf.set('HAVE_QTGL', 1) endif @@ -379,9 +403,9 @@ summary({ 'GL' : dep_gl.found(), 'GLU' : dep_glu.found(), 'JSON-C' : dep_jsonc.found(), - 'Qt5' : [ - dep_qt5.found(), - have_qt5_opengl ? 'with QtGL' : 'without QtGL', + 'Qt5/Qt6' : [ + dep_qt.found(), + dep_qt_version + (have_qt_opengl ? ' with QtGL' : ' without QtGL'), ], 'SDL' : dep_sdl.found(), 'X11' : dep_x11.found(), diff --git a/utils/qv4l2/meson.build b/utils/qv4l2/meson.build index 4860e331..0216b258 100644 --- a/utils/qv4l2/meson.build +++ b/utils/qv4l2/meson.build @@ -1,4 +1,4 @@ -if get_option('qv4l2').disabled() or not dep_qt5.found() +if get_option('qv4l2').disabled() or not dep_qt.found() subdir_done() endif @@ -32,8 +32,8 @@ qv4l2_deps = [ dep_libv4l2, dep_libv4l2util, dep_libv4lconvert, - dep_qt5, - dep_qt5_opengl, + dep_qt, + dep_qt_opengl, dep_threads, ] @@ -42,16 +42,24 @@ qv4l2_incdir = [ v4l2_utils_incdir, ] -qt5_files = qt5.preprocess( - moc_headers : ['qv4l2.h', 'general-tab.h', 'vbi-tab.h', 'capture-win.h'], - qresources : 'qv4l2.qrc', -) -qv4l2_sources += qt5_files +if dep_qt6.found() + qt_files = qt6.preprocess( + moc_headers : ['qv4l2.h', 'general-tab.h', 'vbi-tab.h', 'capture-win.h'], + qresources : 'qv4l2.qrc', + ) +else + qt_files = qt5.preprocess( + moc_headers : ['qv4l2.h', 'general-tab.h', 'vbi-tab.h', 'capture-win.h'], + qresources : 'qv4l2.qrc', + ) +endif +qv4l2_sources += qt_files qv4l2 = executable('qv4l2', sources : qv4l2_sources, install : true, dependencies : qv4l2_deps, + override_options : dep_qt_options, include_directories : qv4l2_incdir) man_pages += [[ meson.current_source_dir(), 'qv4l2', 1 ]] diff --git a/utils/qvidcap/meson.build b/utils/qvidcap/meson.build index 63d76f29..16ca002e 100644 --- a/utils/qvidcap/meson.build +++ b/utils/qvidcap/meson.build @@ -1,10 +1,10 @@ qvidcap_option = get_option('qvidcap') -if qvidcap_option.enabled() and not have_qt5_opengl - error('qvidcap enabled but Qt5 is missing OpenGL support') +if qvidcap_option.enabled() and not have_qt_opengl + error('qvidcap enabled but Qt5/Qt6 is missing OpenGL support') endif -if qvidcap_option.disabled() or not dep_gl.found() or not dep_qt5_opengl.found() or not have_qt5_opengl +if qvidcap_option.disabled() or not dep_gl.found() or not dep_qt_opengl.found() or not have_qt_opengl subdir_done() endif @@ -29,8 +29,8 @@ qvidcap_deps = [ dep_libv4l2, dep_libv4l2util, dep_libv4lconvert, - dep_qt5, - dep_qt5_opengl, + dep_qt, + dep_qt_opengl, dep_threads, ] @@ -39,11 +39,18 @@ qvidcap_incdir = [ v4l2_utils_incdir, ] -qt5_files = qt5.preprocess( +if dep_qt6.found() +qt_files = qt6.preprocess( moc_headers : 'capture.h', qresources : 'qvidcap.qrc', ) -qvidcap_sources += qt5_files +else +qt_files = qt5.preprocess( + moc_headers : 'capture.h', + qresources : 'qvidcap.qrc', +) +endif +qvidcap_sources += qt_files v4l2_convert_sources = files( 'v4l2-convert.glsl', @@ -60,6 +67,7 @@ qvidcap = executable('qvidcap', sources : qvidcap_sources, install : true, dependencies : qvidcap_deps, + override_options : dep_qt_options, include_directories : qvidcap_incdir) man_pages += [[ meson.current_source_dir(), 'qvidcap', 1 ]]