diff options
Diffstat (limited to 'meson.build')
| -rw-r--r-- | meson.build | 169 |
1 files changed, 84 insertions, 85 deletions
diff --git a/meson.build b/meson.build index aa9963f..669c139 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -# Copyright 2021-2022 David Robillard <d@drobilla.net> +# Copyright 2021-2025 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC project( @@ -8,6 +8,8 @@ project( 'b_ndebug=if-release', 'buildtype=release', 'c_std=c99', + 'c_winlibs=', + 'cpp_winlibs=', ], license: 'ISC', meson_version: '>= 0.56.0', @@ -18,25 +20,25 @@ lv2_docdir = get_option('datadir') / 'doc' / 'lv2' lv2_source_root = meson.current_source_dir() lv2_build_root = meson.current_build_dir() -####################### -# Compilers and Flags # -####################### +installing_anything = ( + get_option('bundles') or + get_option('headers') or + get_option('old_headers') +) -# Required tools -pkg = import('pkgconfig') -pymod = import('python') -cc = meson.get_compiler('c') +############### +# Build Tools # +############### -# Optional C++ compiler and Python tools for tests -if not get_option('tests').disabled() - if add_languages(['cpp'], native: false, required: get_option('tests')) - cpp = meson.get_compiler('cpp') - endif +pymod = disabler() +if ( + get_option('bundles') + or get_option('lint') + or not get_option('docs').disabled() +) + pymod = import('python') endif -# Set global warning flags -subdir('meson/suppressions') - ########################## # LV2 Path Configuration # ########################## @@ -59,24 +61,27 @@ endif # Package/Dependency # ###################### -# Generage pkg-config file for external dependants -pkg.generate( - description: 'Plugin standard for audio systems', - filebase: 'lv2', - name: 'LV2', - variables: [ - 'lv2dir=' + lv2dir, - 'plugindir=' + lv2dir, - ], - version: meson.project_version(), -) +# Generate pkg-config file for external dependants +if installing_anything + pkg = import('pkgconfig') + pkg.generate( + description: 'Plugin standard for audio systems', + filebase: 'lv2', + name: 'LV2', + variables: [ + 'lv2dir=' + lv2dir, + 'lv2specdatadir=' + lv2dir, + ], + version: meson.project_version(), + ) +endif # Declare dependency for internal meson dependants lv2_dep = declare_dependency( include_directories: include_directories('include'), variables: [ - 'lv2dir=' + lv2_source_root / 'lv2', - 'plugindir=' + lv2_build_root / 'plugins', + 'lv2dir=' + lv2dir, + 'lv2specdatadir=' + lv2_source_root / 'lv2', ], version: meson.project_version(), ) @@ -132,7 +137,9 @@ all_spec_names = ['core'] + ext_names + extensions_names prefix = get_option('prefix') includedir = get_option('includedir') -install_subdir('include/lv2', install_dir: includedir) +if get_option('headers') + install_subdir('include/lv2', install_dir: includedir) +endif if get_option('old_headers') uri_include_dir = prefix / includedir / 'lv2' / 'lv2plug.in' / 'ns' @@ -182,36 +189,41 @@ subdir('schemas.lv2') lv2_check_specification = files('scripts' / 'lv2_check_specification.py') -check_python = pymod.find_installation( - 'python3', - modules: ['rdflib'], - required: get_option('tests'), -) - -if ( - check_python.found() - and check_python.language_version().version_compare('<3.7') -) - warning('Python 3.7 is required for tests') +if get_option('bundles') check_python = disabler() -endif - -foreach bundle_name : all_spec_names - bundle = 'lv2' / bundle_name + '.lv2' + if not get_option('tests').disabled() + check_python = pymod.find_installation( + 'python3', + modules: ['rdflib'], + required: get_option('tests'), + ) - # Check specification - if check_python.found() - test( - bundle_name, - lv2_check_specification, - args: files(bundle / 'manifest.ttl'), - suite: ['spec'], + if ( + check_python.found() + and check_python.language_version().version_compare('<3.7') ) + warning('Python 3.7 is required for tests') + check_python = disabler() + endif endif - # Install specification bundle - install_subdir(bundle, install_dir: lv2dir) -endforeach + foreach bundle_name : all_spec_names + bundle = 'lv2' / bundle_name + '.lv2' + + # Check specification + if check_python.found() + test( + bundle_name, + lv2_check_specification, + args: files(bundle / 'manifest.ttl'), + suite: ['spec'], + ) + endif + + # Install specification bundle + install_subdir(bundle, install_dir: lv2dir) + endforeach +endif spec_files = files( 'lv2/atom.lv2/atom.meta.ttl', @@ -295,49 +307,34 @@ spec_files = files( ################# # Determine if all the dependencies for building documentation are present -doxygen = find_program('doxygen', required: get_option('docs')) build_docs = false -build_lv2specgen = false -doc_deps = [] if not get_option('docs').disabled() - doc_python_modules = ['lxml', 'markdown', 'pygments', 'rdflib'] - - python = pymod.find_installation( + doxygen = find_program('doxygen', required: get_option('docs')) + doc_python = pymod.find_installation( 'python3', - modules: doc_python_modules, + modules: ['lxml', 'markdown', 'pygments', 'rdflib'], required: get_option('docs'), ) - if python.found() and python.language_version().version_compare('<3.7') + build_docs = doxygen.found() and doc_python.found() + if doc_python.found() and doc_python.language_version().version_compare('<3.7') warning('Python 3.7 is required for documentation') build_docs = false endif - - build_docs = doxygen.found() and python.found() - build_lv2specgen = python.found() -endif - -# Run Doxygen first to generate tags -subdir('doc/c') - -# Set up lv2specgen and lv2specgen_command_prefix (which references tags) -if build_lv2specgen - subdir('lv2specgen') endif -# Generate specification documentation if build_docs - subdir('doc/style') - subdir('doc/ns') -endif + # Run Doxygen first to generate tags + subdir('doc/c') -########### -# Plugins # -########### + # Set up lv2specgen and lv2specgen_command_prefix (which references tags) + subdir('lv2specgen') -# Example plugins and "Programming LV2 Plugins" book -if not get_option('plugins').disabled() - subdir('plugins') + # Generate specification documentation + if build_docs + subdir('doc/style') + subdir('doc/ns') + endif endif ############ @@ -345,7 +342,9 @@ endif ############ # Command-line utilities -subdir('util') +if not get_option('tools').disabled() + subdir('util') +endif # Data and build tests if not get_option('tests').disabled() |