xref: /dpdk/doc/api/meson.build (revision 497cf54829c28859482998957d75477ae2b1bc1c)
1720b14dbSLuca Boccassi# SPDX-License-Identifier: BSD-3-Clause
2720b14dbSLuca Boccassi# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
3720b14dbSLuca Boccassi
4720b14dbSLuca Boccassidoxygen = find_program('doxygen', required: get_option('enable_docs'))
5720b14dbSLuca Boccassi
6bbfc94efSBruce Richardsonif not doxygen.found()
7bbfc94efSBruce Richardson  subdir_done()
8bbfc94efSBruce Richardsonendif
9bbfc94efSBruce Richardson
10720b14dbSLuca Boccassi# due to the CSS customisation script, which needs to run on a file that
11720b14dbSLuca Boccassi# is in a subdirectory that is created at build time and thus it cannot
12720b14dbSLuca Boccassi# be an individual custom_target, we need to wrap the doxygen call in a
13720b14dbSLuca Boccassi# script to run the CSS modification afterwards
1453bb9a07SDmitry Kozlyukgenerate_doxygen = py3 + files('generate_doxygen.py')
1553bb9a07SDmitry Kozlyukgenerate_examples = py3 + files('generate_examples.py')
16720b14dbSLuca Boccassi
17841c83cfSBruce Richardsonhtmldir = join_paths(get_option('datadir'), 'doc', 'dpdk')
18720b14dbSLuca Boccassi
19720b14dbSLuca Boccassi# due to the following bug: https://github.com/mesonbuild/meson/issues/4107
20720b14dbSLuca Boccassi# if install is set to true it will override build_by_default and it will
21720b14dbSLuca Boccassi# cause the target to always be built. If install were to be always set to
22720b14dbSLuca Boccassi# false it would be impossible to install the docs.
23720b14dbSLuca Boccassi# So use a configure option for now.
24720b14dbSLuca Boccassiexample = custom_target('examples.dox',
25720b14dbSLuca Boccassi        output: 'examples.dox',
26e16b972bSBruce Richardson        command: [generate_examples, join_paths(dpdk_source_root, 'examples'), '@OUTPUT@'],
27499fe9dfSBruce Richardson        depfile: 'examples.dox.d',
28720b14dbSLuca Boccassi        install: get_option('enable_docs'),
29720b14dbSLuca Boccassi        install_dir: htmldir,
3087c95f04SBruce Richardson        build_by_default: get_option('enable_docs'))
31720b14dbSLuca Boccassi
32c56185fcSBruce Richardson# set up common Doxygen configuration
33720b14dbSLuca Boccassicdata = configuration_data()
34720b14dbSLuca Boccassicdata.set('VERSION', meson.project_version())
35e16b972bSBruce Richardsoncdata.set('API_EXAMPLES', join_paths(dpdk_build_root, 'doc', 'api', 'examples.dox'))
36e16b972bSBruce Richardsoncdata.set('OUTPUT', join_paths(dpdk_build_root, 'doc', 'api'))
37e16b972bSBruce Richardsoncdata.set('TOPDIR', dpdk_source_root)
38e16b972bSBruce Richardsoncdata.set('STRIP_FROM_PATH', ' '.join([dpdk_source_root, join_paths(dpdk_build_root, 'doc', 'api')]))
391f161999SBruce Richardsoncdata.set('WARN_AS_ERROR', 'NO')
40*497cf548SPaul Szczepanekcdata.set('DTS_API_MAIN_PAGE', join_paths('.', 'dts', 'index.html'))
411f161999SBruce Richardsonif get_option('werror')
421f161999SBruce Richardson    cdata.set('WARN_AS_ERROR', 'YES')
431f161999SBruce Richardsonendif
44720b14dbSLuca Boccassi
45c56185fcSBruce Richardson# configure HTML Doxygen run
46c56185fcSBruce Richardsonhtml_cdata = configuration_data()
47c56185fcSBruce Richardsonhtml_cdata.merge_from(cdata)
48c56185fcSBruce Richardsonhtml_cdata.set('GENERATE_HTML', 'YES')
49c56185fcSBruce Richardsonhtml_cdata.set('GENERATE_MAN', 'NO')
50c56185fcSBruce Richardsonhtml_cdata.set('FULL_PATH_NAMES', 'YES')
51720b14dbSLuca Boccassi
52c56185fcSBruce Richardsondoxy_html_conf = configure_file(input: 'doxy-api.conf.in',
53c56185fcSBruce Richardson        output: 'doxy-api-html.conf',
54c56185fcSBruce Richardson        configuration: html_cdata)
55c56185fcSBruce Richardson
56c56185fcSBruce Richardson# configure manpage Doxygen run
57c56185fcSBruce Richardsonman_cdata = configuration_data()
58c56185fcSBruce Richardsonman_cdata.merge_from(cdata)
59c56185fcSBruce Richardsonman_cdata.set('GENERATE_HTML', 'NO')
60c56185fcSBruce Richardsonman_cdata.set('GENERATE_MAN', 'YES')
61c56185fcSBruce Richardson# for manpages, have the pages only titled with the header name,
62c56185fcSBruce Richardson# rather than the full path to the header
63c56185fcSBruce Richardsonman_cdata.set('FULL_PATH_NAMES', 'NO')
64c56185fcSBruce Richardson
65c56185fcSBruce Richardsondoxy_man_conf = configure_file(input: 'doxy-api.conf.in',
66c56185fcSBruce Richardson        output: 'doxy-api-man.conf',
67c56185fcSBruce Richardson        configuration: man_cdata)
68c56185fcSBruce Richardson
69c56185fcSBruce Richardson# do Doxygen runs
70c56185fcSBruce Richardsondoxy_html_build = custom_target('doxygen-html',
71720b14dbSLuca Boccassi        depends: example,
7210044a8eSBruce Richardson        depend_files: 'doxy-api-index.md',
73c56185fcSBruce Richardson        input: doxy_html_conf,
74b1fa4549SBruce Richardson        output: 'html',
75b1fa4549SBruce Richardson        depfile: 'html.d',
7653bb9a07SDmitry Kozlyuk        command: [generate_doxygen, '@OUTPUT@', doxygen, '@INPUT@'],
77720b14dbSLuca Boccassi        install: get_option('enable_docs'),
78720b14dbSLuca Boccassi        install_dir: htmldir,
7987c95f04SBruce Richardson        build_by_default: get_option('enable_docs'))
80720b14dbSLuca Boccassi
81c56185fcSBruce Richardsondoc_targets += doxy_html_build
82c56185fcSBruce Richardsondoc_target_names += 'Doxygen_API(HTML)'
83c56185fcSBruce Richardson
84c56185fcSBruce Richardsondoxy_man_build = custom_target('doxygen-man',
85c56185fcSBruce Richardson        depends: example,
86c56185fcSBruce Richardson        depend_files: 'doxy-api-index.md',
87c56185fcSBruce Richardson        input: doxy_man_conf,
88c56185fcSBruce Richardson        output: 'man',
89c56185fcSBruce Richardson        depfile: 'man.d',
90c56185fcSBruce Richardson        command: [generate_doxygen, '@OUTPUT@', doxygen, '@INPUT@'],
91c56185fcSBruce Richardson        install: get_option('enable_docs'),
92c56185fcSBruce Richardson        install_dir: get_option('datadir'),
93c56185fcSBruce Richardson        build_by_default: get_option('enable_docs'))
94c56185fcSBruce Richardson
95c56185fcSBruce Richardsondoc_targets += doxy_man_build
96c56185fcSBruce Richardsondoc_target_names += 'Doxygen_API(Manpage)'
97c56185fcSBruce Richardson
98c56185fcSBruce Richardson# refresh the manpage database on install
99c56185fcSBruce Richardson# if DPDK manpages are installed to a staging directory, not in MANPATH, this has no effect
100c56185fcSBruce Richardsonmandb = find_program('mandb', required: false)
1013019b11fSBruce Richardsonif mandb.found() and get_option('enable_docs')
102c56185fcSBruce Richardson    meson.add_install_script(mandb)
103c56185fcSBruce Richardsonendif
1047f932642SJuraj Linkeš
105dfef8292SPaul Szczepanek# used by DTS to place its files into
106dfef8292SPaul Szczepanekapi_build_dir = meson.current_build_dir()
107dfef8292SPaul Szczepanek
1087f932642SJuraj Linkešsubdir('dts')
109