meson: Use subdir_done() to reduce indentation

Reduce the indentation in the gstreamer and qcam meson.build with
subdir_done(). This follows similar patterns in cam and v4l2.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2021-03-20 23:28:43 +02:00
parent 787852a240
commit 976e01d59b
2 changed files with 80 additions and 76 deletions

View file

@ -1,5 +1,17 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
glib_dep = dependency('glib-2.0', required : get_option('gstreamer'))
gst_dep_version = '>=1.14.0'
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_dep_version,
required : get_option('gstreamer'))
gstallocator_dep = dependency('gstreamer-allocators-1.0', version : gst_dep_version,
required : get_option('gstreamer'))
if not glib_dep.found() or not gstvideo_dep.found() or not gstallocator_dep.found()
subdir_done()
endif
libcamera_gst_sources = [ libcamera_gst_sources = [
'gstlibcamera-utils.cpp', 'gstlibcamera-utils.cpp',
'gstlibcamera.cpp', 'gstlibcamera.cpp',
@ -15,28 +27,18 @@ libcamera_gst_cpp_args = [
'-DPACKAGE="@0@"'.format(meson.project_name()), '-DPACKAGE="@0@"'.format(meson.project_name()),
] ]
glib_dep = dependency('glib-2.0', required : get_option('gstreamer')) # The G_DECLARE_FINAL_TYPE macro creates static inline functions that were
# not marked as possibly unused prior to GLib v2.63.0. This causes clang to
gst_dep_version = '>=1.14.0' # complain about the ones we are not using. Silence the -Wunused-function
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_dep_version, # warning in that case.
required : get_option('gstreamer')) if cc.get_id() == 'clang' and glib_dep.version().version_compare('<2.63.0')
gstallocator_dep = dependency('gstreamer-allocators-1.0', version : gst_dep_version,
required : get_option('gstreamer'))
if glib_dep.found() and gstvideo_dep.found() and gstallocator_dep.found()
# The G_DECLARE_FINAL_TYPE macro creates static inline functions that were
# not marked as possibly unused prior to GLib v2.63.0. This causes clang to
# complain about the ones we are not using. Silence the -Wunused-function
# warning in that case.
if cc.get_id() == 'clang' and glib_dep.version().version_compare('<2.63.0')
libcamera_gst_cpp_args += ['-Wno-unused-function'] libcamera_gst_cpp_args += ['-Wno-unused-function']
endif endif
libcamera_gst = shared_library('gstlibcamera', libcamera_gst = shared_library('gstlibcamera',
libcamera_gst_sources, libcamera_gst_sources,
cpp_args : libcamera_gst_cpp_args, cpp_args : libcamera_gst_cpp_args,
dependencies : [libcamera_dep, gstvideo_dep, gstallocator_dep], dependencies : [libcamera_dep, gstvideo_dep, gstallocator_dep],
install: true, install: true,
install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')), install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
) )
endif

View file

@ -1,5 +1,16 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
qt5 = import('qt5')
qt5_dep = dependency('qt5',
method : 'pkg-config',
modules : ['Core', 'Gui', 'Widgets'],
required : get_option('qcam'),
version : '>=5.4')
if not qt5_dep.found()
subdir_done()
endif
qcam_sources = files([ qcam_sources = files([
'../cam/options.cpp', '../cam/options.cpp',
'../cam/stream_options.cpp', '../cam/stream_options.cpp',
@ -19,31 +30,23 @@ qcam_resources = files([
'assets/feathericons/feathericons.qrc', 'assets/feathericons/feathericons.qrc',
]) ])
qt5 = import('qt5') qcam_deps = [
qt5_dep = dependency('qt5',
method : 'pkg-config',
modules : ['Core', 'Gui', 'Widgets'],
required : get_option('qcam'),
version : '>=5.4')
if qt5_dep.found()
qcam_deps = [
libcamera_dep, libcamera_dep,
qt5_dep, qt5_dep,
] ]
qt5_cpp_args = ['-DQT_NO_KEYWORDS'] qt5_cpp_args = ['-DQT_NO_KEYWORDS']
tiff_dep = dependency('libtiff-4', required : false) tiff_dep = dependency('libtiff-4', required : false)
if tiff_dep.found() if tiff_dep.found()
qt5_cpp_args += ['-DHAVE_TIFF'] qt5_cpp_args += ['-DHAVE_TIFF']
qcam_deps += [tiff_dep] qcam_deps += [tiff_dep]
qcam_sources += files([ qcam_sources += files([
'dng_writer.cpp', 'dng_writer.cpp',
]) ])
endif endif
if cxx.has_header_symbol('QOpenGLWidget', 'QOpenGLWidget', if cxx.has_header_symbol('QOpenGLWidget', 'QOpenGLWidget',
dependencies : qt5_dep, args : '-fPIC') dependencies : qt5_dep, args : '-fPIC')
qcam_sources += files([ qcam_sources += files([
'viewfinder_gl.cpp', 'viewfinder_gl.cpp',
@ -54,23 +57,22 @@ if qt5_dep.found()
qcam_resources += files([ qcam_resources += files([
'assets/shader/shaders.qrc' 'assets/shader/shaders.qrc'
]) ])
endif endif
# gcc 9 introduced a deprecated-copy warning that is triggered by Qt until # 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 # 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. # 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 if ((cc.get_id() == 'gcc' and cc.version().version_compare('>=9.0') and
qt5_dep.version().version_compare('<5.13')) or qt5_dep.version().version_compare('<5.13')) or
(cc.get_id() == 'clang' and cc.version().version_compare('>=10.0'))) (cc.get_id() == 'clang' and cc.version().version_compare('>=10.0')))
qt5_cpp_args += ['-Wno-deprecated-copy'] qt5_cpp_args += ['-Wno-deprecated-copy']
endif endif
resources = qt5.preprocess(moc_headers: qcam_moc_headers, resources = qt5.preprocess(moc_headers: qcam_moc_headers,
qresources : qcam_resources, qresources : qcam_resources,
dependencies: qt5_dep) dependencies: qt5_dep)
qcam = executable('qcam', qcam_sources, resources, qcam = executable('qcam', qcam_sources, resources,
install : true, install : true,
dependencies : qcam_deps, dependencies : qcam_deps,
cpp_args : qt5_cpp_args) cpp_args : qt5_cpp_args)
endif