diff options
author | David Robillard <d@drobilla.net> | 2023-09-02 19:23:21 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-09-02 19:23:21 -0400 |
commit | ce8a14731e78aa68b79f34396ad5dc3d7d7b8ea3 (patch) | |
tree | 49445ccb9ceb8fef189b1b41337f56c2364f94dd /doc/meson.build | |
parent | 215c84198913c356f88e59df565027e2a8dbb43a (diff) | |
download | suil-ce8a14731e78aa68b79f34396ad5dc3d7d7b8ea3.tar.gz suil-ce8a14731e78aa68b79f34396ad5dc3d7d7b8ea3.tar.bz2 suil-ce8a14731e78aa68b79f34396ad5dc3d7d7b8ea3.zip |
Clean up documentation and remove junk files from install
Diffstat (limited to 'doc/meson.build')
-rw-r--r-- | doc/meson.build | 65 |
1 files changed, 58 insertions, 7 deletions
diff --git a/doc/meson.build b/doc/meson.build index 3f6f0bf..b6f6402 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,21 +1,72 @@ -# Copyright 2021-2022 David Robillard <d@drobilla.net> +# Copyright 2021-2023 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC docdir = get_option('datadir') / 'doc' +############# +# Reference # +############# + +# Find required programs doxygen = find_program('doxygen', required: get_option('docs')) -sphinxygen = find_program('sphinxygen', required: false) sphinx_build = find_program('sphinx-build', required: get_option('docs')) -if not sphinxygen.found() - subproject('sphinxygen') - sphinxygen = find_program('sphinxygen', required: get_option('docs')) +# Find sphinxygen or fall back to subproject +sphinxygen = disabler() +if doxygen.found() and sphinx_build.found() + sphinxygen = find_program('sphinxygen', required: false) + if not sphinxygen.found() + subproject('sphinxygen') + sphinxygen = find_program('sphinxygen', required: get_option('docs')) + endif endif +# Build documentation if all required tools are found build_docs = doxygen.found() and sphinxygen.found() and sphinx_build.found() - if build_docs - subdir('c') + # Warn if the "official" theme isn't present + pymod = import('python') + doc_modules = ['sphinx_lv2_theme'] + py = pymod.find_installation('python3', modules: doc_modules, required: false) + if not py.found() + warning('Missing sphinx_lv2_theme module, falling back to alabaster') + endif + + # Configure conf.py for Sphinx + conf_config = configuration_data() + conf_config.set('SUIL_SRCDIR', suil_src_root) + conf_config.set('SUIL_TITLE', get_option('title')) + conf_config.set('SUIL_VERSION', meson.project_version()) + conf_py = configure_file( + configuration: conf_config, + input: files('conf.py.in'), + output: 'conf.py', + ) + + # Copy hand-written documentation files + c_rst_files = files('index.rst', 'overview.rst') + foreach f : c_rst_files + configure_file(copy: true, input: f, output: '@PLAINNAME@') + endforeach + + # Generate reference documentation input with Doxygen and Sphinxygen + subdir('xml') + subdir('api') + + # Build strict Sphinx flags, with termination on warnings if werror=true + sphinx_in_dir = meson.current_build_dir() + sphinx_flags = ['-d', sphinx_in_dir / '.doctrees', '-E', '-a', '-q'] + if get_option('werror') + sphinx_flags += ['-W'] + endif + + # Run Sphinx to generate final documentation for each format + sphinx_build_command = [sphinx_build] + sphinx_flags + foreach format : ['html', 'singlehtml'] + if not get_option(format).disabled() + subdir(format) + endif + endforeach endif if not meson.is_subproject() |