Skip to content

Commit b9caa40

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/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 8960f32 commit b9caa40

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

docs/docs/reference/meson.build

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
# sigcxx_api_version, build_documentation, source_h_files,
55
# hg_ccg_basenames, install_datadir, python3, doc_reference,
66
# can_add_dist_script
7-
# Output: install_docdir, install_devhelpdir, book_name, tag_file
7+
# Output: install_docdir, install_devhelpdir, book_name,
8+
# if build_documentation: tag_file
89

910
# There are no built source files in libsigc++-3.0.
1011

@@ -17,28 +18,30 @@ foreach module : tag_file_modules
1718
depmod = dependency(module, required: false)
1819
if depmod.found()
1920
if meson.version().version_compare('>=0.54.0')
20-
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile')
21+
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile', default_value: '')
2122
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
2223
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
2324
else
2425
# TODO: Remove the possibility to build with meson.version() < 0.54.0
2526
# when >= 0.54.0 is available in GitHub's CI (continuous integration).
26-
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile')
27+
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', default_value: '')
2728
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', default_value: '')
2829
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', default_value: '')
2930
endif
30-
if htmlrefpub == ''
31-
htmlrefpub = htmlrefdir
32-
elif htmlrefdir == ''
33-
htmlrefdir = htmlrefpub
34-
endif
35-
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
31+
if doxytagfile != ''
32+
if htmlrefpub == ''
33+
htmlrefpub = htmlrefdir
34+
elif htmlrefdir == ''
35+
htmlrefdir = htmlrefpub
36+
endif
37+
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
3638

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]
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
4245
endif
4346
endif
4447
endforeach

meson.build

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ endif
113113
mm_common_get = find_program('mm-common-get', required: false)
114114

115115
if maintainer_mode and not mm_common_get.found()
116-
error('Maintainer mode requires the \'mm-common-get\' command.\n' +
117-
'Use \'-Dmaintainer-mode=false\' or install the \'mm-common\' package, version 1.0.0 or higher')
116+
message('Maintainer mode requires the \'mm-common-get\' command. If it is not found,\n' +
117+
'use \'-Dmaintainer-mode=false\' or install the \'mm-common\' package, version 1.0.0 or higher.')
118+
# If meson --wrap-mode != forcefallback, Meson falls back to the mm-common
119+
# subproject only if mm-common-get is required.
120+
mm_common_get = find_program('mm-common-get', required: true)
118121
endif
119122

120123
perl = find_program('perl', required: build_documentation)
@@ -247,13 +250,16 @@ if can_add_dist_script
247250
endif
248251

249252
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
250260
sigcxx_dep = declare_dependency(
251261
dependencies: sigcxx_own_dep,
252-
variables: {
253-
'doxytagfile': tag_file.full_path(),
254-
'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html',
255-
'htmlrefpub': 'http://library.gnome.org/devel/libsigc++/unstable/'
256-
}
262+
variables: pkgconfig_vars,
257263
)
258264

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

0 commit comments

Comments
 (0)