xref: /f-stack/dpdk/doc/api/meson.build (revision 2d9fd380)
1d30ea906Sjfb8856606# SPDX-License-Identifier: BSD-3-Clause
2d30ea906Sjfb8856606# Copyright(c) 2018 Luca Boccassi <[email protected]>
3d30ea906Sjfb8856606
4d30ea906Sjfb8856606doxygen = find_program('doxygen', required: get_option('enable_docs'))
5d30ea906Sjfb8856606
64418919fSjohnjiangif not doxygen.found()
74418919fSjohnjiang  subdir_done()
84418919fSjohnjiangendif
94418919fSjohnjiang
10d30ea906Sjfb8856606# due to the CSS customisation script, which needs to run on a file that
11d30ea906Sjfb8856606# is in a subdirectory that is created at build time and thus it cannot
12d30ea906Sjfb8856606# be an individual custom_target, we need to wrap the doxygen call in a
13d30ea906Sjfb8856606# script to run the CSS modification afterwards
14d30ea906Sjfb8856606generate_doxygen = find_program('generate_doxygen.sh')
15d30ea906Sjfb8856606generate_examples = find_program('generate_examples.sh')
16d30ea906Sjfb8856606generate_css = find_program('doxy-html-custom.sh')
17d30ea906Sjfb8856606
18*2d9fd380Sjfb8856606htmldir = join_paths(get_option('datadir'), 'doc', 'dpdk')
19d30ea906Sjfb8856606
20d30ea906Sjfb8856606# due to the following bug: https://github.com/mesonbuild/meson/issues/4107
21d30ea906Sjfb8856606# if install is set to true it will override build_by_default and it will
22d30ea906Sjfb8856606# cause the target to always be built. If install were to be always set to
23d30ea906Sjfb8856606# false it would be impossible to install the docs.
24d30ea906Sjfb8856606# So use a configure option for now.
25d30ea906Sjfb8856606example = custom_target('examples.dox',
26d30ea906Sjfb8856606	output: 'examples.dox',
27*2d9fd380Sjfb8856606	command: [generate_examples, join_paths(meson.source_root(), 'examples'), '@OUTPUT@'],
28*2d9fd380Sjfb8856606	depfile: 'examples.dox.d',
29d30ea906Sjfb8856606	install: get_option('enable_docs'),
30d30ea906Sjfb8856606	install_dir: htmldir,
314b05018fSfengbojiang	build_by_default: get_option('enable_docs'))
32d30ea906Sjfb8856606
33d30ea906Sjfb8856606cdata = configuration_data()
34d30ea906Sjfb8856606cdata.set('VERSION', meson.project_version())
35d30ea906Sjfb8856606cdata.set('API_EXAMPLES', join_paths(meson.build_root(), 'doc', 'api', 'examples.dox'))
36d30ea906Sjfb8856606cdata.set('OUTPUT', join_paths(meson.build_root(), 'doc', 'api'))
37*2d9fd380Sjfb8856606cdata.set('HTML_OUTPUT', 'html')
38d30ea906Sjfb8856606cdata.set('TOPDIR', meson.source_root())
39d30ea906Sjfb8856606cdata.set('STRIP_FROM_PATH', meson.source_root())
40*2d9fd380Sjfb8856606cdata.set('WARN_AS_ERROR', 'NO')
41*2d9fd380Sjfb8856606if get_option('werror')
42*2d9fd380Sjfb8856606	cdata.set('WARN_AS_ERROR', 'YES')
43*2d9fd380Sjfb8856606endif
44d30ea906Sjfb8856606
45d30ea906Sjfb8856606doxy_conf = configure_file(input: 'doxy-api.conf.in',
46d30ea906Sjfb8856606	output: 'doxy-api.conf',
474418919fSjohnjiang	configuration: cdata)
48d30ea906Sjfb8856606
49d30ea906Sjfb8856606doxy_build = custom_target('doxygen',
50d30ea906Sjfb8856606	depends: example,
51*2d9fd380Sjfb8856606	depend_files: 'doxy-api-index.md',
52d30ea906Sjfb8856606	input: doxy_conf,
53*2d9fd380Sjfb8856606	output: 'html',
54*2d9fd380Sjfb8856606	depfile: 'html.d',
55d30ea906Sjfb8856606	command: [generate_doxygen, '@INPUT@', '@OUTPUT@', generate_css],
56d30ea906Sjfb8856606	install: get_option('enable_docs'),
57d30ea906Sjfb8856606	install_dir: htmldir,
584b05018fSfengbojiang	build_by_default: get_option('enable_docs'))
59d30ea906Sjfb8856606
60d30ea906Sjfb8856606doc_targets += doxy_build
61d30ea906Sjfb8856606doc_target_names += 'Doxygen_API'
62