diff --git a/var/spack/repos/builtin/packages/nccmp/package.py b/var/spack/repos/builtin/packages/nccmp/package.py index b1be28cc47..56fdd3cfdc 100644 --- a/var/spack/repos/builtin/packages/nccmp/package.py +++ b/var/spack/repos/builtin/packages/nccmp/package.py @@ -2,6 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) + from spack.package import * @@ -11,8 +12,31 @@ class Nccmp(CMakePackage): homepage = "http://nccmp.sourceforge.net/" url = "https://gitlab.com/remikz/nccmp/-/archive/1.9.0.1/nccmp-1.9.0.1.tar.gz" + maintainers("ulmononian", "climbfuji") + version("1.9.0.1", sha256="81e9753cf451afe8248d44c841e102349e07cde942b11d1f91b5f85feb622b99") version("1.8.9.0", sha256="da5d2b4dcd52aec96e7d96ba4d0e97efebbd40fe9e640535e5ee3d5cd082ae50") version("1.8.2.0", sha256="7f5dad4e8670568a71f79d2bcebb08d95b875506d3d5faefafe1a8b3afa14f18") - depends_on("netcdf-c") + depends_on("cmake@3.12:", type="build") + depends_on("netcdf-c", type=("build", "run")) + depends_on("mpi", when="^netcdf-c+mpi~shared") + + def cmake_args(self): + args = [] + cflags = [] + + if self.spec.satisfies("%intel"): + cflags.append("-std=c99") + + if cflags: + args.append(self.define("CMAKE_C_FLAGS", " ".join(cflags))) + + nc = self.spec["netcdf-c"] + if "~shared" in nc: + nc_flags = Executable("nc-config")("--static", "--libs", output=str).strip() + args.append(self.define("CMAKE_EXE_LINKER_FLAGS", nc_flags)) + if "+mpi" in nc: + args.append(self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc)) + + return args