[bigdft] Enable building dynamic libraries (#41562)
* bigdft: Add support for building shared libraries * bigdft: reformat with black * bigdft: use spec.satisfies instead of searching in spec
This commit is contained in:
		 Ashwin Kumar Karnad
					Ashwin Kumar Karnad
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							adef1460b4
						
					
				
				
					commit
					5b64c55048
				
			| @@ -21,6 +21,9 @@ class BigdftAtlab(AutotoolsPackage): | |||||||
|     variant("mpi", default=True, description="Enable MPI support") |     variant("mpi", default=True, description="Enable MPI support") | ||||||
|     variant("openmp", default=True, description="Enable OpenMP support") |     variant("openmp", default=True, description="Enable OpenMP support") | ||||||
|     variant("openbabel", default=False, description="Enable detection of openbabel compilation") |     variant("openbabel", default=False, description="Enable detection of openbabel compilation") | ||||||
|  |     variant( | ||||||
|  |         "shared", default=True, description="Build shared libraries" | ||||||
|  |     )  # Not default in bigdft, but is typically the default expectation | ||||||
| 
 | 
 | ||||||
|     depends_on("autoconf", type="build") |     depends_on("autoconf", type="build") | ||||||
|     depends_on("automake", type="build") |     depends_on("automake", type="build") | ||||||
| @@ -39,20 +42,31 @@ def configure_args(self): | |||||||
|         prefix = self.prefix |         prefix = self.prefix | ||||||
| 
 | 
 | ||||||
|         fcflags = [] |         fcflags = [] | ||||||
|  |         cflags = [] | ||||||
|  |         cxxflags = [] | ||||||
|  | 
 | ||||||
|         if "+openmp" in spec: |         if "+openmp" in spec: | ||||||
|             fcflags.append(self.compiler.openmp_flag) |             fcflags.append(self.compiler.openmp_flag) | ||||||
| 
 | 
 | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             fcflags.append("-fPIC") | ||||||
|  |             cflags.append("-fPIC") | ||||||
|  |             cxxflags.append("-fPIC") | ||||||
|         if self.spec.satisfies("%gcc@10:"): |         if self.spec.satisfies("%gcc@10:"): | ||||||
|             fcflags.append("-fallow-argument-mismatch") |             fcflags.append("-fallow-argument-mismatch") | ||||||
| 
 | 
 | ||||||
|         args = [ |         args = [ | ||||||
|             "FCFLAGS=%s" % " ".join(fcflags), |             "FCFLAGS=%s" % " ".join(fcflags), | ||||||
|  |             "CFLAGS=%s" % " ".join(cflags), | ||||||
|  |             "CXXFLAGS=%s" % " ".join(cxxflags), | ||||||
|             "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, |             "--with-futile-libs=%s" % spec["bigdft-futile"].libs.ld_flags, | ||||||
|             "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags + "/futile", |             "--with-futile-incs=%s" % spec["bigdft-futile"].headers.include_flags + "/futile", | ||||||
|             "--with-moduledir=%s" % prefix.include, |             "--with-moduledir=%s" % prefix.include, | ||||||
|             "--prefix=%s" % prefix, |             "--prefix=%s" % prefix, | ||||||
|             "--without-etsf-io", |             "--without-etsf-io", | ||||||
|         ] |         ] | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             args.append("--enable-dynamic-libraries") | ||||||
| 
 | 
 | ||||||
|         if "+mpi" in spec: |         if "+mpi" in spec: | ||||||
|             args.append("CC=%s" % spec["mpi"].mpicc) |             args.append("CC=%s" % spec["mpi"].mpicc) | ||||||
|   | |||||||
| @@ -23,6 +23,9 @@ class BigdftChess(AutotoolsPackage, CudaPackage): | |||||||
|     variant("openmp", default=True, description="Enable OpenMP support") |     variant("openmp", default=True, description="Enable OpenMP support") | ||||||
|     variant("scalapack", default=True, description="Enable SCALAPACK support") |     variant("scalapack", default=True, description="Enable SCALAPACK support") | ||||||
|     variant("ntpoly", default=False, description="Option to use NTPoly") |     variant("ntpoly", default=False, description="Option to use NTPoly") | ||||||
|  |     variant( | ||||||
|  |         "shared", default=True, description="Build shared libraries" | ||||||
|  |     )  # Not default in bigdft, but is typically the default expectation | ||||||
|     # variant('minpack', default=False,  description='Give the link-line for MINPACK') |     # variant('minpack', default=False,  description='Give the link-line for MINPACK') | ||||||
| 
 | 
 | ||||||
|     depends_on("autoconf", type="build") |     depends_on("autoconf", type="build") | ||||||
| @@ -73,6 +76,8 @@ def configure_args(self): | |||||||
|             "--prefix=%s" % prefix, |             "--prefix=%s" % prefix, | ||||||
|             "--without-etsf-io", |             "--without-etsf-io", | ||||||
|         ] |         ] | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             args.append("--enable-dynamic-libraries") | ||||||
| 
 | 
 | ||||||
