diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 97 |
1 files changed, 93 insertions, 4 deletions
diff --git a/meson.build b/meson.build index 4b01ff9c..255c1870 100644 --- a/meson.build +++ b/meson.build @@ -12,10 +12,11 @@ project( ], license: 'ISC', meson_version: '>= 0.56.0', - version: '0.32.3', + version: '0.32.5', ) serd_src_root = meson.current_source_dir() +serd_build_root = meson.current_build_dir() major_version = meson.project_version().split('.')[0] version_suffix = '-@0@'.format(major_version) versioned_name = 'serd' + version_suffix @@ -28,8 +29,94 @@ versioned_name = 'serd' + version_suffix pkg = import('pkgconfig') cc = meson.get_compiler('c') -# Set global warning flags -subdir('meson/suppressions') +# Set global warning suppressions +warning_level = get_option('warning_level') +c_suppressions = [] +if cc.get_id() in ['clang', 'emscripten'] + if warning_level == 'everything' + c_suppressions += [ + '-Wno-cast-align', + '-Wno-cast-function-type-strict', + '-Wno-cast-qual', + '-Wno-declaration-after-statement', + '-Wno-format-nonliteral', + '-Wno-padded', + '-Wno-switch-default', + '-Wno-unsafe-buffer-usage', + ] + + if host_machine.system() == 'windows' + c_suppressions += [ + '-Wno-deprecated-declarations', + '-Wno-nonportable-system-include-path', + '-Wno-unused-macros', + ] + endif + endif + + if warning_level in ['everything', '3'] + c_suppressions += ['-Wno-nullability-extension'] + + if host_machine.system() == 'freebsd' + c_suppressions += ['-Wno-c11-extensions'] + endif + endif + + if not meson.is_cross_build() + c_suppressions += ['-Wno-poison-system-directories'] + endif + +elif cc.get_id() == 'gcc' + if warning_level == 'everything' + c_suppressions += [ + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-format-nonliteral', + '-Wno-inline', + '-Wno-padded', + '-Wno-switch-default', + '-Wno-unsuffixed-float-constants', + '-Wno-unused-const-variable', + ] + + if host_machine.system() == 'windows' + c_suppressions += ['-Wno-float-conversion'] + endif + endif + +elif cc.get_id() == 'msvc' + c_suppressions += [ + '/experimental:external', + '/external:W0', + '/external:anglebrackets', + ] + + if warning_level == 'everything' + c_suppressions += [ + '/wd4061', # enumerator in switch is not explicitly handled + '/wd4514', # unreferenced inline function has been removed + '/wd4710', # function not inlined + '/wd4711', # function selected for automatic inline expansion + '/wd4800', # implicit conversion from int to bool + '/wd4820', # padding added after construct + '/wd5045', # will insert Spectre mitigation for memory load + ] + endif + + if warning_level in ['everything', '3'] + c_suppressions += [ + '/wd4706', # assignment within conditional expression + ] + endif + + if warning_level in ['everything', '3', '2'] + c_suppressions += [ + '/wd4996', # POSIX name for this item is deprecated + ] + endif +endif + +c_suppressions = cc.get_supported_arguments(c_suppressions) ################ # Dependencies # @@ -135,6 +222,7 @@ libserd = library( darwin_versions: [major_version + '.0.0', meson.project_version()], dependencies: m_dep, gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, include_directories: include_dirs, install: true, soversion: soversion, @@ -148,7 +236,7 @@ serd_dep = declare_dependency( link_with: libserd, ) -# Generage pkg-config file for external dependants +# Generate pkg-config file for external dependants pkg.generate( libserd, description: 'Lightweight C library for working with RDF data', @@ -181,6 +269,7 @@ if not get_option('tools').disabled() files('src/serdi.c'), c_args: c_suppressions + platform_c_args, dependencies: serd_dep, + implicit_include_directories: false, install: true, link_args: tool_link_args, ) |