diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 255 |
1 files changed, 197 insertions, 58 deletions
diff --git a/meson.build b/meson.build index 3ff746cd..3510d895 100644 --- a/meson.build +++ b/meson.build @@ -1,15 +1,18 @@ -# Copyright 2020-2022 David Robillard <d@drobilla.net> +# 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++14', - ]) +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() @@ -23,22 +26,127 @@ versioned_name = '@0@-@1@'.format(meson.project_name(), major_version) # Required tools 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() == '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 -# Set global warning suppressions -subdir('meson/suppressions') -add_project_arguments(cpp_suppressions, language: ['cpp']) +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 == '/' @@ -55,8 +163,22 @@ 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' + if get_option('default_library') == 'both' + error('default_library=both is not supported on Windows') + endif + soversion = '' +else + soversion = meson.project_version().split('.')[0] +endif platform_defines = [ '-DINGEN_DATA_DIR="@0@"'.format(ingen_data_dir), @@ -83,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())] @@ -93,67 +213,86 @@ platform_defines += ['-DHAVE_SOCKET=@0@'.format(have_socket.to_int())] # Common Dependencies # ####################### -boost_dep = dependency('boost') +boost_dep = dependency('boost', include_type: 'system') thread_dep = dependency('threads') -serd_dep = dependency('serd-0', - version: '>= 0.30.4', - fallback: ['serd', 'serd_dep']) +serd_dep = dependency( + 'serd-0', + include_type: 'system', + version: '>= 0.30.4', +) -sord_dep = dependency('sord-0', - version: '>= 0.16.0', - include_type: 'system', - fallback: ['sord', 'sord_dep']) +sord_dep = dependency( + 'sord-0', + include_type: 'system', + version: '>= 0.16.15', +) -sratom_dep = dependency('sratom-0', - version: '>= 0.6.0', - fallback: ['sratom', 'sratom_dep']) +sratom_dep = dependency( + 'sratom-0', + include_type: 'system', + version: '>= 0.6.0', +) -suil_dep = dependency('suil-0', - version: '>= 0.10.0', - fallback: ['suil', 'suil_dep']) +suil_dep = dependency( + 'suil-0', + include_type: 'system', + version: '>= 0.10.0', +) -lv2_dep = dependency('lv2', - version: '>= 1.18.0', - fallback: ['lv2', 'lv2_dep']) +lv2_dep = dependency( + 'lv2', + include_type: 'system', + version: '>= 1.18.0', +) -lilv_dep = dependency('lilv-0', - version: '>= 0.24.0', - fallback: ['lilv', 'lilv_dep']) +lilv_dep = dependency( + 'lilv-0', + include_type: 'system', + version: '>= 0.24.21', +) -raul_dep = dependency('raul-2', - version: '>= 2.0.0', - fallback: ['raul', 'raul_dep']) +raul_dep = dependency( + 'raul-2', + include_type: 'system', + version: '>= 2.0.0', +) ####################### # 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 # ############# # Set appropriate arguments for building against the library type -subdir('meson/library') if get_option('default_library') == 'static' add_project_arguments(['-DINGEN_STATIC'], language: ['cpp']) endif |