summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth R. Johnson <johnsonsr@ornl.gov>2022-08-23 06:57:00 -0400
committerGitHub <noreply@github.com>2022-08-23 12:57:00 +0200
commit79a462c084734aaeac157b9cf2855b8b596928f4 (patch)
tree85d0ed991fb6263e02b94b5f49c31dba04df6369
parentb307d6e7664b1cbdeae4971d3015ae6e7875eb3f (diff)
downloadspack-79a462c084734aaeac157b9cf2855b8b596928f4.tar.gz
spack-79a462c084734aaeac157b9cf2855b8b596928f4.tar.bz2
spack-79a462c084734aaeac157b9cf2855b8b596928f4.tar.xz
spack-79a462c084734aaeac157b9cf2855b8b596928f4.zip
Geant4: update cmake defines and add support for nvhpc (#32185)
* geant4: use define function * geant4: Change new feature from conflicts to when * geant4: add support/conflicts for nvhpc * fixup! geant4: add support/conflicts for nvhpc
-rw-r--r--var/spack/repos/builtin/packages/geant4/package.py44
1 files changed, 27 insertions, 17 deletions
diff --git a/var/spack/repos/builtin/packages/geant4/package.py b/var/spack/repos/builtin/packages/geant4/package.py
index 7eed444e05..917a67cf1c 100644
--- a/var/spack/repos/builtin/packages/geant4/package.py
+++ b/var/spack/repos/builtin/packages/geant4/package.py
@@ -58,7 +58,7 @@ class Geant4(CMakePackage):
variant("x11", default=False, description="Optional X11 support")
variant("motif", default=False, description="Optional motif support")
variant("qt", default=False, description="Enable Qt support")
- variant("python", default=False, description="Enable Python bindings")
+ variant("python", default=False, when="@10.6.2:", description="Enable Python bindings")
variant("tbb", default=False, description="Use TBB as a tasking backend", when="@11:")
variant("vtk", default=False, description="Enable VTK support", when="@11:")
@@ -92,9 +92,6 @@ class Geant4(CMakePackage):
# Python, with boost requirement dealt with in cxxstd section
depends_on("python@3:", when="+python")
extends("python", when="+python")
- conflicts(
- "+python", when="@:10.6.1", msg="Geant4 <= 10.6.1 cannot be built with Python bindings"
- )
for std in _cxxstd_values:
# CLHEP version requirements to be reviewed
@@ -135,6 +132,9 @@ class Geant4(CMakePackage):
patch("cxx17_geant4_10_0.patch", level=1, when="@10.4.0 cxxstd=17")
patch("geant4-10.4.3-cxx17-removed-features.patch", level=1, when="@10.4.3 cxxstd=17")
+ # NVHPC: "thread-local declaration follows non-thread-local declaration"
+ conflicts("%nvhpc", when="+threads")
+
@classmethod
def determine_version(cls, exe):
output = Executable(exe)("--version", output=str, error=str)
@@ -182,17 +182,27 @@ class Geant4(CMakePackage):
return " ".join(variants)
+ def flag_handler(self, name, flags):
+ spec = self.spec
+ if name == "cxxflags":
+ if spec.satisfies("%nvhpc"):
+ # error: excessive recursion at instantiation of class
+ # "G4Number<191>" (G4CTCounter.hh)
+ flags.append("-Wc,--pending_instantiations=256")
+ return (None, flags, None)
+ return (flags, None, None)
+
def cmake_args(self):
spec = self.spec
# Core options
options = [
- "-DGEANT4_USE_SYSTEM_CLHEP=ON",
- "-DGEANT4_USE_SYSTEM_EXPAT=ON",
- "-DGEANT4_USE_SYSTEM_ZLIB=ON",
- "-DGEANT4_USE_G3TOG4=ON",
- "-DGEANT4_USE_GDML=ON",
- "-DXERCESC_ROOT_DIR={0}".format(spec["xerces-c"].prefix),
+ self.define("GEANT4_USE_SYSTEM_CLHEP", True),
+ self.define("GEANT4_USE_SYSTEM_EXPAT", True),
+ self.define("GEANT4_USE_SYSTEM_ZLIB", True),
+ self.define("GEANT4_USE_G3TOG4", True),
+ self.define("GEANT4_USE_GDML", True),
+ self.define("XERCESC_ROOT_DIR", spec["xerces-c"].prefix),
]
# Use the correct C++ standard option for the requested version
@@ -223,21 +233,21 @@ class Geant4(CMakePackage):
# Vecgeom
if "+vecgeom" in spec:
- options.append("-DGEANT4_USE_USOLIDS=ON")
- options.append("-DUSolids_DIR=%s" % spec["vecgeom"].prefix.lib.CMake.USolids)
+ options.append(self.define("GEANT4_USE_USOLIDS", True))
+ options.append(self.define("USolids_DIR", spec["vecgeom"].prefix.lib.CMake.USolids))
# Visualization options
if "platform=darwin" not in spec:
if "+x11" in spec and "+opengl" in spec:
- options.append("-DGEANT4_USE_OPENGL_X11=ON")
+ options.append(self.define("GEANT4_USE_OPENGL_X11", True))
if "+motif" in spec and "+opengl" in spec:
- options.append("-DGEANT4_USE_XM=ON")
+ options.append(self.define("GEANT4_USE_XM", True))
if "+x11" in spec:
- options.append("-DGEANT4_USE_RAYTRACER_X11=ON")
+ options.append(self.define("GEANT4_USE_RAYTRACER_X11", True))
if "+qt" in spec:
- options.append("-DGEANT4_USE_QT=ON")
- options.append("-DQT_QMAKE_EXECUTABLE=%s" % spec["qt"].prefix.bin.qmake)
+ options.append(self.define("GEANT4_USE_QT", True))
+ options.append(self.define("QT_QMAKE_EXECUTABLE", spec["qt"].prefix.bin.qmake))
options.append(self.define_from_variant("GEANT4_USE_VTK", "vtk"))