diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 192 |
1 files changed, 156 insertions, 36 deletions
diff --git a/meson.build b/meson.build index 0c5e5280..3510d895 100644 --- a/meson.build +++ b/meson.build @@ -1,15 +1,18 @@ # Copyright 2020-2023 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later -project('ingen', 'cpp', - version: '0.5.1', - license: 'GPLv3+', - meson_version: '>= 0.56.0', - default_options: [ - 'b_ndebug=if-release', - 'buildtype=release', - 'cpp_std=c++17', - ]) +project( + 'ingen', + 'cpp', + default_options: [ + 'b_ndebug=if-release', + 'buildtype=release', + 'cpp_std=c++17', + ], + license: 'GPLv3+', + meson_version: '>= 0.56.0', + version: '0.5.1', +) ingen_src_root = meson.current_source_dir() ingen_build_root = meson.current_build_dir() @@ -24,16 +27,126 @@ versioned_name = '@0@-@1@'.format(meson.project_name(), major_version) cpp = meson.get_compiler('cpp') # Set global warning suppressions -subdir('meson/suppressions') -add_project_arguments(cpp_suppressions, language: ['cpp']) +warning_level = get_option('warning_level') +cpp_suppressions = [] +if cpp.get_id() == 'clang' + if warning_level == 'everything' + cpp_suppressions = [ + '-Wno-c++17-extensions', + '-Wno-c++98-compat', + '-Wno-c++98-compat-pedantic', + '-Wno-cast-align', + '-Wno-cast-function-type-strict', + '-Wno-cast-qual', + '-Wno-documentation-unknown-command', + '-Wno-exit-time-destructors', + '-Wno-float-conversion', + '-Wno-float-equal', + '-Wno-format-nonliteral', + '-Wno-global-constructors', + '-Wno-implicit-float-conversion', + '-Wno-padded', + '-Wno-reserved-id-macro', + '-Wno-shorten-64-to-32', + '-Wno-sign-conversion', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-unreachable-code', + '-Wno-unsafe-buffer-usage', + '-Wno-vla', + '-Wno-weak-vtables', + ] + + if not meson.is_cross_build() + cpp_suppressions += [ + '-Wno-poison-system-directories', + ] + endif + + if host_machine.system() in ['darwin', 'freebsd'] + cpp_suppressions += [ + '-Wno-comma', # boost + '-Wno-deprecated-copy', # boost + '-Wno-disabled-macro-expansion', # boost + '-Wno-documentation', # JACK + '-Wno-documentation-deprecated-sync', # JACK + '-Wno-extra-semi-stmt', # boost + '-Wno-old-style-cast', # boost + '-Wno-redundant-parens', # boost + '-Wno-suggest-destructor-override', # boost + '-Wno-suggest-override', # boost + '-Wno-unused-template', # boost + '-Wno-zero-as-null-pointer-constant', # boost + ] + endif + endif + + if warning_level in ['everything', '3'] + cpp_suppressions += [ + '-Wno-unused-parameter', + '-Wno-vla-extension', + '-Wno-nullability-extension', + ] + endif + +elif cpp.get_id() == 'gcc' + if warning_level == 'everything' + cpp_suppressions = [ + '-Wno-abi-tag', + '-Wno-alloc-zero', + '-Wno-cast-align', + '-Wno-cast-qual', + '-Wno-conditionally-supported', + '-Wno-conversion', + '-Wno-effc++', + '-Wno-float-conversion', + '-Wno-float-equal', + '-Wno-format', + '-Wno-format-nonliteral', + '-Wno-format-truncation', + '-Wno-inline', + '-Wno-multiple-inheritance', + '-Wno-null-dereference', + '-Wno-old-style-cast', + '-Wno-padded', + '-Wno-redundant-tags', + '-Wno-sign-conversion', + '-Wno-stack-protector', + '-Wno-strict-overflow', + '-Wno-suggest-attribute=cold', + '-Wno-suggest-attribute=const', + '-Wno-suggest-attribute=format', + '-Wno-suggest-attribute=noreturn', + '-Wno-suggest-attribute=pure', + '-Wno-suggest-final-methods', + '-Wno-suggest-final-types', + '-Wno-suggest-override', + '-Wno-switch-default', + '-Wno-switch-enum', + '-Wno-unreachable-code', + '-Wno-unused-const-variable', + '-Wno-useless-cast', + ] + endif + + if warning_level in ['everything', '3'] + cpp_suppressions += ['-Wno-vla'] + endif + + if warning_level in ['everything', '3', '2'] + cpp_suppressions += ['-Wno-unused-parameter'] + endif +endif + +cpp_suppressions = cpp.get_supported_arguments(cpp_suppressions) ########################## # LV2 Path Configuration # ########################## lv2dir = get_option('lv2dir') +prefix = get_option('prefix') if lv2dir == '' - prefix = get_option('prefix') if target_machine.system() == 'darwin' and prefix == '/' lv2dir = '/Library/Audio/Plug-Ins/LV2' elif target_machine.system() == 'haiku' and prefix == '/' @@ -50,8 +163,12 @@ endif ########################## # TODO: Distinguish modules from libraries and move modules to a subdirectory -ingen_data_dir = get_option('prefix') / get_option('datadir') / 'ingen' # / versioned_name -ingen_module_dir = get_option('prefix') / get_option('libdir') # / versioned_name +ingen_data_dir = ( + prefix / get_option('datadir') / 'ingen' # / versioned_name +) +ingen_module_dir = ( + prefix / get_option('libdir') # / versioned_name +) # Use versioned name everywhere to support parallel major version installations if host_machine.system() == 'windows' @@ -88,9 +205,7 @@ endif socket_code = '''#include <sys/socket.h> int main(void) { return socket(AF_UNIX, SOCK_STREAM, 0); }''' -have_socket = cpp.compiles(socket_code, - args: platform_defines, - name: 'socket') +have_socket = cpp.compiles(socket_code, args: platform_defines, name: 'socket') platform_defines += ['-DHAVE_SOCKET=@0@'.format(have_socket.to_int())] @@ -103,45 +218,43 @@ thread_dep = dependency('threads') serd_dep = dependency( 'serd-0', - fallback: ['serd', 'serd_dep'], + include_type: 'system', version: '>= 0.30.4', ) sord_dep = dependency( 'sord-0', - fallback: ['sord', 'sord_dep'], include_type: 'system', version: '>= 0.16.15', ) sratom_dep = dependency( 'sratom-0', - fallback: ['sratom', 'sratom_dep'], + include_type: 'system', version: '>= 0.6.0', ) suil_dep = dependency( 'suil-0', + include_type: 'system', version: '>= 0.10.0', - fallback: ['suil', 'suil_dep'], ) lv2_dep = dependency( 'lv2', - fallback: ['lv2', 'lv2_dep'], include_type: 'system', version: '>= 1.18.0', ) lilv_dep = dependency( 'lilv-0', - fallback: ['lilv', 'lilv_dep'], + include_type: 'system', version: '>= 0.24.21', ) raul_dep = dependency( 'raul-2', - fallback: ['raul', 'raul_dep'], + include_type: 'system', version: '>= 2.0.0', ) @@ -149,24 +262,31 @@ raul_dep = dependency( # Driver Dependencies # ####################### -portaudio_dep = dependency('portaudio-2.0', - version: '>= 2.0.0', - include_type: 'system', - required: get_option('portaudio')) +portaudio_dep = dependency( + 'portaudio-2.0', + include_type: 'system', + required: get_option('portaudio'), + version: '>= 2.0.0', +) -jack_dep = dependency('jack', - version: '>= 0.120.0', - include_type: 'system', - required: get_option('jack')) +jack_dep = dependency( + 'jack', + include_type: 'system', + required: get_option('jack'), + version: '>= 0.120.0', +) jack_port_rename_code = '''#include <jack/jack.h> int main(void) { return !!&jack_port_rename; }''' platform_defines += '-DHAVE_JACK_PORT_RENAME=@0@'.format( - cpp.compiles(jack_port_rename_code, - args: platform_defines, - dependencies: [jack_dep], - name: 'jack_port_rename').to_int()) + cpp.compiles( + jack_port_rename_code, + args: platform_defines, + dependencies: [jack_dep], + name: 'jack_port_rename', + ).to_int(), +) ############# # Libraries # |