diff options
author | Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> | 2021-11-15 07:21:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-15 13:21:53 +0100 |
commit | ce9ae3c70d899e7e3cc33b2501249a7fe01c93f3 (patch) | |
tree | 91bf06125303019ff1d726ce6a98e368da44252c /var/spack/repos/builtin/packages/bufr/package.py | |
parent | 55e853c16034153a6b9e708f9dbd65f323601934 (diff) | |
download | spack-ce9ae3c70d899e7e3cc33b2501249a7fe01c93f3.tar.gz spack-ce9ae3c70d899e7e3cc33b2501249a7fe01c93f3.tar.bz2 spack-ce9ae3c70d899e7e3cc33b2501249a7fe01c93f3.tar.xz spack-ce9ae3c70d899e7e3cc33b2501249a7fe01c93f3.zip |
Add module variables for NCEPLIBS (#27162)
Use setup_run_environment to search for libraries and set env variables for module generation.
Libraries are installed with CMAKE_INSTALL_LIBDIR, which can be lib or lib64 depending on the machine, which makes it impossible to hardcode through modules.yaml.
Diffstat (limited to 'var/spack/repos/builtin/packages/bufr/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/bufr/package.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/bufr/package.py b/var/spack/repos/builtin/packages/bufr/package.py index 8550e5c4a2..9c665fa2bc 100644 --- a/var/spack/repos/builtin/packages/bufr/package.py +++ b/var/spack/repos/builtin/packages/bufr/package.py @@ -21,3 +21,25 @@ class Bufr(CMakePackage): 'jbathegit'] version('11.5.0', sha256='d154839e29ef1fe82e58cf20232e9f8a4f0610f0e8b6a394b7ca052e58f97f43') + + def _setup_bufr_environment(self, env, suffix): + libname = 'libufr_{0}'.format(suffix) + lib = find_libraries(libname, root=self.prefix, + shared=False, recursive=True) + lib_envname = 'BUFR_LIB{0}'.format(suffix) + inc_envname = 'BUFR_INC{0}'.format(suffix) + include_dir = 'include_{0}'.format(suffix) + + env.set(lib_envname, lib[0]) + env.set(inc_envname, include_dir) + + # Bufr has _DA (dynamic allocation) libs in versions <= 11.5.0 + if self.spec.satisfies('@:11.5.0'): + da_lib = find_libraries(libname + "_DA", root=self.prefix, + shared=False, recursive=True) + env.set(lib_envname + '_DA', da_lib[0]) + env.set(inc_envname + '_DA', include_dir) + + def setup_run_environment(self, env): + for suffix in ('4', '8', 'd'): + self._setup_bufr_environment(env, suffix) |