From 2aa5a1643321d57326540e548d98b790d375b47d Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Wed, 6 Nov 2024 11:42:34 +0100 Subject: edm4hep: Add json variant for newer versions (#47180) * edm4hep: Add json variant for newer versions Explicit option has been added to EDM4hep so we now expose it via a variant as well. We keep the old behavior where we unconditionally depended on nlohmann-json and implicitly built JSON support if we could detect it cmake stage * Fix condition statement in when clause * Use open version range to avoid fixing to single version --------- Co-authored-by: Valentin Volkl --- var/spack/repos/builtin/packages/edm4hep/package.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/edm4hep/package.py b/var/spack/repos/builtin/packages/edm4hep/package.py index 838c11b101..97c32283b0 100644 --- a/var/spack/repos/builtin/packages/edm4hep/package.py +++ b/var/spack/repos/builtin/packages/edm4hep/package.py @@ -61,12 +61,20 @@ class Edm4hep(CMakePackage): description="Use the specified C++ standard when building.", ) + variant( + "json", + default=True, + description="Build edm4hep with JSON support and edm4hep2json", + when="@0.99.2:", + ) + depends_on("cmake@3.3:", type="build") depends_on("cmake@3.23:", type="build", when="@0.10.3:") depends_on("python", type="build") depends_on("root@6.08:") - depends_on("nlohmann-json@3.10.5:") + depends_on("nlohmann-json@3.10.5:", when="@0.99.2: +json") + depends_on("nlohmann-json@3.10.5:", when="@:0.99.1") depends_on("podio@1:", when="@0.99:") depends_on("podio@0.15:", when="@:0.10.5") for _std in _cxxstd_values: @@ -88,6 +96,8 @@ class Edm4hep(CMakePackage): # C++ Standard args.append(self.define("CMAKE_CXX_STANDARD", self.spec.variants["cxxstd"].value)) args.append(self.define("BUILD_TESTING", self.run_tests)) + if self.spec.satisfies("@0.99.2: +json"): + args.append(self.define_from_variant("EDM4HEP_WITH_JSON", "json")) return args def setup_run_environment(self, env): -- cgit v1.2.3-70-g09d2