From e1b09c4fd6d20a12844cb704ac77e905794aa516 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Thu, 13 May 2021 11:04:30 +0200 Subject: [PATCH] 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 --- docs/docs/reference/meson.build | 31 +++++++++++++++++-------------- meson.build | 20 +++++++++++++------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/docs/docs/reference/meson.build b/docs/docs/reference/meson.build index bdf944d..62ff537 100644 --- a/docs/docs/reference/meson.build +++ b/docs/docs/reference/meson.build @@ -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. @@ -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 diff --git a/meson.build b/meson.build index ab1aee0..b2d79fd 100644 --- a/meson.build +++ b/meson.build @@ -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) @@ -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.