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 <valentin.volkl@cern.ch>
This commit is contained in:
parent
0c164d2740
commit
2aa5a16433
@ -61,12 +61,20 @@ class Edm4hep(CMakePackage):
|
|||||||
description="Use the specified C++ standard when building.",
|
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.3:", type="build")
|
||||||
depends_on("cmake@3.23:", type="build", when="@0.10.3:")
|
depends_on("cmake@3.23:", type="build", when="@0.10.3:")
|
||||||
depends_on("python", type="build")
|
depends_on("python", type="build")
|
||||||
|
|
||||||
depends_on("root@6.08:")
|
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@1:", when="@0.99:")
|
||||||
depends_on("podio@0.15:", when="@:0.10.5")
|
depends_on("podio@0.15:", when="@:0.10.5")
|
||||||
for _std in _cxxstd_values:
|
for _std in _cxxstd_values:
|
||||||
@ -88,6 +96,8 @@ def cmake_args(self):
|
|||||||
# C++ Standard
|
# C++ Standard
|
||||||
args.append(self.define("CMAKE_CXX_STANDARD", self.spec.variants["cxxstd"].value))
|
args.append(self.define("CMAKE_CXX_STANDARD", self.spec.variants["cxxstd"].value))
|
||||||
args.append(self.define("BUILD_TESTING", self.run_tests))
|
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
|
return args
|
||||||
|
|
||||||
def setup_run_environment(self, env):
|
def setup_run_environment(self, env):
|
||||||
|
Loading…
Reference in New Issue
Block a user