summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>2019-03-25 16:01:48 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.com>2019-03-25 16:03:24 +0100
commite4db5d348aa795084164af058f3f7dcd6536b418 (patch)
treec8afb70ebf1753d17f31e7f32cf747e69c827236
parentfbd6efcdeec7112b56ef4edfc1f4250c0ca978a3 (diff)
downloadgst-omx-e4db5d348aa795084164af058f3f7dcd6536b418.tar.gz
meson: sync warnings flags with -good
Add more warnings flags and disabled unused variable warnings if gst debug system is disabled. Copied from gst-plugins-good/meson.build
-rw-r--r--meson.build60
1 files changed, 60 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index ae3ac2a..0071e3d 100644
--- a/meson.build
+++ b/meson.build
@@ -321,6 +321,66 @@ endif
omx_conf_dir = join_paths (get_option ('prefix'), get_option ('sysconfdir'), 'xdg')
cdata.set_quoted('GST_OMX_CONFIG_DIR', omx_conf_dir)
+warning_flags = [
+ '-Wmissing-declarations',
+ '-Wredundant-decls',
+ '-Wwrite-strings',
+ '-Winit-self',
+ '-Wmissing-include-dirs',
+ '-Wno-multichar',
+ '-Wvla',
+ '-Wpointer-arith',
+]
+
+warning_c_flags = [
+ '-Wmissing-prototypes',
+ '-Wdeclaration-after-statement',
+ '-Wold-style-definition',
+ '-Waggregate-return',
+]
+
+have_cxx = add_languages('cpp', required : false)
+
+if have_cxx
+ cxx = meson.get_compiler('cpp')
+endif
+
+foreach extra_arg : warning_flags
+ if cc.has_argument (extra_arg)
+ add_project_arguments([extra_arg], language: 'c')
+ endif
+ if have_cxx and cxx.has_argument (extra_arg)
+ add_project_arguments([extra_arg], language: 'cpp')
+ endif
+endforeach
+
+foreach extra_arg : warning_c_flags
+ if cc.has_argument (extra_arg)
+ add_project_arguments([extra_arg], language: 'c')
+ endif
+endforeach
+
+# Disable compiler warnings for unused variables and args if gst debug system is disabled
+if gst_dep.type_name() == 'internal'
+ gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
+else
+ # We can't check that in the case of subprojects as we won't
+ # be able to build against an internal dependency (which is not built yet)
+ gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
+endif
+
+if gst_debug_disabled
+ message('GStreamer debug system is disabled')
+ if cc.has_argument('-Wno-unused')
+ add_project_arguments('-Wno-unused', language: 'c')
+ endif
+ if have_cxx and cxx.has_argument ('-Wno-unused')
+ add_project_arguments('-Wno-unused', language: 'cpp')
+ endif
+else
+ message('GStreamer debug system is enabled')
+endif
+
configure_file(output : 'config.h', configuration : cdata)
subdir('config')