Skip to content

Commit

Permalink
Merge pull request #490 from climbfuji/feature/esmf_clang_flang
Browse files Browse the repository at this point in the history
Update ESMF to support clang with gfortran and clang with flang (spack spack#48026); replace [email protected] with [email protected]
  • Loading branch information
climbfuji authored Dec 16, 2024
2 parents fb5aa53 + 32e303f commit c0dc357
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions var/spack/repos/builtin/packages/esmf/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Esmf(MakefilePackage, PythonExtension):
# Develop is a special name for spack and is always considered the newest version
version("develop", branch="develop")
# generate chksum with 'spack checksum [email protected]'
version("8.8.0b06", commit="aed3278586544bb7687bb03b5c9b65dff67c18a8")
version("8.8.0b10", commit="dc03809c35e37482fc349011540f80c191c452eb")
version("8.7.0", sha256="d7ab266e2af8c8b230721d4df59e61aa03c612a95cc39c07a2d5695746f21f56")
version("8.6.1", sha256="dc270dcba1c0b317f5c9c6a32ab334cb79468dda283d1e395d98ed2a22866364")
version("8.6.0", sha256="ed057eaddb158a3cce2afc0712b49353b7038b45b29aee86180f381457c0ebe7")
Expand Down Expand Up @@ -271,14 +271,18 @@ def setup_build_environment(self, env):
# to avoid having to add clang OpenMP libraries to the
# Fortran linker command.
env.set("ESMF_OPENMP", "OFF")
#
env.set("ESMF_COMPILER", "gfortranclang")
with self.pkg.compiler.compiler_environment():
gfortran_major_version = int(
spack.compiler.get_compiler_version_output(
self.pkg.compiler.fc, "-dumpversion"
).split(".")[0]
)
if "flang" in self.pkg.compiler.fc:
env.set("ESMF_COMPILER", "llvm")
elif "gfortran" in self.pkg.compiler.fc:
env.set("ESMF_COMPILER", "gfortranclang")
with self.pkg.compiler.compiler_environment():
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":
env.set("ESMF_COMPILER", "nag")
elif self.pkg.compiler.name == "pgi":
Expand Down Expand Up @@ -313,6 +317,7 @@ def setup_build_environment(self, env):

if (
self.pkg.compiler.name in ["gcc", "clang", "apple-clang"]
and "gfortran" in self.pkg.compiler.fc
and gfortran_major_version >= 10
and (self.spec.satisfies("@:8.2.99") or self.spec.satisfies("@8.3.0b09"))
):
Expand Down

0 comments on commit c0dc357

Please sign in to comment.