af98a28bda243b60dca3251a49265099d9879e5d
[ncmpc-debian.git] / doc / meson.build
1 sphinx = find_program('sphinx-build', required:false)
2 if sphinx.found()
3   custom_target(
4     'HTML documentation',
5     output: 'html',
6     input: ['index.rst', 'conf.py'],
7     command: [sphinx, '-q', '-b', 'html', '-d', '@OUTDIR@/doctrees', meson.current_source_dir(), '@OUTPUT@'],
8     build_by_default: true,
9     install: true,
10     install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()),
11   )
12
13   custom_target(
14     'Manpage documentation',
15     output: 'man',
16     input: ['index.rst', 'conf.py'],
17     command: [sphinx, '-q', '-b', 'man', '-d', '@OUTDIR@/doctrees', meson.current_source_dir(), '@OUTPUT@/man1'],
18     build_by_default: true,
19     install: true,
20     install_dir: get_option('datadir'),
21   )
22 endif
23
24 if get_option('documentation')
25   doxygen = find_program('doxygen', required: false)
26
27   if doxygen.found()
28     dconf = configuration_data()
29     dconf.set('VERSION', meson.project_version())
30     dconf.set('abs_top_srcdir', meson.source_root())
31
32     doxyfile = configure_file(input: 'doxygen.conf.in',
33                               output: 'doxygen.conf',
34                               configuration: dconf)
35
36     datadir = join_paths(get_option('datadir'), 'doc', 'spede')
37
38     html_target = custom_target('apidocs',
39                                 input: doxyfile,
40                                 output: 'api',
41                                 command: [doxygen, doxyfile],
42                                 install: true,
43                                 install_dir: docdir)
44   endif
45 endif