summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Huebl <axel.huebl@plasma.ninja>2019-08-05 14:02:23 -0500
committerGitHub <noreply@github.com>2019-08-05 14:02:23 -0500
commit3457dffdcad54a2f7d95aa7bf3215fd6e94d910d (patch)
tree3d2283c865805ebe03a60944b29eaefdd0034da2
parent5560d5b601b1ac5851966c4244c7e3c2246c91a0 (diff)
downloadspack-3457dffdcad54a2f7d95aa7bf3215fd6e94d910d.tar.gz
spack-3457dffdcad54a2f7d95aa7bf3215fd6e94d910d.tar.bz2
spack-3457dffdcad54a2f7d95aa7bf3215fd6e94d910d.tar.xz
spack-3457dffdcad54a2f7d95aa7bf3215fd6e94d910d.zip
openPMD-api: pre-load depend libs (#12279)
When loading `openpmd-api` as a lib to build outside of spack or to build depending spack packages, the "CMake-PUBLIC" header-only library MPark.Variant must be available. Also, the `*Config.cmake` package must be able to find dependent libs if used.
-rw-r--r--var/spack/repos/builtin/packages/openpmd-api/package.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/openpmd-api/package.py b/var/spack/repos/builtin/packages/openpmd-api/package.py
index ccda775a1c..91084ba468 100644
--- a/var/spack/repos/builtin/packages/openpmd-api/package.py
+++ b/var/spack/repos/builtin/packages/openpmd-api/package.py
@@ -92,3 +92,26 @@ class OpenpmdApi(CMakePackage):
args.append('-DopenPMD_USE_INTERNAL_CATCH:BOOL=OFF')
return args
+
+ def setup_environment(self, spack_env, run_env):
+ spec = self.spec
+ # pre-load dependent CMake-PUBLIC header-only libs
+ run_env.prepend_path('CMAKE_PREFIX_PATH', spec['mpark-variant'].prefix)
+ run_env.prepend_path('CPATH', spec['mpark-variant'].prefix.include)
+
+ # more deps searched in openPMDConfig.cmake
+ if spec.satisfies("+mpi"):
+ run_env.prepend_path('CMAKE_PREFIX_PATH', spec['mpi'].prefix)
+ if spec.satisfies("+adios1"):
+ run_env.prepend_path('CMAKE_PREFIX_PATH', spec['adios'].prefix)
+ if spec.satisfies("+adios2"):
+ run_env.prepend_path('CMAKE_PREFIX_PATH', spec['adios2'].prefix)
+ if spec.satisfies("+hdf5"):
+ run_env.prepend_path('CMAKE_PREFIX_PATH', spec['hdf5'].prefix)
+
+ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
+ # pre-load dependent CMake-PUBLIC header-only libs
+ spack_env.prepend_path('CMAKE_PREFIX_PATH',
+ self.spec['mpark-variant'].prefix)
+ spack_env.prepend_path('CPATH',
+ self.spec['mpark-variant'].prefix.include)