--- /dev/null
+if get_option('doc')
+ # doc dependencies
+ doxygen = find_program('doxygen')
+ sphinx_build = find_program('sphinx-build')
+ # python-breathe is also required, but not auto detected because python 2/3
+
+ # create doxygen in source dir
+ doc_doxyxml = custom_target(
+ 'doxyxml doc',
+ command: [
+ '../scripts/doc-doxyxml.sh',
+ meson.current_source_dir(),
+ ],
+ output: 'doxygen',
+ build_always_stale: true,
+ build_by_default: true,
+ )
+
+ # create html docs in build dir
+ doc = custom_target(
+ 'html doc',
+ command: [
+ sphinx_build,
+ '-W',
+ '-b', 'html',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ output: 'html',
+ build_always_stale: true,
+ build_by_default: true,
+ depends: doc_doxyxml,
+ )
+
+ # install html docs
+ install_subdir(
+ join_paths(meson.current_build_dir(), 'html'),
+ install_dir: doc_dir,
+ )
+endif
# Optional dependencies
-## documentation
-doxygen = find_program('doxygen', required: false)
-sphinx_build = find_program('sphinx-build', required: false)
-python_breathe = run_command(
- 'python3', ['-c', 'import breathe']).returncode() == 0
-if not python_breathe
- warning('python: breathe not found')
-endif
-
## tests
cmocka = dependency('cmocka', required: false)
socket_wrapper = dependency('socket_wrapper', required: false)
subdir('modules')
-# install data
+# documentation, install, tests
# TODO install man
+subdir('doc')
subdir('etc')
option('client', type : 'boolean', value : true, description: 'kresc client binary')
option('daemon', type: 'boolean', value: true, description: 'kresd daemon binary')
+option('doc', type: 'boolean', value: false, description: 'html documentation')
option('modules_dir', type: 'string', description: 'path to kres modules directory')
option('keyfile_default', type: 'string', description: 'path to trust anchors file')
--- /dev/null
+#!/bin/bash
+set -o errexit -o nounset
+
+cd $1
+doxygen