|         if "+mpi" in spec: |         if "+mpi" in spec: | ||||||
|             args.append("CC=%s" % spec["mpi"].mpicc) |             args.append("CC=%s" % spec["mpi"].mpicc) | ||||||
|   | |||||||
| @@ -23,6 +23,9 @@ class BigdftCore(AutotoolsPackage, CudaPackage): | |||||||
|     variant("openmp", default=True, description="Enable OpenMP support") |     variant("openmp", default=True, description="Enable OpenMP support") | ||||||
|     variant("scalapack", default=True, description="Enable SCALAPACK support") |     variant("scalapack", default=True, description="Enable SCALAPACK support") | ||||||
|     variant("openbabel", default=False, description="Enable detection of openbabel compilation") |     variant("openbabel", default=False, description="Enable detection of openbabel compilation") | ||||||
|  |     variant( | ||||||
|  |         "shared", default=True, description="Build shared libraries" | ||||||
|  |     )  # Not default in bigdft, but is typically the default expectation | ||||||
| 
 | 
 | ||||||
|     depends_on("autoconf", type="build") |     depends_on("autoconf", type="build") | ||||||
|     depends_on("automake", type="build") |     depends_on("automake", type="build") | ||||||
| @@ -87,6 +90,8 @@ def configure_args(self): | |||||||
|             "--prefix=%s" % prefix, |             "--prefix=%s" % prefix, | ||||||
|             "--without-etsf-io", |             "--without-etsf-io", | ||||||
|         ] |         ] | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             args.append("--enable-dynamic-libraries") | ||||||
| 
 | 
 | ||||||
|         if "+mpi" in spec: |         if "+mpi" in spec: | ||||||
|             args.append("CC=%s" % spec["mpi"].mpicc) |             args.append("CC=%s" % spec["mpi"].mpicc) | ||||||
|   | |||||||
| @@ -24,6 +24,9 @@ class BigdftFutile(AutotoolsPackage, CudaPackage): | |||||||
| 
 | 
 | ||||||
|     variant("mpi", default=True, description="Enable MPI support") |     variant("mpi", default=True, description="Enable MPI support") | ||||||
|     variant("openmp", default=True, description="Enable OpenMP support") |     variant("openmp", default=True, description="Enable OpenMP support") | ||||||
|  |     variant( | ||||||
|  |         "shared", default=True, description="Build shared libraries" | ||||||
|  |     )  # Not default in bigdft, but is typically the default expectation | ||||||
| 
 | 
 | ||||||
|     depends_on("autoconf", type="build") |     depends_on("autoconf", type="build") | ||||||
|     depends_on("automake", type="build") |     depends_on("automake", type="build") | ||||||
| @@ -59,6 +62,8 @@ def configure_args(self): | |||||||
|             "--with-pyyaml-path=%s" % pyyaml, |             "--with-pyyaml-path=%s" % pyyaml, | ||||||
|             "--prefix=%s" % prefix, |             "--prefix=%s" % prefix, | ||||||
|         ] |         ] | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             args.append("--enable-dynamic-libraries") | ||||||
| 
 | 
 | ||||||
|         if "+openmp" in spec: |         if "+openmp" in spec: | ||||||
|             args.append("--with-openmp") |             args.append("--with-openmp") | ||||||
|   | |||||||
| @@ -26,6 +26,9 @@ class BigdftLibabinit(AutotoolsPackage): | |||||||
|     depends_on("libtool", type="build") |     depends_on("libtool", type="build") | ||||||
| 
 | 
 | ||||||
