Merge pull request #278 from eschnett/eschnett/hdf5-variants
Enable several variants for HDF5
This commit is contained in:
		| @@ -15,7 +15,10 @@ class Hdf5(Package): | |||||||
|     version('1.8.15', '03cccb5b33dbe975fdcd8ae9dc021f24') |     version('1.8.15', '03cccb5b33dbe975fdcd8ae9dc021f24') | ||||||
|     version('1.8.13', 'c03426e9e77d7766944654280b467289') |     version('1.8.13', 'c03426e9e77d7766944654280b467289') | ||||||
|  |  | ||||||
|  |     variant('cxx', default=True, description='Enable C++ support') | ||||||
|  |     variant('fortran', default=True, description='Enable Fortran support') | ||||||
|     variant('mpi', default=False, description='Enable MPI support') |     variant('mpi', default=False, description='Enable MPI support') | ||||||
|  |     variant('threadsafe', default=False, description='Enable multithreading') | ||||||
|  |  | ||||||
|     depends_on("mpi", when='+mpi') |     depends_on("mpi", when='+mpi') | ||||||
|     depends_on("zlib") |     depends_on("zlib") | ||||||
| @@ -23,11 +26,36 @@ class Hdf5(Package): | |||||||
|     # TODO: currently hard-coded to use OpenMPI |     # TODO: currently hard-coded to use OpenMPI | ||||||
|     def install(self, spec, prefix): |     def install(self, spec, prefix): | ||||||
|         extra_args = [] |         extra_args = [] | ||||||
|  |         if '+cxx' in spec: | ||||||
|  |             extra_args.extend([ | ||||||
|  |                 '--enable-cxx' | ||||||
|  |             ]) | ||||||
|  |         if '+fortran' in spec: | ||||||
|  |             extra_args.extend([ | ||||||
|  |                 '--enable-fortran', | ||||||
|  |                 '--enable-fortran2003' | ||||||
|  |             ]) | ||||||
|         if '+mpi' in spec: |         if '+mpi' in spec: | ||||||
|  |             # The HDF5 configure script warns if cxx and mpi are enabled | ||||||
|  |             # together. There doesn't seem to be a real reason for this, except | ||||||
|  |             # that parts of the MPI interface are not accessible via the C++ | ||||||
|  |             # interface. Since they are still accessible via the C interface, | ||||||
|  |             # this is not actually a problem. | ||||||
|             extra_args.extend([ |             extra_args.extend([ | ||||||
|                 "--enable-parallel", |                 "--enable-parallel", | ||||||
|  |                 "--enable-unsupported", | ||||||
|                 "CC=%s" % spec['mpi'].prefix.bin + "/mpicc", |                 "CC=%s" % spec['mpi'].prefix.bin + "/mpicc", | ||||||
|                 "CXX=%s" % spec['mpi'].prefix.bin + "/mpic++", |                 "CXX=%s" % spec['mpi'].prefix.bin + "/mpic++", | ||||||
|  |                 "FC=%s" % spec['mpi'].prefix.bin + "/mpifort", | ||||||
|  |             ]) | ||||||
|  |         if '+threads' in spec: | ||||||
|  |             if '+cxx' in spec or '+fortran' in spec: | ||||||
|  |                 die("Cannot use variant +threads with either +cxx or +fortran") | ||||||
|  |             extra_args.extend([ | ||||||
|  |                 '--enable-threadsafe', | ||||||
|  |                 '--disable-hl', | ||||||
|  |                 'CPPFLAGS=-DHDatexit=""', | ||||||
|  |                 'CFLAGS=-DHDatexit=""' | ||||||
|             ]) |             ]) | ||||||
|  |  | ||||||
|         configure( |         configure( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin