diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/meson.build b/meson.build index 68aff7d..becc6cd 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -# Copyright 2019-2022 David Robillard <d@drobilla.net> +# Copyright 2019-2023 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later project('raul', ['cpp'], @@ -23,11 +23,67 @@ versioned_name = 'raul-@0@'.format(meson.project_version().split('.')[0]) pkg = import('pkgconfig') cpp = meson.get_compiler('cpp') -# Set global warning flags -if get_option('strict') and not meson.is_subproject() - subdir('meson/warnings') +# Set global warning suppressions +warning_level = get_option('warning_level') +cpp_suppressions = [] +if cpp.get_id() in ['clang', 'emscripten'] + if warning_level == 'everything' + cpp_suppressions += [ + '-Wno-c++17-extensions', + '-Wno-c++98-compat', + '-Wno-padded', + '-Wno-weak-vtables', + ] + + if host_machine.system() == 'windows' + cpp_suppressions += [ + '-Wno-nonportable-system-include-path', + ] + endif + endif + +elif cpp.get_id() == 'gcc' + if warning_level == 'everything' + cpp_suppressions += [ + '-Wno-abi-tag', + '-Wno-inline', + '-Wno-multiple-inheritance', + '-Wno-padded', + '-Wno-suggest-attribute=pure', + '-Wno-switch-default', + '-Wno-useless-cast', + ] + endif + +elif cpp.get_id() == 'msvc' + cpp_suppressions += [ + '/experimental:external', + '/external:W0', + '/external:anglebrackets', + ] + + if warning_level == 'everything' + cpp_suppressions += [ + '/wd4514', # unreferenced inline function removed + '/wd4625', # copy constructor implicitly deleted + '/wd4626', # assignment operator implicitly deleted + '/wd4710', # function not inlined + '/wd4711', # function selected for automatic inline expansion + '/wd5026', # move constructor implicitly deleted + '/wd5027', # move assignment operator implicitly deleted + '/wd5045', # compiler will insert Spectre mitigation + '/wd5262', # implicit fall-through + ] + endif + + if warning_level in ['everything', '3'] + cpp_suppressions += [ + '/wd4706', # assignment within conditional expression + ] + endif endif -subdir('meson/suppressions') + +cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions) ################ # Dependencies # |