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