acts: further simplify cxxstd handling (#46333)

See https://github.com/spack/spack/pull/46314#discussion_r1752940332.

This further simplifies `cxxstd` variant handling in `acts` by removing superfluous
version constraints from dependencies for `geant4` and `root`.

The version constraints in the loop are redundant with the conditional variant
values here:

```python
    _cxxstd_values = (
        conditional("14", when="@:0.8.1"),
        conditional("17", when="@:35"),
        conditional("20", when="@24:"),
    )
    _cxxstd_common = {
        "values": _cxxstd_values,
        "multi": False,
        "description": "Use the specified C++ standard when building.",
    }
    variant("cxxstd", default="17", when="@:35", **_cxxstd_common)
    variant("cxxstd", default="20", when="@36:", **_cxxstd_common)
```

So we can simplify the dependencies in the loop to:

```python
    for _cxxstd in _cxxstd_values:
        for _v in _cxxstd:
            depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +geant4")
            depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +fatras_geant4")
            depends_on(f"root cxxstd={_v.value}", when=f"cxxstd={_v.value} +tgeo")
```

And avoid the potential for impossible variant expressions.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
Todd Gamblin 2024-09-11 22:14:50 -07:00 committed by GitHub
parent 527e0fb4b4
commit f417e9f00c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -401,14 +401,9 @@ class Acts(CMakePackage, CudaPackage):
# ACTS imposes requirements on the C++ standard values used by ROOT
for _cxxstd in _cxxstd_values:
for _v in _cxxstd:
if Spec(_v.when).satisfies("@0.23:"): # geant4 variant only exists at 0.23 or higher
depends_on(
f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +geant4"
)
depends_on(
f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +fatras_geant4"
)
depends_on(f"root cxxstd={_v.value}", when=f"cxxstd={_v.value} {_v.when} +tgeo")
depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +geant4")
depends_on(f"geant4 cxxstd={_v.value}", when=f"cxxstd={_v.value} +fatras_geant4")
depends_on(f"root cxxstd={_v.value}", when=f"cxxstd={_v.value} +tgeo")
# When the traccc plugin is enabled, detray should match the Acts scalars
with when("+traccc"):