Skip to content

Commit

Permalink
build: propagate includedir
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Jul 24, 2024
1 parent 2374c20 commit 5dcf1d1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
8 changes: 7 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions meson/get-env.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 14 additions & 5 deletions subprojects/rcdb/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
)

0 comments on commit 5dcf1d1

Please sign in to comment.