From 94e9e18558216e81399d32ac77de35992191b0c2 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:51:57 -0700 Subject: [PATCH] Update sp package (#38208) --- .../repos/builtin/packages/sp/package.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/sp/package.py b/var/spack/repos/builtin/packages/sp/package.py index 3751a731d93880..2d3622f4e2866c 100644 --- a/var/spack/repos/builtin/packages/sp/package.py +++ b/var/spack/repos/builtin/packages/sp/package.py @@ -16,10 +16,28 @@ class Sp(CMakePackage): maintainers("t-brown", "AlexanderRichert-NOAA", "edwardhartnett", "Hang-Lei-NOAA") + version("2.4.0", sha256="dbb4280e622d2683b68a28f8e3837744adf9bbbb1e7940856e8f4597f481c708") version("2.3.3", sha256="c0d465209e599de3c0193e65671e290e9f422f659f1da928505489a3edeab99f") + variant("shared", default=False, description="Build shared library", when="@2.4:") + variant("pic", default=False, description="Enable position-independent code (PIC)") + def setup_run_environment(self, env): - for suffix in ("4", "8", "d"): - lib = find_libraries("libsp_" + suffix, root=self.prefix, shared=False, recursive=True) + suffixes = ["4", "d"] + if self.spec.satisfies("@:2.3"): + suffixes += ["8"] + for suffix in suffixes: + lib = find_libraries( + "libsp_" + suffix, + root=self.prefix, + shared=self.spec.satisfies("+shared"), + recursive=True, + ) env.set("SP_LIB" + suffix, lib[0]) env.set("SP_INC" + suffix, "include_" + suffix) + + def cmake_args(self): + args = [] + args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + args.append(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")) + return args