]> git.tdb.fi Git - ext/sigc++-2.0.git/blob - docs/reference/meson.build
Import libsigc++ 2.10.8 sources
[ext/sigc++-2.0.git] / docs / reference / meson.build
1 # docs/reference
2
3 # Input: built_files_root, project_source_root, sigcxx_pcname,
4 #        sigcxx_api_version, build_documentation, source_h_files,
5 #        built_h_files, install_datadir, python3, doc_reference,
6 #        built_h_file_targets, can_add_dist_script
7 # Output: install_docdir, install_devhelpdir, if build_documentation: tag_file
8
9 tag_file_modules = [
10   'mm-common-libstdc++',
11 ]
12 doxygen_tagfiles = ''
13 doxygen_tag_targets = []
14 docinstall_flags = []
15 foreach module : tag_file_modules
16   depmod = dependency(module, required: false)
17   if depmod.found()
18     doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile', default_value: '')
19     if doxytagfile != ''
20       if depmod.type_name() == 'internal'
21         # Subprojects must build their tag files before doxygen is called.
22         if module.startswith('mm-common')
23           doxygen_tag_targets += subproject('mm-common').get_variable('global_tag_file_target')
24         else
25           doxygen_tag_targets += subproject(module).get_variable('global_tag_file_target')
26         endif
27       endif
28       htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
29       htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
30       if htmlrefpub == ''
31         htmlrefpub = htmlrefdir
32       elif htmlrefdir == ''
33         htmlrefdir = htmlrefpub
34       endif
35       doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
36
37       # Doxygen <= 1.8.15
38       docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
39       if htmlrefpub != htmlrefdir
40         # Doxygen >= 1.8.16
41         docinstall_flags += ['-l', 's@' + htmlrefpub + '@' + htmlrefdir]
42       endif
43     endif
44   endif
45 endforeach
46
47 book_name = 'lib' + sigcxx_pcname
48 book_title = meson.project_name() + ' Reference Manual'
49
50 # Configuration data for Doxyfile.
51 doc_conf_data = configuration_data()
52 doc_conf_data.set('configure_input',
53   'docs/docs/reference/Doxyfile. Generated from Doxyfile.in by meson.configure_file().')
54 doc_conf_data.set('PACKAGE_NAME', meson.project_name())
55 doc_conf_data.set('PACKAGE_VERSION', meson.project_version())
56 doc_conf_data.set('abs_top_builddir', built_files_root)
57 doc_conf_data.set('abs_top_srcdir', project_source_root)
58 doc_conf_data.set('SIGCXX_API_VERSION', sigcxx_api_version)
59 doc_conf_data.set('DOXYGEN_TAGFILES', doxygen_tagfiles)
60
61 doxyfile = configure_file(
62   input: 'Doxyfile.in',
63   output: '@BASENAME@',
64   configuration: doc_conf_data,
65 )
66
67 # Installation directories relative to {prefix}.
68 install_docdir = install_datadir / 'doc' / book_name
69 install_reference_docdir = install_docdir / 'reference'
70 install_devhelpdir = install_datadir / 'devhelp' / 'books' / book_name
71
72 if not build_documentation
73   # Documentation shall not be built or installed.
74   # Return to the calling meson.build file.
75   subdir_done()
76 endif
77
78
79 # Built input .h files to Doxygen.
80 blt_h_files = []
81 foreach file : built_h_files
82   blt_h_files += built_files_root / 'sigc++' / file
83 endforeach
84
85 # Hand-coded input .h files to Doxygen.
86 src_h_files = []
87 foreach file : source_h_files
88   src_h_files += project_source_root / 'sigc++' / file
89 endforeach
90 src_h_files += project_source_root / 'sigc++' / 'sigc++.h'
91
92 doctool_dir = project_source_root / 'untracked' / 'docs' # MMDOCTOOLDIR
93 doctool_dist_dir = 'untracked' / 'docs' # Relative to MESON_DIST_ROOT
94
95 if built_h_file_targets.length() > 0
96   # .h files have been generated from .hg files (maintainer mode).
97   tag_file = custom_target('html_and_tag',
98     input: src_h_files,
99     output: book_name + '.tag',
100     command: [
101       python3, doc_reference, 'doxygen',
102       doctool_dir,
103       '@OUTPUT@',
104       blt_h_files,
105       '@INPUT@',
106     ],
107     depend_files: doxyfile,
108     depends: built_h_file_targets + doxygen_tag_targets,
109     build_by_default: build_documentation,
110     install: true,
111     install_dir: install_reference_docdir,
112   )
113 else
114   # All .h files are stored in the source tree (not maintainer mode).
115   tag_file = custom_target('html_and_tag',
116     input: src_h_files + blt_h_files,
117     output: book_name + '.tag',
118     command: [
119       python3, doc_reference, 'doxygen',
120       doctool_dir,
121       '@OUTPUT@',
122       '@INPUT@',
123     ],
124     depend_files: doxyfile,
125     depends: doxygen_tag_targets,
126     build_by_default: build_documentation,
127     install: true,
128     install_dir: install_reference_docdir,
129   )
130 endif
131
132 devhelp_file = custom_target('devhelp',
133   input: tag_file,
134   output: book_name + '.devhelp2',
135   command: [
136     python3, doc_reference, 'devhelp',
137     doctool_dir,
138     '@INPUT@',
139     '@OUTPUT@',
140     book_name,
141     book_title,
142   ],
143   build_by_default: build_documentation,
144 )
145
146 # Install Devhelp file and html files.
147 meson.add_install_script(
148   python3, doc_reference, 'install_doc',
149   doctool_dir,
150   devhelp_file.full_path(),
151   install_devhelpdir,
152   install_reference_docdir / 'html',
153   docinstall_flags
154 )
155
156 if can_add_dist_script
157   # Distribute built files and files copied by mm-common-get.
158   meson.add_dist_script(
159     python3, doc_reference, 'dist_doc',
160     doctool_dir,
161     doctool_dist_dir,
162     meson.current_build_dir(),
163     tag_file.full_path(),
164     devhelp_file.full_path(),
165   )
166 endif