diff --git a/meson.build b/meson.build index 1406e1d3..54436071 100644 --- a/meson.build +++ b/meson.build @@ -84,7 +84,13 @@ foreach dep : dep_list endforeach incdirs = ROOT_dep.get_variable(cmake: 'PACKAGE_INCLUDE_DIRS').split(';') else - continue # skip declared dependencies + name = dep.get_variable(internal: 'name', default_value: dep.name()) + if name == 'rcdb' + incdirs = [ dep.get_variable(internal: 'includedir') ] + else + warning(f'Unknown dependency "@name@"') + continue + endif endif # append to `dep_*_dirs` arrays, uniquely diff --git a/meson/get-env.py b/meson/get-env.py index 71ba705a..3b59887c 100755 --- a/meson/get-env.py +++ b/meson/get-env.py @@ -1,8 +1,15 @@ #!/usr/bin/env python3 -# meson forbids custom environment variables; this script allows for it, -# but is only used as a last resort -# details: https://github.com/mesonbuild/meson/issues/9 +# Meson forbids custom environment variables; however, our primary deployment +# platform uses Environment Modules, which heavily relies on environment +# variables. Assuming most of our users don't want to worry about this +# constraint, this script grants Meson access to certain environment variables +# from dependencies that need them. +# +# Build options are provided which take prioroty over such environment +# variables; usage of this script should ONLY be a last resort. +# +# Details: https://github.com/mesonbuild/meson/issues/9 from sys import argv, exit from os import environ diff --git a/subprojects/rcdb/meson.build b/subprojects/rcdb/meson.build index 4ed561e1..a07b71c5 100644 --- a/subprojects/rcdb/meson.build +++ b/subprojects/rcdb/meson.build @@ -2,27 +2,36 @@ project( 'rcdb', 'cpp', meson_version: '>=1.2', + version: 'iguana subproject' ) use_rcdb = false rcdb_home = get_option('home') -rcdb_headers = get_option('home') / 'cpp' / 'include' +includedir = get_option('home') / 'cpp' / 'include' if get_option('home') != '' fs = import('fs') - if fs.is_dir(rcdb_headers) + if fs.is_dir(includedir) use_rcdb = true else - warning(f'RCDB include directory "@rcdb_headers@" does not exist; RCDB will not be used') + warning(f'RCDB include directory "@includedir@" does not exist; RCDB will not be used') endif else warning('RCDB not found; either use build option "rcdb:home" or set environment variable "$RCDB_HOME"') endif rcdb_dep = not use_rcdb ? dependency('', required: false) : declare_dependency( - version: get_option('home'), # could use `module info-loaded rcdb` on ifarm, but `get_option('home')` is platform independent + # RCDB lacks a public version number, use its prefix instead to at least + # inform the user which RCDB installation is used; alternatively, we could + # use `module info-loaded rcdb` on ifarm, but it's better to use a + # platform-independent approach + version: get_option('home'), + variables: { + 'name': meson.project_name(), + 'includedir': includedir, + }, include_directories: include_directories( - rcdb_headers, + includedir, is_system: true, # suppress consumer warnings ), )