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
This commit is contained in:
parent
b307d6e766
commit
79a462c084
@ -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 @@ def _add_variant(feature, variant):
|
||||
|
||||
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 @@ def cmake_args(self):
|
||||
|
||||
# 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"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user