Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-30 07:48:31

0001 # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
0002 # Spack Project Developers. See the top-level COPYRIGHT file for details.
0003 #
0004 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 
0006 from spack.package import *
0007 from spack_repo.builtin.build_systems.cmake import CMakePackage
0008 
0009 
0010 class G4e(CMakePackage):
0011     """Geant for EIC."""
0012 
0013     homepage = "https://g4e.readthedocs.io/en/latest/"
0014     url = "https://gitlab.com/eic/escalate/g4e/-/archive/v1.3.2/g4e-v1.3.2.tar.gz"
0015     git = "https://gitlab.com/eic/escalate/g4e.git"
0016     list_url = "https://gitlab.com/eic/escalate/g4e/-/tags"
0017 
0018     maintainer = ["DraTeots"]
0019 
0020     tags = ["eic"]
0021 
0022     version("master", branch="master")
0023     version(
0024         "1.4.2",
0025         sha256="252928a819541fdffc70e522f5cf9160ed219f7be02d9dcd507ae958e9d376b3",
0026     )
0027     version(
0028         "1.4.1",
0029         sha256="2986100c30b061c267306fb73e5709b28609ee00ec686b2c1de3398acbc9ccd6",
0030     )
0031     version(
0032         "1.3.8",
0033         sha256="451dee2ae8e1f0824d4f0ed7672aaad5e2b76dd3a5a95e38f2820eb51ec216c6",
0034     )
0035     version(
0036         "1.3.7",
0037         sha256="98f5387f8169ec922a162d6073544c231e3989fe7a8e5cc2e3582cbc8f312095",
0038     )
0039     version(
0040         "1.3.6",
0041         sha256="051ce2b1ff87df314a6395c22b33da19e1555caddd94d3863687101cdafad72b",
0042     )
0043     version(
0044         "1.3.5",
0045         sha256="e92d95df4b873bff3dff9fcff8a5535410a19004ae00c4a166f3adab8bd90279",
0046     )
0047     version(
0048         "1.3.4",
0049         sha256="9958a08a7cb8a8ce8b44d96e5e3c9b0bf45b2cb7bb9736f73a00cd907b73ffc8",
0050     )
0051     version(
0052         "1.3.2",
0053         sha256="bf0c035e6e213d71aafd5851e35210f2c70742b82b7d3222b2f2fdf05c09c8f8",
0054     )
0055     version(
0056         "1.3.1",
0057         sha256="98afe3c3efe3dbad5b13b6d33964c600155a8a6684786a81181a987c0a358f50",
0058     )
0059 
0060     # This compatibility variant allows to use g4e with older root and geant versions
0061     variant(
0062         "validated",
0063         default=False,
0064         description="Validated working version with fixed dependencies",
0065     )
0066 
0067     depends_on("cxx", type="build")
0068     depends_on("cmake@3.0.0:", type="build", when="~validated")
0069     depends_on("root@6.00.00:", when="~validated")
0070     depends_on("geant4@10.6:", when="~validated")
0071     depends_on("vgm@4-7:", when="~validated")
0072     depends_on("hepmc@2.06:", when="~validated")
0073     depends_on("python", when="~validated")
0074 
0075     # This uses the latest versions consistent over escalate
0076     depends_on("cmake@3.0.0:", type="build", when="+validated")
0077     depends_on(
0078         "root@6.20.04 +vmc +pythia6 +pythia8 +root7 cxxstd=17", when="+validated"
0079     )
0080     depends_on("geant4@10.6.2 +opengl +python +qt cxxstd=17", when="+validated")
0081     depends_on("vgm@4-8", when="+validated")
0082     depends_on("hepmc@2.06.10", when="+validated")
0083 
0084     def cmake_args(self):
0085         args = []
0086         # >oO debug: from ppretty import ppretty
0087         # >oO debug: print(ppretty(self, seq_length=20))
0088 
0089         args.append(
0090             "-DCMAKE_CXX_STANDARD={}".format(self.spec["root"].variants["cxxstd"].value)
0091         )
0092         args.append("-DGEANT4_DIR={0}".format(self.spec["geant4"].prefix))
0093         args.append("-DVGM_DIRECTORY={0}".format(self.spec["vgm"].prefix))
0094         args.append("-DHEPMC_DIRECTORY={0}".format(self.spec["hepmc"].prefix))
0095         args.append("-DCERN_ROOT_DIRECTORY={0}".format(self.spec["root"].prefix))
0096 
0097         return args
0098 
0099     def setup_run_environment(self, env):
0100         env.append_path("G4E_MACRO_PATH", self.prefix)
0101         env.prepend_path("PYTHONPATH", self.prefix.python)
0102         env.set("G4E_HOME", self.prefix)