Skip to content

Commit b19b4ea

Browse files
committed
Fix build as subproject without building documentation
* meson.build: If mm-common-get is not found in maintainer-mode with 'required: false', try with 'required: true'. Don't try to use tag_file, if documentation is not built. * docs/reference/meson.build: Don't use variables from modules that don't define doxytagfile. These are subprojects that don't build their documentation. Fixes #71
1 parent 9e8a77a commit b19b4ea

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

docs/reference/meson.build

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# built_h_files, install_datadir, python3, doc_reference,
66
# built_h_file_targets, can_add_dist_script
77
# Output: install_docdir, install_devhelpdir, tag_file
8+
# Output: install_docdir, install_devhelpdir, if build_documentation: tag_file
89

910
tag_file_modules = [
1011
'mm-common-libstdc++',
@@ -14,21 +15,23 @@ docinstall_flags = []
1415
foreach module : tag_file_modules
1516
depmod = dependency(module, required: false)
1617
if depmod.found()
17-
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile')
18-
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
19-
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
20-
if htmlrefpub == ''
21-
htmlrefpub = htmlrefdir
22-
elif htmlrefdir == ''
23-
htmlrefdir = htmlrefpub
24-
endif
25-
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
26-
27-
# Doxygen <= 1.8.15
28-
docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
29-
if htmlrefpub != htmlrefdir
30-
# Doxygen >= 1.8.16
31-
docinstall_flags += ['-l', 's@' + htmlrefpub + '@' + htmlrefdir]
18+
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile', default_value: '')
19+
if doxytagfile != ''
20+
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
21+
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
22+
if htmlrefpub == ''
23+
htmlrefpub = htmlrefdir
24+
elif htmlrefdir == ''
25+
htmlrefdir = htmlrefpub
26+
endif
27+
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
28+
29+
# Doxygen <= 1.8.15
30+
docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
31+
if htmlrefpub != htmlrefdir
32+
# Doxygen >= 1.8.16
33+
docinstall_flags += ['-l', 's@' + htmlrefpub + '@' + htmlrefdir]
34+
endif
3235
endif
3336
endif
3437
endforeach

meson.build

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ endif
107107
# if documentation shall be built.
108108
mm_common_get = find_program('mm-common-get', required: false)
109109
if maintainer_mode and not mm_common_get.found()
110-
error('mm-common-get not found. mm-common >= 1.0.0 is required.')
110+
message('Maintainer mode requires the \'mm-common-get\' command. If it is not found,\n' +
111+
'install the \'mm-common\' package, version 1.0.0 or higher.')
112+
# If meson --wrap-mode != forcefallback, Meson falls back to the mm-common
113+
# subproject only if mm-common-get is required.
114+
mm_common_get = find_program('mm-common-get', required: true)
111115
endif
112116
m4 = find_program('m4', required: maintainer_mode) # For building C++ code
113117
perl = find_program('perl', required: build_documentation)
@@ -246,13 +250,16 @@ if can_add_dist_script
246250
endif
247251

248252
if meson.is_subproject()
253+
pkgconfig_vars = {
254+
'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html',
255+
'htmlrefpub': 'http://library.gnome.org/devel/libsigc++/unstable/'
256+
}
257+
if build_documentation
258+
pkgconfig_vars += {'doxytagfile': tag_file.full_path()}
259+
endif
249260
sigcxx_dep = declare_dependency(
250261
dependencies: sigcxx_own_dep,
251-
variables: {
252-
'doxytagfile': tag_file.full_path(),
253-
'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html',
254-
'htmlrefpub': 'http://library.gnome.org/devel/libsigc++/unstable/'
255-
}
262+
variables: pkgconfig_vars,
256263
)
257264

258265
# A main project that looks for sigcxx_pcname.pc shall find sigcxx_dep.

0 commit comments

Comments
 (0)