Commit 63fd9bba authored by Ewelina Maria Lobodzinska's avatar Ewelina Maria Lobodzinska
Browse files

add AthGeneration project to be used for AthGeneration release


Former-commit-id: 9b208b5ff715139cb2ecfe4718452cd57a54f485
parent d5bbe193
# The minimum required CMake version:
cmake_minimum_required( VERSION 3.2 FATAL_ERROR )
# Read in the project's version from a file called version.txt. But let it be
# overridden from the command line if necessary.
file( READ ${CMAKE_SOURCE_DIR}/version.txt _version )
string( STRIP ${_version} _version )
set( ATHGENERATION_PROJECT_VERSION ${_version}
CACHE STRING "Version of the AthGeneration project to build" )
unset( _version )
# Set the versions of the TDAQ externals to pick up for the build:
set( TDAQ-COMMON_VERSION "02-03-00" )
set( TDAQ-COMMON_ROOT
"$ENV{TDAQ_RELEASE_BASE}/tdaq-common/tdaq-common-${TDAQ-COMMON_VERSION}" )
set( DQM-COMMON_VERSION "01-03-00" )
set( DQM-COMMON_ROOT
"$ENV{TDAQ_RELEASE_BASE}/dqm-common/dqm-common-${DQM-COMMON_VERSION}" )
set( TDAQ_PROJECT_NAME "tdaq")
set( TDAQ_VERSION "07-01-00" )
set( TDAQ_ROOT "$ENV{TDAQ_RELEASE_BASE}/${TDAQ_PROJECT_NAME}/${TDAQ_PROJECT_NAME}-${TDAQ_VERSION}" )
# Find the ATLAS CMake code:
find_package( AtlasCMake QUIET )
# Find the base project(s):
find_package( AthGenerationExternals REQUIRED )
find_package( Gaudi REQUIRED )
# Load all the files from the externals/ subdirectory:
file( GLOB _externals "${CMAKE_CURRENT_SOURCE_DIR}/externals/*.cmake" )
foreach( _external ${_externals} )
include( ${_external} )
get_filename_component( _extName ${_external} NAME_WE )
string( TOUPPER ${_extName} _extNameUpper )
message( STATUS "Taking ${_extName} from: ${${_extNameUpper}_ROOT}" )
unset( _extName )
unset( _extNameUpper )
endforeach()
unset( _external )
unset( _externals )
# Disable the usage of the --no-undefined linker flag:
atlas_disable_no_undefined()
# Set up CTest:
atlas_ctest_setup()
# Declare project name and version
atlas_project( AthGeneration ${ATHGENERATION_PROJECT_VERSION}
USE AthGenerationExternals 0.0.1
PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../
FORTRAN )
# Install the external configurations:
install( DIRECTORY ${CMAKE_SOURCE_DIR}/externals
DESTINATION ${CMAKE_INSTALL_CMAKEDIR} USE_SOURCE_PERMISSIONS )
# Generate the environment setup for the externals, to be used during the build:
lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh )
# Generate replacement rules for the installed paths:
set( _replacements )
if( NOT "$ENV{NICOS_PROJECT_HOME}" STREQUAL "" )
get_filename_component( _buildDir $ENV{NICOS_PROJECT_HOME} PATH )
list( APPEND _replacements ${_buildDir} "\${AthGeneration_DIR}/../../../.." )
endif()
if( NOT "$ENV{NICOS_PROJECT_RELNAME}" STREQUAL "" )
list( APPEND _replacements $ENV{NICOS_PROJECT_RELNAME}
"\${AthGeneration_VERSION}" )
endif()
if( NOT "$ENV{TDAQ_RELEASE_BASE}" STREQUAL "" )
list( APPEND _replacements $ENV{TDAQ_RELEASE_BASE}
"\${TDAQ_RELEASE_BASE}" )
endif()
# Now generate and install the installed setup files:
lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/env_setup_install.sh
REPLACE ${_replacements} )
install( FILES ${CMAKE_BINARY_DIR}/env_setup_install.sh
DESTINATION . RENAME env_setup.sh )
# Configure and install the post-configuration file:
string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}"
TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" )
string( REPLACE "${TDAQ-COMMON_VERSION}" "\${TDAQ-COMMON_VERSION}"
TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" )
string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}"
DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" )
string( REPLACE "${DQM-COMMON_VERSION}" "\${DQM-COMMON_VERSION}"
DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" )
configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in
${CMAKE_BINARY_DIR}/PostConfig.cmake @ONLY )
install( FILES ${CMAKE_BINARY_DIR}/PostConfig.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR} )
# Package up the release using CPack:
atlas_cpack_setup()
#
# File taking care of pointing the downstream projects at the right
# version of the externals.
#
# Set the versions of the TDAQ projects:
set( TDAQ-COMMON_VERSION "@TDAQ-COMMON_VERSION@" )
set( TDAQ-COMMON_ROOT "@TDAQ-COMMON_ROOT@" )
set( DQM-COMMON_VERSION "@DQM-COMMON_VERSION@" )
set( DQM-COMMON_ROOT "@DQM-COMMON_ROOT@" )
# Find Gaudi:
find_package( Gaudi REQUIRED )
# Load all the files from the externals/ subdirectory:
get_filename_component( _thisdir ${CMAKE_CURRENT_LIST_FILE} PATH )
file( GLOB _externals "${_thisdir}/externals/*.cmake" )
unset( _thisdir )
foreach( _external ${_externals} )
include( ${_external} )
get_filename_component( _extName ${_external} NAME_WE )
string( TOUPPER ${_extName} _extNameUpper )
if( NOT AtlasExternals_FIND_QUIETLY )
message( STATUS "Taking ${_extName} from: ${${_extNameUpper}_ROOT}" )
endif()
unset( _extName )
unset( _extNameUpper )
endforeach()
unset( _external )
unset( _externals )
The Full ATLAS Offline Software Project
=======================================
This is the configuration for building the full offline software from the
repository.
Build Instructions
------------------
To build the externals necessary for building this project itself, use the
build_externals.sh
script. It will build all the externals necessary for this project into a
subdirectory of the directory holding this repository, called `build`.
The sources of the externals will be checked out under `build/src`, the
build of the projects will commence under `build/build`, and the results of
the build will be installed under `build/install`.
RPMs created from the externals are copied under `build/` by the script.
Once the externals have finished building, you can initiate the full build
of the project against these newly built externals by executing the
build.sh
script. It uses the same directory layout inside the `build` directory as
was used for the externals.
Custom Builds
-------------
Of course it is perfectly allowed to set up a build by hand, not using the
`build.sh` script as well. In that case you have to make sure to have a
functional version of AthGenerationExternals set up in your environment, and point
the `GAUDI_ROOT` environment variable against the Gaudi version that you
want to use for the build.
You will also need to set the `TDAQ_RELEASE_BASE` environment variable for
the build to be successful. The simplest way of doing this is to use the
helper script:
Build/AtlasBuildScripts/TDAQ_RELEASE_BASE.sh
This diff is collapsed.
This diff is collapsed.
a7e70ab396895623ed230ae414d5455be744510c
\ No newline at end of file
#!/bin/bash
#
# Script for building the release on top of externals built using one of the
# scripts in this directory.
#
# Function printing the usage information for the script
usage() {
echo "Usage: build.sh [-t build type] [-b build dir] [-c] [-m] [-i] [-p] [-a]"
echo " -c: Execute CMake step"
echo " -m: Execute make step"
echo " -i: Execute install step"
echo " -p: Execute CPack step"
echo " -a: Abort on error"
echo "If none of the c, m, i or p options are set then the script will do"
echo "*all* steps. Otherwise only the enabled steps are run - it's your"
echo "reponsibility to ensure that precusors are in good shape"
}
# Parse the command line arguments:
BUILDDIR=""
BUILDTYPE="RelWithDebInfo"
EXE_CMAKE=""
EXE_MAKE=""
EXE_INSTALL=""
EXE_CPACK=""
NIGHTLY=true
while getopts ":t:b:hcmipa" opt; do
case $opt in
t)
BUILDTYPE=$OPTARG
;;
b)
BUILDDIR=$OPTARG
;;
c)
EXE_CMAKE="1"
;;
m)
EXE_MAKE="1"
;;
i)
EXE_INSTALL="1"
;;
p)
EXE_CPACK="1"
;;
a)
NIGHTLY=false
;;
h)
usage
exit 0
;;
:)
echo "Argument -$OPTARG requires a parameter!"
usage
exit 1
;;
?)
echo "Unknown argument: -$OPTARG"
usage
exit 1
;;
esac
done
# If no step was explicitly specified, turn them all on:
if [ -z "$EXE_CMAKE" -a -z "$EXE_MAKE" -a -z "$EXE_INSTALL" -a -z "$EXE_CPACK" ]; then
EXE_CMAKE="1"
EXE_MAKE="1"
EXE_INSTALL="1"
EXE_CPACK="1"
fi
# Stop on errors from here on out:
set -e
# Source in our environment
AthGenerationSrcDir=$(dirname ${BASH_SOURCE[0]})
if [ -z "$BUILDDIR" ]; then
BUILDDIR=${AthGenerationSrcDir}/../../../build
fi
mkdir -p ${BUILDDIR}
BUILDDIR=$(cd ${BUILDDIR} && pwd)
source $AthGenerationSrcDir/build_env.sh -b $BUILDDIR >& ${BUILDDIR}/build_env.log
cat ${BUILDDIR}/build_env.log
# Set Gaudi's version to the same value as this project's version:
export GAUDI_VERSION=`cat ${AthGenerationSrcDir}/version.txt`
# create the actual build directory
mkdir -p ${BUILDDIR}/build/AthGeneration
cd ${BUILDDIR}/build/AthGeneration
# consider a pipe failed if ANY of the commands fails
set -o pipefail
# CMake:
if [ -n "$EXE_CMAKE" ]; then
# Remove the CMakeCache.txt file, to force CMake to find externals
# from scratch in an incremental build.
rm -f CMakeCache.txt
# Now run the actual CMake configuration:
time cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \
-DCTEST_USE_LAUNCHERS:BOOL=TRUE \
${AthGenerationSrcDir} 2>&1 | tee cmake_config.log
fi
# for nightly builds we want to get as far as we can
if [ "$NIGHTLY" = true ]; then
# At this point stop worrying about errors:
set +e
fi
# make:
if [ -n "$EXE_MAKE" ]; then
time make -k 2>&1 | tee cmake_build.log
fi
# Install the results:
if [ -n "$EXE_INSTALL" ]; then
time make install/fast \
DESTDIR=${BUILDDIR}/install/AthGeneration/${NICOS_PROJECT_VERSION} 2>&1 | tee cmake_install.log
fi
# Build an RPM for the release:
if [ -n "$EXE_CPACK" ]; then
time cpack 2>&1 | tee cmake_cpack.log
cp AthGeneration*.rpm ${BUILDDIR}/
fi
# This script sets up the build enironment for an AthGeneration
# build, on top of a built set of externals (including Gaudi)
#
# This script is kept separate from the build.sh
# wrapper so it can be sourced separately from it when
# clients want to manage their own build and just want
# to setup the build environment
env_usage() {
echo "Usage: build_env.sh [-b build dir]"
}
# This function actually sets up the environment for us
# (factorise it here in case it needs skipped)
env_setup() {
startdir=$(pwd)
# As this script can be sourced we need to support zsh and
# possibly other Bourne shells
if [ "x${BASH_SOURCE[0]}" = "x" ]; then
# This trick should do the right thing under ZSH:
thisdir=$(dirname `print -P %x`)
if [ $? != 0 ]; then
echo "ERROR: This script must be sourced from BASH or ZSH"
return 1
fi
else
# The BASH solution is a bit more straight forward:
thisdir=$(dirname ${BASH_SOURCE[0]})
fi
AthGenerationSrcDir=$(cd ${thisdir};pwd)
# The directory holding the helper scripts:
scriptsdir=${AthGenerationSrcDir}/../../Build/AtlasBuildScripts
# Go to the main directory of the repository:
cd ${AthGenerationSrcDir}/../..
# Check if the user specified any source/build directories:
if [ "$BUILDDIR" = "" ]; then
BUILDDIR=${AthGenerationSrcDir}/../../../build
fi
# Set up the environment for the build:
export NICOS_PROJECT_VERSION=`cat ${AthGenerationSrcDir}/version.txt`
export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION}
export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION}
export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/AthGeneration
# Set up the environment variables for finding LCG and the TDAQ externals:
source ${scriptsdir}/LCG_RELEASE_BASE.sh
source ${scriptsdir}/TDAQ_RELEASE_BASE.sh
# Set up the AthGenerationExternals project:
extDir=${BUILDDIR}/install/AthGenerationExternals/${NICOS_PROJECT_VERSION}/InstallArea
if [ ! -d ${extDir} ]; then
echo "Didn't find the AthGenerationExternals project under ${extDir}"
fi
echo "Setting up AthGenerationExternals from: ${extDir}"
source ${extDir}/*/setup.sh
# Get the "platform name" from the directory created by the AthGenerationExternals
# build:
platform=$(cd ${extDir};ls)
# Point to Gaudi:
export GAUDI_ROOT=${BUILDDIR}/install/GAUDI/${NICOS_PROJECT_VERSION}/InstallArea/${platform}
echo "Taking Gaudi from: ${GAUDI_ROOT}"
cd $startdir
}
# we need to reset the option index as we are sourcing this script
# http://stackoverflow.com/questions/23581368/bug-in-parsing-args-with-getopts-in-bash
OPTIND=1
# Parse the command line arguments:
BUILDDIR=""
while getopts "b:h" opt; do
case $opt in
b)
BUILDDIR=$OPTARG
;;
h)
env_usage
ABORT=1
;;
:)
echo "Argument -$OPTARG requires a parameter!"
env_usage
ABORT=1
;;
?)
echo "Unknown argument: -$OPTARG"
env_usage
ABORT=1
;;
esac
done
# Put a big wrapper around bad argument case, because
# a sourced script should not call "exit". This is quite
# annoying...
if [ -z "$ABORT" ]; then
env_setup
fi
#!/bin/bash
#
# Script building all the externals necessary for the nightly build.
#
# Function printing the usage information for the script
usage() {
echo "Usage: build_externals.sh [-t build_type] [-b build_dir] [-f] [-c]"
echo " -f: Force rebuild of externals from scratch, otherwise if script"
echo " finds an external build present it will only do an incremental"
echo " build"
echo " -c: Build the externals for the continuous integration (CI) system,"
echo " skipping the build of the externals RPMs."
echo "If a build_dir is not given the default is '../build'"
echo "relative to the athena checkout"
}
# Parse the command line arguments:
BUILDDIR=""
BUILDTYPE="RelWithDebInfo"
FORCE=""
CI=""
while getopts ":t:b:fch" opt; do
case $opt in
t)
BUILDTYPE=$OPTARG
;;
b)
BUILDDIR=$OPTARG
;;
f)
FORCE="1"
;;
c)
CI="1"
;;
h)
usage
exit 0
;;
:)
echo "Argument -$OPTARG requires a parameter!"
usage
exit 1
;;
?)
echo "Unknown argument: -$OPTARG"
usage
exit 1
;;
esac
done
# Version comparison function. Taken from a StackOverflow article.
verlte() {
if [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]; then
return 1
fi
return 0
}
# First off, check that we are using a new enough version of Git. We need
# at least version 1.8.1.
git_min_version=1.8.1
git_version=`git --version | awk '{print $3}'`
verlte "${git_min_version}" "${git_version}"
if [ $? = 0 ]; then
echo "Detected git version (${git_version}) not new enough."
echo "Need at least: ${git_min_version}"
exit 1
fi
# Stop on errors from here on out:
set -e
set -o pipefail
# We are in BASH, get the path of this script in a simple way:
thisdir=$(dirname ${BASH_SOURCE[0]})
thisdir=$(cd ${thisdir};pwd)
# Go to the main directory of the repository:
cd ${thisdir}/../..
# Check if the user specified any source/build directories:
if [ "$BUILDDIR" = "" ]; then
BUILDDIR=${thisdir}/../../../build
fi
mkdir -p ${BUILDDIR}
BUILDDIR=$(cd $BUILDDIR; pwd)
if [ "$FORCE" = "1" ]; then
echo "Force deleting existing build area..."
rm -fr ${BUILDDIR}/install/AthGenerationExternals ${BUILDDIR}/install/GAUDI
rm -fr ${BUILDDIR}/src/AthGenerationExternals ${BUILDDIR}/src/GAUDI
rm -fr ${BUILDDIR}/build/AthGenerationExternals ${BUILDDIR}/build/GAUDI
fi
# Create some directories:
mkdir -p ${BUILDDIR}/{src,install}
# Set some environment variables that the builds use internally:
export NICOS_PROJECT_VERSION=`cat ${thisdir}/version.txt`
export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION}
export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION}
# The directory holding the helper scripts:
scriptsdir=${thisdir}/../../Build/AtlasBuildScripts
scriptsdir=$(cd ${scriptsdir}; pwd)
# Set the environment variable for finding LCG releases:
source ${scriptsdir}/LCG_RELEASE_BASE.sh
# Flag for triggering the build of RPMs for the externals:
RPMOPTIONS="-r ${BUILDDIR}"
if [ "$CI" = "1" ]; then
RPMOPTIONS=
fi
# Read in the tag/branch to use for AthGenerationExternals:
AthGenerationExternalsVersion=$(awk '/^AthGenerationExternalsVersion/{print $3}' ${thisdir}/externals.txt)
# Check out AthGenerationExternals from the right branch/tag:
${scriptsdir}/checkout_atlasexternals.sh \
-e https://@gitlab.cern.ch:8443/ewelina/atlasexternals.git \
-t ${AthGenerationExternalsVersion} \
-s ${BUILDDIR}/src/AthGenerationExternals 2>&1 | tee ${BUILDDIR}/src/checkout.AthGenerationExternals.log
# Build AthGenerationExternals:
export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/AthGenerationExternals
${scriptsdir}/build_atlasexternals.sh \
-s ${BUILDDIR}/src/AthGenerationExternals \
-b ${BUILDDIR}/build/AthGenerationExternals \
-i ${BUILDDIR}/install/AthGenerationExternals/${NICOS_PROJECT_VERSION} \
-p AthGenerationExternals ${RPMOPTIONS} -t ${BUILDTYPE} \
-v ${NICOS_PROJECT_VERSION}
# Get the "platform name" from the directory created by the AthGenerationExternals
# build:
platform=$(cd ${BUILDDIR}/install/AthGenerationExternals/${NICOS_PROJECT_VERSION}/InstallArea;ls)
# Read in the tag/branch to use for Gaudi:
GaudiVersion=$(awk '/^GaudiVersion/{print $3}' ${thisdir}/externals.txt)
# Check out Gaudi from the right branch/tag:
${scriptsdir}/checkout_Gaudi.sh \
-t ${GaudiVersion} \
-s ${BUILDDIR}/src/GAUDI 2>&1 | tee ${BUILDDIR}/src/checkout.GAUDI.log
# Build Gaudi:
export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/GAUDI
${scriptsdir}/build_Gaudi.sh \
-s ${BUILDDIR}/src/GAUDI \
-b ${BUILDDIR}/build/GAUDI \
-i ${BUILDDIR}/install/GAUDI/${NICOS_PROJECT_VERSION} \
-e ${BUILDDIR}/install/AthGenerationExternals/${NICOS_PROJECT_VERSION}/InstallArea/${platform} \
-p AthGenerationExternals -f ${platform} ${RPMOPTIONS} -t ${BUILDTYPE}
# Versions of the various externals to build before starting the build of
# this project, when doing a full stack nightly build.
#
# Remember that when specifying the name of a branch, you *must* put
# an "origin/" prefix before it. For tags however this is explicitly
# forbidden.
#AthGenerationExternalsVersion = 1.0.32
AthGenerationExternalsVersion = origin/AthGeneration_1.0
GaudiVersion = v27r1.018
#
# File specifying the location of Crmc to use.
#
set( CRMC_VERSION 1.5.4 )
set( CRMC_ROOT
${LCG_RELEASE_DIR}/MCGenerators/crmc/${CRMC_VERSION}/${LCG_PLATFORM} )
#
# File specifying the location of EvtGen to use.
#
set( EVTGEN_VERSION 1.4.0 )
set( EVTGEN_ROOT
${LCG_RELEASE_DIR}/MCGenerators/evtgen/${EVTGEN_VERSION}/${LCG_PLATFORM} )
#
# File specifying the location of HEPUtils to use.
#