# Copyright 2020-2022 David Robillard # SPDX-License-Identifier: CC0-1.0 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', ]) ingen_src_root = meson.current_source_dir() ingen_build_root = meson.current_build_dir() major_version = meson.project_version().split('.')[0] versioned_name = '@0@-@1@'.format(meson.project_name(), major_version) ####################### # Compilers and Flags # ####################### # Required tools cpp = meson.get_compiler('cpp') # Set global warning flags if get_option('strict') and not meson.is_subproject() subdir('meson/warnings') endif # Set global warning suppressions subdir('meson/suppressions') add_project_arguments(cpp_suppressions, language: ['cpp']) ########################## # LV2 Path Configuration # ########################## lv2dir = get_option('lv2dir') 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 == '/' lv2dir = '/boot/common/add-ons/lv2' elif target_machine.system() == 'windows' and prefix == 'C:/' lv2dir = 'C:/Program Files/Common/LV2' else lv2dir = prefix / get_option('libdir') / 'lv2' endif endif ########################## # Platform Configuration # ########################## # 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 platform_defines = [ '-DINGEN_DATA_DIR="@0@"'.format(ingen_data_dir), '-DINGEN_MODULE_DIR="@0@"'.format(ingen_module_dir), '-DINGEN_VERSION="@0@"'.format(meson.project_version()), ] if host_machine.system() == 'darwin' platform_defines += [ '-D_DARWIN_C_SOURCE', '-D_POSIX_C_SOURCE=200809L', ] elif host_machine.system() == 'windows' platform_defines += [ '-DINGEN_NO_POSIX', ] elif host_machine.system() in ['gnu', 'linux'] platform_defines += [ '-D_POSIX_C_SOURCE=200809L', '-D_XOPEN_SOURCE=600', ] endif socket_code = '''#include int main(void) { return socket(AF_UNIX, SOCK_STREAM, 0); }''' have_socket = cpp.compiles(socket_code, args: platform_defines, name: 'socket') platform_defines += ['-DHAVE_SOCKET=@0@'.format(have_socket.to_int())] ####################### # Common Dependencies # ####################### boost_dep = dependency('boost') thread_dep = dependency('threads') serd_dep = dependency('serd-0', version: '>= 0.30.4', fallback: ['serd', 'serd_dep']) sord_dep = dependency('sord-0', version: '>= 0.16.0', include_type: 'system', fallback: ['sord', 'sord_dep']) sratom_dep = dependency('sratom-0', version: '>= 0.6.0', fallback: ['sratom', 'sratom_dep']) suil_dep = dependency('suil-0', version: '>= 0.10.0', fallback: ['suil', 'suil_dep']) lv2_dep = dependency('lv2', version: '>= 1.18.0', fallback: ['lv2', 'lv2_dep']) lilv_dep = dependency('lilv-0', version: '>= 0.24.0', fallback: ['lilv', 'lilv_dep']) raul_dep = dependency('raul-2', version: '>= 2.0.0', fallback: ['raul', 'raul_dep']) ####################### # Driver Dependencies # ####################### portaudio_dep = dependency('portaudio-2.0', version: '>= 2.0.0', include_type: 'system', required: get_option('portaudio')) jack_dep = dependency('jack', version: '>= 0.120.0', include_type: 'system', required: get_option('jack')) jack_port_rename_code = '''#include 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()) ############# # 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 subdir('src') ######################## # Programs and Scripts # ######################## executable( 'ingen', files('src/ingen/ingen.cpp'), cpp_args: cpp_suppressions + platform_defines, dependencies: [ingen_dep, raul_dep, serd_dep], implicit_include_directories: false, include_directories: ingen_include_dirs, install: true, ) install_man(files('doc/ingen.1')) subdir('scripts') ######## # Data # ######## install_data( files('src/ingen/ingen.desktop'), install_dir: get_option('datadir') / 'applications', ) subdir('bundles') subdir('icons') ######### # Tests # ######### subdir('tests') if not meson.is_subproject() summary('Install prefix', get_option('prefix')) summary('Data', ingen_data_dir) summary('Executables', get_option('prefix') / get_option('bindir')) summary('LV2 bundles', lv2dir) summary('Man pages', get_option('prefix') / get_option('mandir')) summary('Modules', ingen_module_dir) endif