aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-03 14:04:03 -0400
committerDavid Robillard <d@drobilla.net>2023-05-03 14:04:03 -0400
commitaa6d24924b0449424bd58f667657f4087a573f9c (patch)
tree18f7a261135bf6c05ccee53cf310be6e372dd8b7 /meson.build
parent5c8e540e6b40578068cd470a9857e94f77458787 (diff)
downloadchilbert-aa6d24924b0449424bd58f667657f4087a573f9c.tar.gz
chilbert-aa6d24924b0449424bd58f667657f4087a573f9c.tar.bz2
chilbert-aa6d24924b0449424bd58f667657f4087a573f9c.zip
Replace strict option with new meson warning level
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build44
1 files changed, 28 insertions, 16 deletions
diff --git a/meson.build b/meson.build
index 09712c3..52b9012 100644
--- a/meson.build
+++ b/meson.build
@@ -25,24 +25,36 @@ versioned_name = 'chilbert-@0@'.format(major_version)
pkg = import('pkgconfig')
cpp = meson.get_compiler('cpp')
-# Set global warning flags
-if get_option('strict')
- if not meson.is_subproject()
- subdir('meson/warnings')
- add_project_arguments(all_cpp_warnings, language: ['cpp'])
- endif
-
- cpp_suppressions = []
- if cpp.get_id() == 'clang'
+# Set global warning suppressions
+cpp_suppressions = []
+warning_level = get_option('warning_level')
+if cpp.get_id() in ['clang', 'emscripten']
+ if warning_level == 'everything'
cpp_suppressions += [
+ '-Wno-c++98-compat',
+ '-Wno-c++98-compat-pedantic',
'-Wno-padded',
]
- elif cpp.get_id() == 'gcc'
+
+ if not meson.is_cross_build()
+ cpp_suppressions += [
+ '-Wno-poison-system-directories',
+ ]
+ endif
+ endif
+
+elif cpp.get_id() == 'gcc'
+ if warning_level == 'everything'
cpp_suppressions += [
'-Wno-effc++',
+ '-Wno-inline',
+ '-Wno-suggest-attribute=pure',
'-Wno-volatile',
]
- elif cpp.get_id() == 'msvc'
+ endif
+
+elif cpp.get_id() == 'msvc'
+ if warning_level == 'everything'
cpp_suppressions += [
'/wd4028', # formal parameter different from declaration
'/wd4204', # non-constant aggregate initializer
@@ -55,13 +67,10 @@ if get_option('strict')
'/wd5045', # will insert Spectre mitigation
]
endif
-
- add_project_arguments(
- cpp.get_supported_arguments(cpp_suppressions),
- language: ['cpp'],
- )
endif
+cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions)
+
###########
# Library #
###########
@@ -123,6 +132,7 @@ if not get_option('tests').disabled()
executable(
full_name,
'test/@0@.cpp'.format(full_name),
+ cpp_args: cpp_suppressions,
include_directories: include_directories('include'),
),
timeout: 1200,
@@ -137,6 +147,7 @@ if not get_option('tests').disabled()
executable(
'test_hilbert',
'test/test_hilbert.cpp',
+ cpp_args: cpp_suppressions,
dependencies: [gmp_dep, gmpxx_dep],
include_directories: include_directories('include'),
),
@@ -150,6 +161,7 @@ if not get_option('benchmarks').disabled()
executable(
'bench_@0@'.format(name),
files('benchmark/bench_@0@.cpp'.format(name)),
+ cpp_args: cpp_suppressions,
include_directories: include_directories('include', 'test'),
)
endforeach