|     variant("mpi", default=True, description="Enable MPI support") |     variant("mpi", default=True, description="Enable MPI support") | ||||||
|  |     variant( | ||||||
|  |         "shared", default=True, description="Build shared libraries" | ||||||
|  |     )  # Not default in bigdft, but is typically the default expectation | ||||||
| 
 | 
 | ||||||
|     depends_on("python@3.0:", type=("build", "run")) |     depends_on("python@3.0:", type=("build", "run")) | ||||||
| 
 | 
 | ||||||
| @@ -56,6 +59,8 @@ def configure_args(self): | |||||||
|             "--with-moduledir=%s" % prefix.include, |             "--with-moduledir=%s" % prefix.include, | ||||||
|             "--prefix=%s" % prefix, |             "--prefix=%s" % prefix, | ||||||
|         ] |         ] | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             args.append("--enable-dynamic-libraries") | ||||||
| 
 | 
 | ||||||
|         if "+mpi" in spec: |         if "+mpi" in spec: | ||||||
|             args.append("CC=%s" % spec["mpi"].mpicc) |             args.append("CC=%s" % spec["mpi"].mpicc) | ||||||
|   | |||||||
| @@ -23,6 +23,9 @@ class BigdftPsolver(AutotoolsPackage, CudaPackage): | |||||||
|     variant("mpi", default=True, description="Enable MPI support") |     variant("mpi", default=True, description="Enable MPI support") | ||||||
|     variant("openmp", default=True, description="Enable OpenMP support") |     variant("openmp", default=True, description="Enable OpenMP support") | ||||||
|     variant("scalapack", default=True, description="Enable SCALAPACK support") |     variant("scalapack", default=True, description="Enable SCALAPACK support") | ||||||
|  |     variant( | ||||||
|  |         "shared", default=True, description="Build shared libraries" | ||||||
|  |     )  # Not default in bigdft, but is typically the default expectation | ||||||
| 
 | 
 | ||||||
|     depends_on("autoconf", type="build") |     depends_on("autoconf", type="build") | ||||||
|     depends_on("automake", type="build") |     depends_on("automake", type="build") | ||||||
| @@ -69,6 +72,8 @@ def configure_args(self): | |||||||
|             "--prefix=%s" % prefix, |             "--prefix=%s" % prefix, | ||||||
|             "--without-etsf-io", |             "--without-etsf-io", | ||||||
|         ] |         ] | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             args.append("--enable-dynamic-libraries") | ||||||
| 
 | 
 | ||||||
|         if "+mpi" in spec: |         if "+mpi" in spec: | ||||||
|             args.append("CC=%s" % spec["mpi"].mpicc) |             args.append("CC=%s" % spec["mpi"].mpicc) | ||||||
|   | |||||||
| @@ -26,6 +26,9 @@ class BigdftSpred(AutotoolsPackage): | |||||||
|     variant("mpi", default=True, description="Enable MPI support") |     variant("mpi", default=True, description="Enable MPI support") | ||||||
|     variant("openmp", default=True, description="Enable OpenMP support") |     variant("openmp", default=True, description="Enable OpenMP support") | ||||||
|     variant("scalapack", default=True, description="Enable SCALAPACK support") |     variant("scalapack", default=True, description="Enable SCALAPACK support") | ||||||
|  |     variant( | ||||||
|  |         "shared", default=True, description="Build shared libraries" | ||||||
|  |     )  # Not default in bigdft, but is typically the default expectation | ||||||
| 
 | 
 | ||||||
|     depends_on("python@3.0:", type=("build", "run")) |     depends_on("python@3.0:", type=("build", "run")) | ||||||
| 
 | 
 | ||||||
| @@ -72,6 +75,8 @@ def configure_args(self): | |||||||
|             "--with-moduledir=%s" % prefix.include, |             "--with-moduledir=%s" % prefix.include, | ||||||
|             "--prefix=%s" % prefix, |             "--prefix=%s" % prefix, | ||||||
|         ] |         ] | ||||||
|  |         if spec.satisfies("+shared"): | ||||||
|  |             args.append("--enable-dynamic-libraries") | ||||||
| 
 | 
 | ||||||
|         if "+mpi" in spec: |         if "+mpi" in spec: | ||||||
|             args.append("CC=%s" % spec["mpi"].mpicc) |             args.append("CC=%s" % spec["mpi"].mpicc) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user