vtk: fix hdf5 version specification (#30592)

This commit is contained in:
Chuck Atkins 2022-05-12 15:16:57 -04:00 committed by GitHub
parent aa6665d5ee
commit f11572166f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,8 +114,9 @@ class Vtk(CMakePackage):
depends_on('freetype @:2.10.2', when='@:9.0.1') depends_on('freetype @:2.10.2', when='@:9.0.1')
depends_on('freetype') depends_on('freetype')
depends_on('glew') depends_on('glew')
# set hl variant explicitly, similar to issue #7145 depends_on('hdf5~mpi', when='~mpi')
depends_on('hdf5+hl') depends_on('hdf5+mpi', when='+mpi')
depends_on('hdf5@1.8:', when='@8:9.0')
depends_on('hdf5@1.10:', when='@9.1:') depends_on('hdf5@1.10:', when='@9.1:')
depends_on('jpeg') depends_on('jpeg')
depends_on('jsoncpp') depends_on('jsoncpp')
@ -161,6 +162,15 @@ def setup_build_environment(self, env):
# the environment # the environment
env.set('FREETYPE_DIR', self.spec['freetype'].prefix) env.set('FREETYPE_DIR', self.spec['freetype'].prefix)
# Force API compatibility with HDF5
if '+hdf5' in self.spec:
if '@9.1:' in self.spec:
env.append_flags('CFLAGS', '-DH5_USE_110_API')
env.append_flags('CXXFLAGS', '-DH5_USE_110_API')
elif '@8:' in self.spec:
env.append_flags('CFLAGS', '-DH5_USE_18_API')
env.append_flags('CXXFLAGS', '-DH5_USE_18_API')
def cmake_args(self): def cmake_args(self):
spec = self.spec spec = self.spec