Commits (8)
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# File implementing the code that gets called when a project imports
# LCG using something like:
......@@ -341,7 +341,7 @@ if( NOT LCG_VERSION EQUAL 0 )
${BLAS_LCGROOT} ${LAPACK_LCGROOT} ${LIBXSLT_LCGROOT}
${FREETYPE_LCGROOT} ${CURL_LCGROOT} ${TIFF_LCGROOT} ${PYTHON_LCGROOT}
${XERCESC_LCGROOT} ${FMT_LCGROOT} ${JSONMCPP_LCGROOT} ${EIGEN_LCGROOT}
${SQLITE_LCGROOT} ${CUDA_LCGROOT} )
${SQLITE_LCGROOT} ${CUDA_LCGROOT} ${PROTOBUF_LCGROOT} )
string( REPLACE ";" ":" _path "${_cmakePaths}" )
set( ENV{CMAKE_PREFIX_PATH} "$ENV{CMAKE_PREFIX_PATH}:${_path}" )
unset( _path )
......
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Wrapper around CMake's built-in FindProtobuf.cmake module. Making sure that
# the found include path and library directory are set up in a relocatable
# way.
#
# In addition to what CMake's module does, it also sets up Protobuf's Python
# bindings for the runtime environment, if those bindings exist.
#
# Sets:
# PROTOBUF_BINARY_PATH
# PROTOBUF_PYTHON_PATH
# All the things provided by CMake's FindProtobuf.cmake module.
#
# Can be steered by PROTOBUF_LCGROOT.
#
# The LCG include(s).
include( LCGFunctions )
# CMake's module tries to execute the protoc executable as part of finding the
# package. To make this possible with an LCG release that has not been set up
# in the runtime environment yet, let's add the path explicitly to CMake's
# environment...
if( IS_DIRECTORY "${PROTOBUF_LCGROOT}/lib" )
if( NOT "$ENV{LD_LIBRARY_PATH}" MATCHES "${PROTOBUF_LCGROOT}/lib" )
set( ENV{LD_LIBRARY_PATH}
"${PROTOBUF_LCGROOT}/lib:$ENV{LD_LIBRARY_PATH}" )
endif()
if( NOT "$ENV{DYLD_LIBRARY_PATH}" MATCHES "${PROTOBUF_LCGROOT}/lib" )
set( ENV{DYLD_LIBRARY_PATH}
"${PROTOBUF_LCGROOT}/lib:$ENV{DYLD_LIBRARY_PATH}" )
endif()
endif()
# Use the helper macro for the wrapping CMake's FindProtobuf.cmake module.
lcg_wrap_find_module( Protobuf NO_LIBRARY_DIRS )
# Find the Python binding and the executable's path, if they are available. Note
# however that not finding the binding/executable does not cause the module to
# report not finding Protobuf.
lcg_python_external_module( NAME Protobuf
PYTHON_NAMES google/protobuf/__init__.py google/protobuf.py
BINARY_NAMES protoc
BINARY_SUFFIXES bin )
# Set up the RPM dependency.
lcg_need_rpm( protobuf )
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Sets:
# BOTO3_PYTHON_PATH
#
# Can be steered by BOTO3_LCGROOT.
#
# The LCG include(s).
include( LCGFunctions )
# Find it.
lcg_python_external_module( NAME boto3
PYTHON_NAMES boto3/__init__.py boto3.py )
# Handle the standard find_package arguments.
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( boto3 DEFAULT_MSG
_BOTO3_PYTHON_PATH )
# Set up the RPM dependency.
lcg_need_rpm( boto3 )
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Sets:
# BOTOCORE_PYTHON_PATH
#
# Can be steered by BOTOCORE_LCGROOT.
#
# The LCG include(s).
include( LCGFunctions )
# Find it.
lcg_python_external_module( NAME botocore
PYTHON_NAMES botocore/__init__.py botocore.py )
# Handle the standard find_package arguments.
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( botocore DEFAULT_MSG
_BOTOCORE_PYTHON_PATH )
# Set up the RPM dependency.
lcg_need_rpm( botocore )
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Sets:
# JMESPATH_PYTHON_PATH
#
# Can be steered by JMESPATH_LCGROOT.
#
# The LCG include(s).
include( LCGFunctions )
# Find it.
lcg_python_external_module( NAME jmespath
PYTHON_NAMES jmespath/__init__.py jmespath.py
BINARY_NAMES jp.py
BINARY_SUFFIXES bin )
# Handle the standard find_package arguments.
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( jmespath DEFAULT_MSG
_JMESPATH_PYTHON_PATH )
# Set up the RPM dependency.
lcg_need_rpm( jmespath )
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Sets:
# S3TRANSFER_PYTHON_PATH
#
# Can be steered by S3TRANSFER_LCGROOT.
#
# The LCG include(s).
include( LCGFunctions )
# Find it.
lcg_python_external_module( NAME s3transfer
PYTHON_NAMES s3transfer/__init__.py s3transfer.py )
# Handle the standard find_package arguments.
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( s3transfer DEFAULT_MSG
_S3TRANSFER_PYTHON_PATH )
# Set up the RPM dependency.
lcg_need_rpm( s3transfer )
......@@ -306,17 +306,19 @@ function( lcg_python_external_module )
mark_as_advanced( _${nameUpper}_PYTHON_PATH )
# Make the found path relocatable.
set( _relocatableDir ${_${nameUpper}_PYTHON_PATH} )
_lcg_make_paths_relocatable( _relocatableDir )
if( GAUDI_ATLAS )
set( ${nameUpper}_PYTHON_PATH ${_${nameUpper}_PYTHON_PATH}
PARENT_SCOPE )
else()
set( ${nameUpper}_PYTHON_PATH
$<BUILD_INTERFACE:${_${nameUpper}_PYTHON_PATH}>
$<INSTALL_INTERFACE:${_relocatableDir}> PARENT_SCOPE )
if( _${nameUpper}_PYTHON_PATH )
set( _relocatableDir ${_${nameUpper}_PYTHON_PATH} )
_lcg_make_paths_relocatable( _relocatableDir )
if( GAUDI_ATLAS )
set( ${nameUpper}_PYTHON_PATH ${_${nameUpper}_PYTHON_PATH}
PARENT_SCOPE )
else()
set( ${nameUpper}_PYTHON_PATH
$<BUILD_INTERFACE:${_${nameUpper}_PYTHON_PATH}>
$<INSTALL_INTERFACE:${_relocatableDir}> PARENT_SCOPE )
endif()
unset( _relocatableDir )
endif()
unset( _relocatableDir )
# Look for an optional binary directory, and the executables therein.
if( ARG_BINARY_NAMES )
......@@ -333,17 +335,19 @@ function( lcg_python_external_module )
PATHS ${ARG_SEARCH_PATHS} ${${nameUpper}_LCGROOT}
${ARG_EXTRA_OPTIONS} )
mark_as_advanced( _${nameUpper}_BINARY_PATH )
set( _relocatableDir ${_${nameUpper}_BINARY_PATH} )
_lcg_make_paths_relocatable( _relocatableDir )
if( GAUDI_ATLAS )
set( ${nameUpper}_BINARY_PATH ${_${nameUpper}_BINARY_PATH}
PARENT_SCOPE )
else()
set( ${nameUpper}_BINARY_PATH
$<BUILD_INTERFACE:${_${nameUpper}_BINARY_PATH}>
$<INSTALL_INTERFACE:${_relocatableDir}> PARENT_SCOPE )
if( _${nameUpper}_BINARY_PATH )
set( _relocatableDir ${_${nameUpper}_BINARY_PATH} )
_lcg_make_paths_relocatable( _relocatableDir )
if( GAUDI_ATLAS )
set( ${nameUpper}_BINARY_PATH ${_${nameUpper}_BINARY_PATH}
PARENT_SCOPE )
else()
set( ${nameUpper}_BINARY_PATH
$<BUILD_INTERFACE:${_${nameUpper}_BINARY_PATH}>
$<INSTALL_INTERFACE:${_relocatableDir}> PARENT_SCOPE )
endif()
unset( _relocatableDir )
endif()
unset( _relocatableDir )
endif()
endfunction( lcg_python_external_module )
......
......@@ -54,6 +54,8 @@ set( ENV{G4INSTALL} "${CMAKE_CURRENT_BINARY_DIR}/build" )
# Extra options for the configuration:
set( _extraOptions )
set( _cmakePrefixes )
if( "${CMAKE_CXX_STANDARD}" EQUAL 11 )
list( APPEND _extraOptions -DGEANT4_BUILD_CXXSTD:STRING=c++11 )
elseif( "${CMAKE_CXX_STANDARD}" EQUAL 14 )
......@@ -65,6 +67,19 @@ if( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "" )
list( APPEND _extraOptions -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} )
endif()
# Expat from LCG
list( APPEND _cmakePrefixes "${EXPAT_LCGROOT}" )
# VecGeom from AtlasExternals
list( APPEND _cmakePrefixes "${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}")
# Handle all the externals that need to be set up through CMAKE_PREFIX_PATH.
if( _cmakePrefixes )
list( REMOVE_DUPLICATES _cmakePrefixes )
list( APPEND _extraOptions
-DCMAKE_PREFIX_PATH:PATH=${_cmakePrefixes} )
endif()
# Temporary directory for the build results:
set( _buildDir
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Geant4Build" )
......@@ -99,8 +114,8 @@ ExternalProject_Add( Geant4
-DGEANT4_BUILD_TLS_MODEL:STRING=global-dynamic
-DCMAKE_INSTALL_PREFIX:PATH=${_buildDir}
-DCMAKE_INSTALL_LIBDIR:STRING=lib
-DCMAKE_PREFIX_PATH:STRING=${EXPAT_LCGROOT}
-DGEANT4_INSTALL_DATA:BOOL=OFF
-DGEANT4_USE_USOLIDS:STRING=CONS;POLYCONE
${_extraOptions}
LOG_CONFIGURE 1 )
ExternalProject_Add_Step( Geant4 cleansource
......@@ -132,6 +147,7 @@ ExternalProject_Add_Step( Geant4 buildinstall
DEPENDEES install )
add_dependencies( Package_Geant4 Geant4 )
add_dependencies( Geant4 CLHEP )
add_dependencies( Geant4 VecGeom )
# Install Geant4:
install( DIRECTORY "${_buildDir}/"
......
......@@ -6,10 +6,12 @@
# Sanitize geant4-config
# 1. clhep-config (test: ASSUME that PATH will contain the right one)
# 2. vecgeom (we know that the headers will be under the install root)
sed -e 's#^\(have_clhep=.*\)$#\1\
clhep_config_exe="\${@CMAKE_PROJECT_NAME@_DIR}/bin/clhep-config"#' \
-e '/if test.*have_clhep.*xno.*/{' -e 'n;s#-I/.*#`\${clhep_config_exe} --cflags`"#' -e '}' \
-e 's#-L/.* -lCLHEP.*$#`\${clhep_config_exe} --libs`"#' \
-e 's#@CMAKE_BINARY_DIR@/@ATLAS_PLATFORM@#\${@CMAKE_PROJECT_NAME@_DIR}#g' \
@_buildDir@/bin/geant4-config > \
@CMAKE_CURRENT_BINARY_DIR@@CMAKE_FILES_DIRECTORY@/geant4-config
......
......@@ -13,3 +13,4 @@
flake8==3.9.2
pyami==5.1.1
histgrinder==0.1.3
lark==1.0.0
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#
# Package building VecGeom for the offline builds.
#
# The name of the package:
atlas_subdir( VecGeom )
# Git repository for VecGeom:
set( ATLAS_VECGEOM_REPOSITORY "https://gitlab.cern.ch/VecGeom/VecGeom.git"
CACHE STRING "Git repository for VecGeom" )
# Git tag to build (Matched to required version for Geant4 10.6):
set( ATLAS_VECGEOM_TAG "v1.1.5"
CACHE STRING "Git tag for VecGeom" )
mark_as_advanced( ATLAS_VECGEOM_REPOSITORY ATLAS_VECGEOM_TAG )
# Extra options for the configuration:
set( _extraOptions )
if( "${CMAKE_CXX_STANDARD}" GREATER_EQUAL "11" )
list( APPEND _extraOptions -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} )
endif()
if( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "" )
list( APPEND _extraOptions -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} )
endif()
# Temporary directory for the build results:
set( _buildDir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/VecGeomBuild )
# Directory holding the "stamp" files.
set( _stampDir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/VecGeomStamp )
# Create the script that will sanitize the geant4-config script after the build:
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sanitizeConfig.sh.in
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/sanitizeConfig.sh @ONLY )
# Build VecGeom for the build area:
ExternalProject_Add( VecGeom
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}
STAMP_DIR ${_stampDir}
GIT_REPOSITORY "${ATLAS_VECGEOM_REPOSITORY}"
GIT_TAG "${ATLAS_VECGEOM_TAG}"
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${_buildDir}
-DVECGEOM_VECTOR:STRING=sse2
-DVECGEOM_BACKEND:STRING=Scalar
CMAKE_GENERATOR "Unix Makefiles"
CMAKE_ARGS
${_extraOptions}
LOG_CONFIGURE 1 )
ExternalProject_Add_Step( VecGeom cleansource
COMMAND ${CMAKE_COMMAND} -E remove -f
"${_stampDir}/VecGeom-gitclone-lastrun.txt"
DEPENDERS download )
# Need to modify the printout here when the VecGeom version is updated
ExternalProject_Add_Step( VecGeom forcedownload
COMMAND ${CMAKE_COMMAND} -E echo "Forcing the re-download of VecGeom.."
DEPENDERS cleansource )
ExternalProject_Add_Step( VecGeom purgebuild
COMMAND ${CMAKE_COMMAND} -E remove_directory "<BINARY_DIR>"
COMMAND ${CMAKE_COMMAND} -E make_directory "<BINARY_DIR>"
COMMAND ${CMAKE_COMMAND} -E remove_directory "${_buildDir}"
COMMENT "Removing previous build results for VecGeom"
DEPENDEES download
DEPENDERS patch )
ExternalProject_Add_Step( VecGeom forceconfigure
COMMAND ${CMAKE_COMMAND} -E remove -f <BINARY_DIR>/CMakeCache.txt
COMMENT "Forcing the configuration of VecGeom"
DEPENDEES update
DEPENDERS configure
ALWAYS 1 )
ExternalProject_Add_Step( VecGeom buildinstall
COMMAND ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/sanitizeConfig.sh
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_buildDir}/ <INSTALL_DIR>
COMMENT "Installing VecGeom into the build area"
DEPENDEES install )
add_dependencies( Package_VecGeom VecGeom )
# Install Geant4:
install( DIRECTORY ${_buildDir}/
DESTINATION . USE_SOURCE_PERMISSIONS OPTIONAL )
VecGeom
=======
This package builds VecGeom for use by ATLAS's Geant4 build.
The sources are picked up from VecGeom's GitLab development site, and
are currently built with default flags. This means it also builds and
installs its own version of the VecCore library.
#!/bin/bash
#
# Script used to sanitize VecGeom's "VecGeomConfig.cmake" file
# so that it is relocatable.
#
# Sanitize VecGeomConfig.cmake
# 1. Remove hard coded paths in VecGeom
# NB: If we later use LCG packages (VecCore/Vc), can treat in same way
# as Xerces-C in Geant4
sed -i -e 's#\"@_buildDir@\"#\"\${@CMAKE_PROJECT_NAME@_DIR}\"#' \
-e 's#\(^set(VECGEOM_EXTERNAL_INCLUDES \).*$#\1"\${VECGEOM_INCLUDE_DIR}\")#' \
@_buildDir@/lib/cmake/VecGeom/VecGeomConfig.cmake
......@@ -9,6 +9,7 @@
+ External/GPerfTools
+ External/Gdb
+ External/Geant4
+ External/VecGeom
+ External/GeoModel
+ External/GoogleTest
+ External/MKL
......
......@@ -13,6 +13,7 @@
+ External/GPerfTools
+ External/Gdb
+ External/Geant4
+ External/VecGeom
+ External/GeoModel
+ External/GoogleTest
+ External/lwtnn
......