dd4hep: fix inconsistent cxxstd (#50027)
* dd4hep: fix doc dependencies and made doc optional * edm4hep: fix downstream build error in dd4hep * dd4hep: propagate cxxstd to fix build error with +ddg4
This commit is contained in:
parent
24efb56528
commit
b4646c340c
@ -71,6 +71,7 @@ class Dd4hep(CMakePackage):
|
||||
variant("utilityapps", default=True, description="Build UtilityApps subpackage.")
|
||||
|
||||
# variants for other build options
|
||||
variant("doc", default=False, description="Build documentation")
|
||||
variant("xercesc", default=False, description="Enable 'Detector Builders' based on XercesC")
|
||||
variant("hepmc3", default=False, description="Enable build with hepmc3")
|
||||
variant(
|
||||
@ -90,16 +91,30 @@ class Dd4hep(CMakePackage):
|
||||
" some places in addtion to the debug build type",
|
||||
)
|
||||
|
||||
_cxxstd_values = ("14", "17", "20")
|
||||
variant(
|
||||
"cxxstd",
|
||||
default="20",
|
||||
values=_cxxstd_values,
|
||||
multi=False,
|
||||
description="Use the specified C++ standard when building.",
|
||||
)
|
||||
|
||||
depends_on("c", type="build")
|
||||
depends_on("cxx", type="build")
|
||||
|
||||
depends_on("cmake @3.12:", type="build")
|
||||
depends_on("cmake @3.14:", type="build", when="@1.26:")
|
||||
|
||||
for _std in _cxxstd_values:
|
||||
for _pkg in ["boost", "root"]:
|
||||
depends_on(f"{_pkg} cxxstd={_std}", when=f"cxxstd={_std}")
|
||||
|
||||
depends_on("boost @1.49:")
|
||||
depends_on("boost +iostreams", when="+ddg4")
|
||||
depends_on("boost +system +filesystem", when="%gcc@:7")
|
||||
depends_on("root @6.08: +gdml +math +python")
|
||||
depends_on("root @6.12.2: +root7", when="@1.26:") # DDCoreGraphics needs ROOT::ROOTHistDraw
|
||||
|
||||
with when("+ddeve"):
|
||||
depends_on("root @6.08: +geom +opengl +x")
|
||||
depends_on("root @:6.27", when="@:1.23")
|
||||
@ -108,9 +123,14 @@ class Dd4hep(CMakePackage):
|
||||
requires("^root +root7 +webgui", when="@1.24: ^root @6.27:")
|
||||
depends_on("root @6.08: +gdml +geom +math +python +x +opengl", when="+utilityapps")
|
||||
|
||||
extends("python")
|
||||
with when("+ddg4"):
|
||||
depends_on("boost +iostreams")
|
||||
depends_on("geant4@10.2.2:")
|
||||
for _std in _cxxstd_values:
|
||||
depends_on(f"geant4 cxxstd={_std}", when=f"cxxstd={_std}")
|
||||
|
||||
depends_on("imagemagick", when="+doc")
|
||||
depends_on("xerces-c", when="+xercesc")
|
||||
depends_on("geant4@10.2.2:", when="+ddg4")
|
||||
depends_on("assimp@5.0.2:", when="+ddcad")
|
||||
depends_on("hepmc3", when="+hepmc3")
|
||||
depends_on("hepmc3@3.2.6:", when="+hepmc3-gz")
|
||||
@ -122,15 +142,21 @@ class Dd4hep(CMakePackage):
|
||||
depends_on("lcio", when="+lcio")
|
||||
depends_on("py-pytest", type=("build", "test"))
|
||||
with when("+edm4hep"):
|
||||
depends_on("edm4hep")
|
||||
# Packages with cxxstd: note they only support 17 and onward
|
||||
for _std in ["17", "20"]:
|
||||
for _pkg in ["edm4hep", "podio"]:
|
||||
depends_on(f"{_pkg} cxxstd={_std}", when=f"cxxstd={_std}")
|
||||
|
||||
# Specific version requirements
|
||||
depends_on("edm4hep@0.10.5:", when="@1.31:")
|
||||
depends_on("podio")
|
||||
depends_on("podio@:0.16.03", when="@:1.23")
|
||||
depends_on("podio@:0", when="@:1.29")
|
||||
depends_on("podio@0.16:", when="@1.24:")
|
||||
depends_on("podio@0.16.3:", when="@1.26:")
|
||||
depends_on("podio@0.16.7:", when="@1.31:")
|
||||
|
||||
extends("python")
|
||||
|
||||
# See https://github.com/AIDASoft/DD4hep/pull/771 and https://github.com/AIDASoft/DD4hep/pull/876
|
||||
conflicts(
|
||||
"^cmake@3.16:3.17.2",
|
||||
@ -139,12 +165,6 @@ class Dd4hep(CMakePackage):
|
||||
)
|
||||
conflicts("~ddrec+dddetectors", msg="Need to enable +ddrec to build +dddetectors.")
|
||||
|
||||
# Geant4 needs to be (at least) the same version as DD4hep, but we don't
|
||||
# have a very good handle on that at this stage, because we make that
|
||||
# dependent on roots cxxstd. However, cxxstd=11 will never work
|
||||
# See https://github.com/AIDASoft/DD4hep/pull/1191
|
||||
conflicts("^geant4 cxxstd=11", when="+ddg4")
|
||||
|
||||
# See https://github.com/AIDASoft/DD4hep/issues/1210
|
||||
conflicts("^root@6.31.1:", when="@:1.27")
|
||||
|
||||
@ -157,11 +177,8 @@ def libs(self):
|
||||
|
||||
def cmake_args(self):
|
||||
spec = self.spec
|
||||
cxxstd = spec["root"].variants["cxxstd"].value
|
||||
# root can be built with cxxstd=11, but dd4hep requires 14
|
||||
if cxxstd == "11":
|
||||
cxxstd = "14"
|
||||
args = [
|
||||
self.define_from_variant("BUILD_DOCS", "doc"),
|
||||
self.define_from_variant("DD4HEP_USE_EDM4HEP", "edm4hep"),
|
||||
self.define_from_variant("DD4HEP_USE_XERCESC", "xercesc"),
|
||||
self.define_from_variant("DD4HEP_USE_TBB", "tbb"),
|
||||
@ -170,6 +187,7 @@ def cmake_args(self):
|
||||
self.define_from_variant("DD4HEP_USE_HEPMC3", "hepmc3"),
|
||||
self.define_from_variant("DD4HEP_USE_GEANT4_UNITS", "geant4units"),
|
||||
self.define_from_variant("DD4HEP_BUILD_DEBUG", "debug"),
|
||||
self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"),
|
||||
# DD4hep@1.26: with hepmc3@3.2.6: allows compressed hepmc3 files
|
||||
self.define(
|
||||
"DD4HEP_HEPMC3_COMPRESSION_SUPPORT", self.spec.satisfies("@1.26: ^hepmc3@3.2.6:")
|
||||
@ -178,7 +196,6 @@ def cmake_args(self):
|
||||
# However, with spack it is preferrable to have a proper external
|
||||
# dependency, so we disable it.
|
||||
self.define("DD4HEP_LOAD_ASSIMP", False),
|
||||
self.define("CMAKE_CXX_STANDARD", cxxstd),
|
||||
self.define("BUILD_TESTING", self.run_tests),
|
||||
self.define("BOOST_ROOT", spec["boost"].prefix),
|
||||
self.define("Boost_NO_BOOST_CMAKE", True),
|
||||
|
@ -93,6 +93,14 @@ class Edm4hep(CMakePackage):
|
||||
|
||||
conflicts("%clang@:16", when="@0.99.1:", msg="Incomplete consteval support in clang")
|
||||
|
||||
# Fix missing nljson import
|
||||
# NOTE that downstream packages (dd4hep) may fail for 0.99 and before
|
||||
patch(
|
||||
"https://patch-diff.githubusercontent.com/raw/key4hep/EDM4hep/pull/379.patch?full_index=1",
|
||||
when="@0.99.1",
|
||||
sha256="c4be2f27c7bda4d033f92fee14e48ddf59fbe606d208e8288d9bdb3dec5ad5c2",
|
||||
)
|
||||
|
||||
def cmake_args(self):
|
||||
args = [
|
||||
self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"),
|
||||
|
Loading…
Reference in New Issue
Block a user