Skip to content

Commit

Permalink
Fix build as subproject without building documentation
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kjellahl committed May 13, 2021
1 parent 8960f32 commit e1b09c4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
31 changes: 17 additions & 14 deletions docs/docs/reference/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# sigcxx_api_version, build_documentation, source_h_files,
# hg_ccg_basenames, install_datadir, python3, doc_reference,
# can_add_dist_script
# Output: install_docdir, install_devhelpdir, book_name, tag_file
# Output: install_docdir, install_devhelpdir, book_name,
# if build_documentation: tag_file

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

Expand All @@ -17,28 +18,30 @@ foreach module : tag_file_modules
depmod = dependency(module, required: false)
if depmod.found()
if meson.version().version_compare('>=0.54.0')
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile')
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile', default_value: '')
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '')
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '')
else
# TODO: Remove the possibility to build with meson.version() < 0.54.0
# when >= 0.54.0 is available in GitHub's CI (continuous integration).
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile')
doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', default_value: '')
htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', default_value: '')
htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', default_value: '')
endif
if htmlrefpub == ''
htmlrefpub = htmlrefdir
elif htmlrefdir == ''
htmlrefdir = htmlrefpub
endif
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'
if doxytagfile != ''
if htmlrefpub == ''
htmlrefpub = htmlrefdir
elif htmlrefdir == ''
htmlrefdir = htmlrefpub
endif
doxygen_tagfiles += ' "' + doxytagfile + '=' + htmlrefpub + '"'

# Doxygen <= 1.8.15
docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
if htmlrefpub != htmlrefdir
# Doxygen >= 1.8.16
docinstall_flags += ['-l', 's@' + htmlrefpub + '@' + htmlrefdir]
# Doxygen <= 1.8.15
docinstall_flags += ['-l', doxytagfile.split('/')[-1] + '@' + htmlrefdir]
if htmlrefpub != htmlrefdir
# Doxygen >= 1.8.16
docinstall_flags += ['-l', 's@' + htmlrefpub + '@' + htmlrefdir]
endif
endif
endif
endforeach
Expand Down
20 changes: 13 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ endif
mm_common_get = find_program('mm-common-get', required: false)

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

perl = find_program('perl', required: build_documentation)
Expand Down Expand Up @@ -247,13 +250,16 @@ if can_add_dist_script
endif

if meson.is_subproject()
pkgconfig_vars = {
'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html',
'htmlrefpub': 'http://library.gnome.org/devel/libsigc++/unstable/'
}
if build_documentation
pkgconfig_vars += {'doxytagfile': tag_file.full_path()}
endif
sigcxx_dep = declare_dependency(
dependencies: sigcxx_own_dep,
variables: {
'doxytagfile': tag_file.full_path(),
'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html',
'htmlrefpub': 'http://library.gnome.org/devel/libsigc++/unstable/'
}
variables: pkgconfig_vars,
)

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

0 comments on commit e1b09c4

Please sign in to comment.