doc: reduce indentation in meson build file
[dpdk.git] / doc / api / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
3
4 doxygen = find_program('doxygen', required: get_option('enable_docs'))
5
6 if not doxygen.found()
7   subdir_done()
8 endif
9
10 # due to the CSS customisation script, which needs to run on a file that
11 # is in a subdirectory that is created at build time and thus it cannot
12 # be an individual custom_target, we need to wrap the doxygen call in a
13 # script to run the CSS modification afterwards
14 generate_doxygen = find_program('generate_doxygen.sh')
15 generate_examples = find_program('generate_examples.sh')
16 generate_css = find_program('doxy-html-custom.sh')
17
18 inputdir = join_paths(meson.source_root(), 'examples')
19 htmldir = join_paths('share', 'doc', 'dpdk')
20
21 # due to the following bug: https://github.com/mesonbuild/meson/issues/4107
22 # if install is set to true it will override build_by_default and it will
23 # cause the target to always be built. If install were to be always set to
24 # false it would be impossible to install the docs.
25 # So use a configure option for now.
26 example = custom_target('examples.dox',
27         input: inputdir,
28         output: 'examples.dox',
29         command: [generate_examples, '@INPUT@', '@OUTPUT@'],
30         install: get_option('enable_docs'),
31         install_dir: htmldir,
32         build_by_default: get_option('enable_docs'))
33
34 cdata = configuration_data()
35 cdata.set('VERSION', meson.project_version())
36 cdata.set('API_EXAMPLES', join_paths(meson.build_root(), 'doc', 'api', 'examples.dox'))
37 cdata.set('OUTPUT', join_paths(meson.build_root(), 'doc', 'api'))
38 cdata.set('HTML_OUTPUT', 'api')
39 cdata.set('TOPDIR', meson.source_root())
40 cdata.set('STRIP_FROM_PATH', meson.source_root())
41
42 doxy_conf = configure_file(input: 'doxy-api.conf.in',
43         output: 'doxy-api.conf',
44         configuration: cdata)
45
46 doxy_build = custom_target('doxygen',
47         depends: example,
48         input: doxy_conf,
49         output: 'api',
50         command: [generate_doxygen, '@INPUT@', '@OUTPUT@', generate_css],
51         install: get_option('enable_docs'),
52         install_dir: htmldir,
53         build_by_default: get_option('enable_docs'))
54
55 doc_targets += doxy_build
56 doc_target_names += 'Doxygen_API'