From 55f9506e4fe172cd5376ad9d95a99440a90b3c43 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 28 May 2021 16:25:52 -0400 Subject: Split up warning suppression flags more finely This avoids polluting the main list of suppressions with things that are only triggered in tests or examples, making it clearer which warning are present in pugl itself. --- examples/meson.build | 57 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/meson.build b/examples/meson.build index be4091a..6984033 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,5 +1,5 @@ data_dir = get_option('prefix') / get_option('datadir') / 'pugl-0' -example_args = ['-DPUGL_DATA_DIR="@0@"'.format(data_dir)] +example_defines = ['-DPUGL_DATA_DIR="@0@"'.format(data_dir)] gl_examples = [ 'pugl_cpp_demo.cpp', @@ -24,6 +24,51 @@ includes = include_directories( '../include', ) +# Suppress some additional C warnings in examples +example_c_args = [] +if get_option('strict') + if cc.get_id() == 'clang' + example_c_args += [ + '-Wno-float-equal', + '-Wno-padded', + ] + elif cc.get_id() == 'gcc' + example_c_args += [ + '-Wno-float-equal', + '-Wno-padded', + ] + endif + + example_c_args = cc.get_supported_arguments(example_c_args) +endif + +# Suppress some additional C++ warnings in examples +example_cpp_args = [] +if is_variable('cpp') + if cpp.get_id() == 'clang' + example_cpp_args += [ + '-Wno-documentation', # Cairo + '-Wno-documentation-unknown-command', # Cairo + '-Wno-old-style-cast', + '-Wno-padded', + '-Wno-reserved-id-macro', + '-Wno-switch-enum', + ] + elif cpp.get_id() == 'gcc' + example_cpp_args += [ + '-Wno-effc++', + '-Wno-old-style-cast', + '-Wno-padded', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-unused-const-variable', + '-Wno-useless-cast', + ] + endif + + example_cpp_args = cpp.get_supported_arguments(example_cpp_args) +endif + subdir('shaders') # Build GL examples @@ -42,8 +87,8 @@ if opengl_dep.found() executable(target, source, include_directories: includes, - c_args: example_args, - cpp_args: example_args, + c_args: example_defines + example_c_args, + cpp_args: example_defines + example_cpp_args, dependencies: dependencies) endforeach endif @@ -54,7 +99,7 @@ if cairo_dep.found() target = example.split('.')[0] executable(target, example, include_directories: includes, - c_args: example_args, + c_args: example_defines + example_c_args, dependencies: [pugl_dep, cairo_backend_dep]) endforeach endif @@ -72,8 +117,8 @@ if vulkan_dep.found() executable(target, source, include_directories: includes, - c_args: example_args, - cpp_args: example_args, + c_args: example_defines + example_c_args, + cpp_args: example_defines + example_cpp_args, dependencies: dependencies) endforeach endif -- cgit v1.2.1