Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:26

0001 """
0002 This file provides information of how to build and configure ACTS framework:
0003 https://gitlab.cern.ch/acts/acts-core
0004 """
0005 
0006 import os
0007 
0008 from edpm.engine.env_gen import Set, Append, Prepend
0009 from edpm.engine.git_cmake_recipe import GitCmakeRecipe
0010 
0011 
0012 class ActsRecipe(GitCmakeRecipe):
0013     """Provides data for building and installing Genfit framework
0014     source_path  = {app_path}/src/{version}          # Where the sources for the current version are located
0015     build_path   = {app_path}/build/{version}        # Where sources are built. Kind of temporary dir
0016     install_path = {app_path}/root-{version}         # Where the binary installation is
0017     """
0018 
0019     def __init__(self):
0020         """
0021         Installs Genfit track fitting framework
0022         """
0023 
0024         # Set initial values for parent class and self
0025         super(ActsRecipe, self).__init__('acts')                        # This name will be used in edpm commands
0026         self.config['branch'] = 'v31.2.0'                               # The branch or tag to be cloned (-b flag)
0027         self.config['repo_address'] = 'https://github.com/acts-project/acts'    # Repo address
0028         self.config['cmake_flags'] = '-DACTS_BUILD_PLUGIN_TGEO=ON -DACTS_BUILD_PLUGIN_DD4HEP=ON -DACTS_BUILD_PLUGIN_JSON=ON -DACTS_BUILD_PLUGIN_ACTSVG=OFF'
0029         self.config['cxx_standard'] = 17
0030 
0031     def setup(self, db):
0032         # ACTS require C++14 (at least). We  check that it is set
0033         if int(self.config['cxx_standard']) < 17:
0034             message = "ERROR. cxx_standard must be 17 or above to build ACTS.\n"\
0035                       "To set cxx_standard globally:\n"\
0036                       "   edpm config global cxx_standard=17\n"\
0037                       "To set cxx_standard for acts:\n"\
0038                       "   edpm config acts cxx_standard=17\n"\
0039                       "(!) Make sure cmake is regenerated after. (rm <top_dir>/acts and run edpm install acts again)\n"
0040             raise ValueError(message)
0041 
0042         print(self.config['branch'])
0043         # Call GitCmakeRecipe `default` setup function
0044         super(ActsRecipe, self).setup(db)
0045 
0046     @staticmethod
0047     def gen_env(data):
0048         """Generates environments to be set"""
0049         path = data['install_path']
0050 
0051         yield Set('ACTS_DIR', path)
0052 
0053         # it could be lib or lib64. There are bugs on different platforms (RHEL&centos and WSL included)
0054         # https://stackoverflow.com/questions/46847939/config-site-for-vendor-libs-on-centos-x86-64
0055         # https: // bugzilla.redhat.com / show_bug.cgi?id = 1510073
0056 
0057         import platform
0058         if platform.system() == 'Darwin':
0059             yield Append('DYLD_LIBRARY_PATH', os.path.join(path, 'lib'))
0060 
0061         yield Append('LD_LIBRARY_PATH', os.path.join(path, 'lib'))
0062 
0063         # share/cmake/Acts
0064         yield Append('CMAKE_PREFIX_PATH', os.path.join(path, 'lib', 'cmake', 'Acts'))
0065         yield Append('CMAKE_PREFIX_PATH', os.path.join(path, 'lib', 'cmake', 'nlohmann_json'))
0066         yield Append('CMAKE_PREFIX_PATH', os.path.join(path, 'lib', 'cmake', 'ActsDD4hep'))
0067 
0068 
0069     #
0070     # OS dependencies are a map of software packets installed by os maintainers
0071     # The map should be in form:
0072     # os_dependencies = { 'required': {'ubuntu': "space separated packet names", 'centos': "..."},
0073     #                     'optional': {'ubuntu': "space separated packet names", 'centos': "..."}
0074     # The idea behind is to generate easy to use instructions: 'sudo apt-get install ... ... ... '
0075     os_dependencies = {
0076         'required': {
0077             'ubuntu18': "libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-test-dev nlohmann-json3-dev",
0078             'ubuntu22': "libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-test-dev nlohmann-json3-dev",
0079             'centos7': "boost-devel",
0080             'centos8': "boost-devel",
0081         },
0082     }