ESMF package: support clang with flang
So far, the ESMF package recipe in spack assumes that the spack compilers clang and apple-clang are using gfortran as the Fortran compiler. But with the latest improvements to the LLVM compilers, we need to also support clang with flang.
This commit is contained in:
parent
fc4316cafa
commit
25cfea48f3
@ -270,13 +270,18 @@ def setup_build_environment(self, env):
|
|||||||
elif self.pkg.compiler.name == "intel" or self.pkg.compiler.name == "oneapi":
|
elif self.pkg.compiler.name == "intel" or self.pkg.compiler.name == "oneapi":
|
||||||
env.set("ESMF_COMPILER", "intel")
|
env.set("ESMF_COMPILER", "intel")
|
||||||
elif self.pkg.compiler.name in ["clang", "apple-clang"]:
|
elif self.pkg.compiler.name in ["clang", "apple-clang"]:
|
||||||
env.set("ESMF_COMPILER", "gfortranclang")
|
if "flang" in self.pkg.compiler.fc:
|
||||||
with self.pkg.compiler.compiler_environment():
|
env.set("ESMF_COMPILER", "llvm")
|
||||||
gfortran_major_version = int(
|
elif "gfortran" in self.pkg.compiler.fc:
|
||||||
spack.compiler.get_compiler_version_output(
|
env.set("ESMF_COMPILER", "gfortranclang")
|
||||||
self.pkg.compiler.fc, "-dumpversion"
|
with self.pkg.compiler.compiler_environment():
|
||||||
).split(".")[0]
|
gfortran_major_version = int(
|
||||||
)
|
spack.compiler.get_compiler_version_output(
|
||||||
|
self.pkg.compiler.fc, "-dumpversion"
|
||||||
|
).split(".")[0]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise InstallError("Unsupported C/C++/Fortran compiler combination")
|
||||||
elif self.pkg.compiler.name == "nag":
|
elif self.pkg.compiler.name == "nag":
|
||||||
env.set("ESMF_COMPILER", "nag")
|
env.set("ESMF_COMPILER", "nag")
|
||||||
elif self.pkg.compiler.name == "nvhpc":
|
elif self.pkg.compiler.name == "nvhpc":
|
||||||
@ -309,6 +314,7 @@ def setup_build_environment(self, env):
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
self.pkg.compiler.name in ["gcc", "clang", "apple-clang"]
|
self.pkg.compiler.name in ["gcc", "clang", "apple-clang"]
|
||||||
|
and "gfortran" in self.pkg.compiler.fc
|
||||||
and gfortran_major_version >= 10
|
and gfortran_major_version >= 10
|
||||||
and (self.spec.satisfies("@:8.2.99") or self.spec.satisfies("@8.3.0b09"))
|
and (self.spec.satisfies("@:8.2.99") or self.spec.satisfies("@8.3.0b09"))
|
||||||
):
|
):
|
||||||
|
Loading…
Reference in New Issue
Block a user