From c26d4ee44fbcf500f0d3e2c1f8df3ade6e353f47 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 21 Jun 2021 13:07:54 +0200 Subject: [PATCH] meson: build html-docs This allows us to build our Sphinx-based documentation from the meson build system. Reviewed-by: Faith Ekstrand Reviewed-by: Daniel Stone Reviewed-by: Eric Engestrom Part-of: --- docs/meson.build | 15 +++++++++++++++ meson.build | 6 ++++++ meson_options.txt | 7 +++++++ 3 files changed, 28 insertions(+) create mode 100644 docs/meson.build diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 00000000000..db4d15f8bef --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,15 @@ +html_docs = custom_target( + 'html', + depend_files: files('conf.py'), + command: [sphinx, '-b', 'html', '-q', meson.current_source_dir(), + '@OUTPUT@'], + output: 'html', + build_by_default: get_option('html-docs').enabled(), +) + +install_subdir(html_docs.full_path(), + install_dir: join_paths(get_option('datadir'), 'doc', 'mesa'), + exclude_files: ['.buildinfo'], + exclude_directories: ['.doctrees'], + strip_directory: true +) diff --git a/meson.build b/meson.build index ae0daeeebeb..1f64de1e262 100644 --- a/meson.build +++ b/meson.build @@ -2304,6 +2304,12 @@ subdir('src') meson.add_devenv(devenv) +sphinx = find_program('sphinx-build', version : '>= 4.3', + required: get_option('html-docs')) +if sphinx.found() + subdir('docs') +endif + summary( { 'prefix': get_option('prefix'), diff --git a/meson_options.txt b/meson_options.txt index b2678c1d4fe..8fa77670e61 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -483,6 +483,13 @@ option( 'This option is for developers and the Intel CI system only.' ) +option( + 'html-docs', + type : 'feature', + value : 'disabled', + description : 'Build HTML documentation.' +) + option( 'selinux', type : 'boolean',