| 1 |
# docs/reference |
| 2 |
|
| 3 |
# Input: project_build_root, project_source_root, cairomm_pcname, |
| 4 |
# build_documentation, source_h_files, install_datadir, python3, |
| 5 |
# doc_reference_py, dot |
| 6 |
# Output: install_docdir, install_devhelpdir, if build_documentation: tag_file |
| 7 |
|
| 8 |
# There are no built source files in cairomm. |
| 9 |
|
| 10 |
tag_file_modules = [ |
| 11 |
'mm-common-libstdc++', |
| 12 |
'sigc++-3.0', |
| 13 |
] |
| 14 |
doxygen_tagfiles = '' |
| 15 |
doxygen_tag_targets = [] |
| 16 |
docinstall_flags = [] |
| 17 |
foreach module : tag_file_modules |
| 18 |
depmod = dependency(module, required: false) |
| 19 |
if depmod.found() |
| 20 |
doxytagfile = depmod.get_variable('doxytagfile', default_value: '') |
| 21 |
if doxytagfile != '' |
| 22 |
if depmod.type_name() == 'internal' |
| 23 |
# Subprojects must build their tag files before doxygen is called. |
| 24 |
if module.startswith('mm-common') |
| 25 |
doxygen_tag_targets += subproject('mm-common').get_variable('global_tag_file_target') |
| 26 |
else |
| 27 |
doxygen_tag_targets += subproject(module).get_variable('global_tag_file_target') |
| 28 |
endif |
| 29 |
endif |
| 30 |
htmlrefpub = depmod.get_variable('htmlrefpub', default_value: '') |
| 31 |
htmlrefdir = depmod.get_variable('htmlrefdir', default_value: '') |
| 32 |
if htmlrefpub == '' |
| 33 |
htmlrefpub = htmlrefdir |
| 34 |
elif htmlrefdir == '' |
| 35 |
htmlrefdir = htmlrefpub |
| 36 |
endif |
| 37 |
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"' |
| 38 |
|
| 39 |
# Doxygen <= 1.8.15 |
| 40 |
docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir] |
| 41 |
if htmlrefpub != htmlrefdir |
| 42 |
# Doxygen >= 1.8.16 |
| 43 |
docinstall_flags += ['-l', 's@' + htmlrefpub + '@' + htmlrefdir] |
| 44 |
endif |
| 45 |
endif |
| 46 |
endif |
| 47 |
endforeach |
| 48 |
|
| 49 |
book_name = cairomm_pcname |
| 50 |
book_title = meson.project_name() + ' Reference Manual' |
| 51 |
|
| 52 |
# Configuration data for Doxyfile. |
| 53 |
doc_conf_data = configuration_data() |
| 54 |
doc_conf_data.set('configure_input', |
| 55 |
'docs/reference/Doxyfile. Generated from Doxyfile.in by meson.configure_file().') |
| 56 |
doc_conf_data.set('PACKAGE_NAME', meson.project_name()) |
| 57 |
doc_conf_data.set('PACKAGE_VERSION', meson.project_version()) |
| 58 |
doc_conf_data.set('abs_top_builddir', project_build_root) |
| 59 |
doc_conf_data.set('abs_top_srcdir', project_source_root) |
| 60 |
doc_conf_data.set('CAIROMM_MODULE_NAME', book_name) |
| 61 |
doc_conf_data.set('DOXYGEN_TAGFILES', doxygen_tagfiles) |
| 62 |
doc_conf_data.set('DOXYGEN_HAVE_DOT', dot.found() ? 'YES' : 'NO') |
| 63 |
|
| 64 |
doxyfile = configure_file( |
| 65 |
input: 'Doxyfile.in', |
| 66 |
output: '@BASENAME@', |
| 67 |
configuration: doc_conf_data, |
| 68 |
) |
| 69 |
|
| 70 |
# Installation directories relative to {prefix}. |
| 71 |
install_docdir = install_datadir / 'doc' / book_name |
| 72 |
install_reference_docdir = install_docdir / 'reference' |
| 73 |
install_devhelpdir = install_datadir / 'devhelp' / 'books' / book_name |
| 74 |
|
| 75 |
if not build_documentation |
| 76 |
# Documentation shall not be built or installed. |
| 77 |
# Return to the calling meson.build file. |
| 78 |
subdir_done() |
| 79 |
endif |
| 80 |
|
| 81 |
# Input .h files to Doxygen. |
| 82 |
src_h_files = [] |
| 83 |
foreach file : source_h_files |
| 84 |
src_h_files += project_source_root / 'cairomm' / file |
| 85 |
endforeach |
| 86 |
|
| 87 |
doctool_dir = project_source_root / 'untracked' / 'docs' # MMDOCTOOLDIR |
| 88 |
doctool_dist_dir = 'untracked' / 'docs' # Relative to MESON_DIST_ROOT |
| 89 |
|
| 90 |
tag_file = custom_target('html_and_tag', |
| 91 |
input: src_h_files, |
| 92 |
output: book_name + '.tag', |
| 93 |
command: [ |
| 94 |
python3, doc_reference_py, 'doxygen', |
| 95 |
doctool_dir, |
| 96 |
'@OUTPUT@', |
| 97 |
'@INPUT@', |
| 98 |
], |
| 99 |
depend_files: doxyfile, |
| 100 |
depends: doxygen_tag_targets, |
| 101 |
build_by_default: build_documentation, |
| 102 |
install: true, |
| 103 |
install_dir: install_reference_docdir, |
| 104 |
install_tag: 'doc', |
| 105 |
) |
| 106 |
|
| 107 |
devhelp_file = custom_target('devhelp', |
| 108 |
input: tag_file, |
| 109 |
output: book_name + '.devhelp2', |
| 110 |
command: [ |
| 111 |
python3, doc_reference_py, 'devhelp', |
| 112 |
doctool_dir, |
| 113 |
'@INPUT@', |
| 114 |
'@OUTPUT@', |
| 115 |
book_name, |
| 116 |
book_title, |
| 117 |
], |
| 118 |
build_by_default: build_documentation, |
| 119 |
) |
| 120 |
|
| 121 |
# Install Devhelp file and html files. |
| 122 |
meson.add_install_script( |
| 123 |
python3, doc_reference_py, 'install_doc', |
| 124 |
doctool_dir, |
| 125 |
devhelp_file.full_path(), |
| 126 |
install_devhelpdir, |
| 127 |
install_reference_docdir / 'html', |
| 128 |
docinstall_flags, |
| 129 |
install_tag: 'doc', |
| 130 |
) |
| 131 |
|
| 132 |
# Distribute built files and files copied by mm-common-get. |
| 133 |
meson.add_dist_script( |
| 134 |
python3, doc_reference_py, 'dist_doc', |
| 135 |
doctool_dir, |
| 136 |
doctool_dist_dir, |
| 137 |
meson.current_build_dir(), |
| 138 |
tag_file.full_path(), |
| 139 |
devhelp_file.full_path(), |
| 140 |
) |