Fixes and options for package spglib (#40684)

* Fix cmake_args for spglib v2.1.0+

* Add option to build fortran interface in package spglib

* fix style as sugested by ci/prechecks/style

* Enable fortran variant from v1.16.4 as suggested

Co-authored-by: Rocco Meli <r.meli@bluemail.ch>

---------

Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
This commit is contained in:
dmt4 2023-10-27 07:55:57 +01:00 committed by GitHub
parent 37f48aff8b
commit af13d16c2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,10 +48,15 @@ class Spglib(CMakePackage):
version("1.10.0", sha256="117fff308731784bea2ddaf3d076f0ecbf3981b31ea1c1bfd5ce4f057a5325b1")
variant("openmp", default=True, description="Build with OpenMP support", when="@1.16.2:")
variant("fortran", default=True, description="Build Fortran interface", when="@1.16.4:")
@property
def libs(self):
return find_libraries("libsymspg", root=self.prefix, shared=True, recursive=True)
def cmake_args(self):
return [self.define_from_variant("USE_OMP", "openmp")]
pfx = "SPGLIB_" if self.spec.satisfies("@2.1.0:") else ""
return [
self.define_from_variant(pfx + "USE_OMP", "openmp"),
self.define_from_variant(pfx + "WITH_Fortran", "fortran"),
]