xref: /dpdk/doc/api/meson.build (revision 42a8fc7daa46256d150278fc9a7a846e27945a0c)
1# SPDX-License-Identifier: BSD-3-Clause
2# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
3
4doxygen = find_program('doxygen', required: get_option('enable_docs'))
5
6if not doxygen.found()
7  subdir_done()
8endif
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
14generate_doxygen = py3 + files('generate_doxygen.py')
15generate_examples = py3 + files('generate_examples.py')
16
17htmldir = join_paths(get_option('datadir'), 'doc', 'dpdk')
18
19# due to the following bug: https://github.com/mesonbuild/meson/issues/4107
20# if install is set to true it will override build_by_default and it will
21# cause the target to always be built. If install were to be always set to
22# false it would be impossible to install the docs.
23# So use a configure option for now.
24example = custom_target('examples.dox',
25        output: 'examples.dox',
26        command: [generate_examples, join_paths(dpdk_source_root, 'examples'), '@OUTPUT@'],
27        depfile: 'examples.dox.d',
28        install: get_option('enable_docs'),
29        install_dir: htmldir,
30        build_by_default: get_option('enable_docs'))
31
32cdata = configuration_data()
33cdata.set('VERSION', meson.project_version())
34cdata.set('API_EXAMPLES', join_paths(dpdk_build_root, 'doc', 'api', 'examples.dox'))
35cdata.set('OUTPUT', join_paths(dpdk_build_root, 'doc', 'api'))
36cdata.set('HTML_OUTPUT', 'html')
37cdata.set('TOPDIR', dpdk_source_root)
38cdata.set('STRIP_FROM_PATH', ' '.join([dpdk_source_root, join_paths(dpdk_build_root, 'doc', 'api')]))
39cdata.set('WARN_AS_ERROR', 'NO')
40if get_option('werror')
41    cdata.set('WARN_AS_ERROR', 'YES')
42endif
43
44doxy_conf = configure_file(input: 'doxy-api.conf.in',
45        output: 'doxy-api.conf',
46        configuration: cdata)
47
48doxy_build = custom_target('doxygen',
49        depends: example,
50        depend_files: 'doxy-api-index.md',
51        input: doxy_conf,
52        output: 'html',
53        depfile: 'html.d',
54        command: [generate_doxygen, '@OUTPUT@', doxygen, '@INPUT@'],
55        install: get_option('enable_docs'),
56        install_dir: htmldir,
57        build_by_default: get_option('enable_docs'))
58
59doc_targets += doxy_build
60doc_target_names += 'Doxygen_API'
61