Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:37

0001 dir_name=`pwd`;
0002 SW=/home/frankm/SW;
0003 
0004 INSTALL_LCIO=${SW}/lcio/v02-04-03;
0005 INSTALL_XERCESC=${SW}/xercesc;
0006 
0007 INSTALL_G4=${SW}/g4_10.01.p02_dbg/lib/Geant4-10.1.2;
0008 CHECKOUT=${dir_name}/../../DD4hep.trunk/checkout;
0009 GEANT_VERSION=10.01.p02;
0010 #ROOT_VERSION=5.34.25
0011 
0012 GEANT_VERSION=10.02.p02;
0013 GEANT_VERSION=10.03.p02;
0014 INSTALL_G4=${SW}/g4_${GEANT_VERSION}_dbg/lib/Geant4-10.3.2;
0015 #ROOT_VERSION=6.06.06;
0016 ROOT_VERSION=6.08.00;
0017 ROOT_VERSION=6.10.04;
0018 ROOT_VERSION=6.12.06;
0019 source ${INSTALL_G4}/../../bin/geant4.sh;
0020 num_threads=2
0021 #
0022 # Root version < 6.08 : 
0023 #export CXX="`which g++-5` -D_GLIBCXX_USE_CXX11_ABI=0";
0024 #export CC="`which gcc-5` -D_GLIBCXX_USE_CXX11_ABI=0";
0025 #
0026 export CXX="`which g++-5`";
0027 export CC="`which gcc-5`";
0028 
0029 # ==============================================================================
0030 # Parse arguments
0031 # ==============================================================================
0032 parse_command_line_args()
0033 {
0034     MULTITHREADED="";
0035     ARG_ERROR="";
0036     PLATFORMS="dbg opt";
0037     while [[ "$1" == -* ]]; do
0038         #echo "Arg:$1 $2";
0039         a1=`echo $1 | tr A-Z a-z`;
0040         case ${a1} in
0041 
0042             -root)
0043                 ROOT_VERSION=$2;
0044                 shift
0045                 ;;
0046 
0047             -geant4)
0048                 GEANT_VERSION=$2;
0049                 shift
0050                 ;;
0051 
0052             -build)
0053                 PLATFORMS="$2";
0054                 shift
0055                 ;;
0056 
0057             -mt)
0058                 MULTITHREADED="YES";
0059                 ;;
0060 
0061             -st)
0062                 MULTITHREADED="";
0063                 ;;
0064 
0065             -threads)
0066                 num_threads=$2;
0067                 shift
0068                 ;;
0069 
0070             -j)
0071                 num_threads=$2;
0072                 shift
0073                 ;;
0074 
0075             *)
0076                 ARG_ERROR=$1;
0077                 ;;
0078         esac
0079         shift
0080     done
0081 }
0082 #cat ${ROOTSYS}/bin/thisroot.sh;
0083 #
0084 LINE="===================================================================================================";
0085 BARS="=====  ";
0086 #
0087 make_output()
0088 {
0089     echo "${LINE}";
0090     echo "${BARS}";
0091     echo "=====>>     `pwd` ";
0092     if test -n "${1}"; then 
0093         echo " +++++ ${1}";
0094     fi;
0095     if test -n "${2}"; then 
0096         echo " +++++ ${2}";
0097     fi;
0098     echo "${BARS}";
0099     echo "${LINE}";
0100 }
0101 
0102 make_opt()
0103 {
0104     if test "$1" = "ON"; then
0105         arg="${2}=${1}";shift;shift;
0106         echo ${arg} $*;
0107         #else
0108         #       echo ${1};
0109     fi;
0110 }
0111 
0112 make_build()
0113 {
0114     echo ${CMD};
0115     eval ${CMD};
0116     if [ $? -ne  0 ]; then
0117         make_output "DANGER WILL ROBINSON DANGER!" "++++ Failed CMAKE command:"
0118         echo ${CMD};
0119         exit 1
0120     fi
0121     make install VERBOSE=1 -j ${num_threads};
0122     if [ $? -ne  0 ]; then
0123         make_output "DANGER WILL ROBINSON DANGER!" "++++ Failed BUILD!"
0124         echo ${CMD};
0125         exit 1
0126     fi;
0127     make test;
0128     if [ $? -ne  0 ]; then
0129         make_output "DANGER WILL ROBINSON DANGER!" "++++ Failed TESTS!"
0130         echo ${CMD};
0131         exit 1
0132     fi;
0133     echo "${LINE}";
0134     echo "${BARS}";
0135     echo "=======>>  Successfully build configuration `pwd` ";
0136     echo "${BARS}";
0137     echo "${LINE}";
0138 }
0139 
0140 build_all()
0141 {
0142     export Geant4_DIR=${SW}/g4_${GEANT_VERSION}_dbg;
0143     DEF_MODES="ON OFF";
0144     G4_MODES="${DEF_MODES}";
0145     XERCES_MODES="${DEF_MODES}";
0146     LCIO_MODES="${DEF_MODES}";
0147     XERCES_MODES="OFF";
0148     G4_MODES="ON";
0149     LCIO_MODES="OFF";
0150     BUILD_TYPE=;
0151     BUILD_TYPE="-DCMAKE_BUILD_TYPE=Debug";
0152     for DOGEANT4 in ${G4_MODES}; do
0153         for DOXERCESC in ${XERCES_MODES}; do
0154             for DOGEAR in OFF; do
0155                 for DOLCIO in ${LCIO_MODES}; do
0156                     folder=build_Xer${DOXERCESC}_Geant${DOGEANT4}_Gear${DOGEAR}_Lcio${DOLCIO}
0157                     WORK_DIR=${dir_name}/${folder};
0158                     mkdir -p ${WORK_DIR}/EX;
0159                     cd ${WORK_DIR};
0160                     make_output;
0161                     #-DDD4HEP_DEBUG_CMAKE=ON \
0162                     unset DD4hep_DIR;
0163                     OPTS="`make_opt ${DOGEANT4} -DDD4HEP_USE_GEANT4 -DGeant4_DIR=${INSTALL_G4}`\
0164                     `make_opt ${DOLCIO}     -DDD4HEP_USE_LCIO -DLCIO_DIR=${INSTALL_LCIO}` \
0165                     `make_opt ${DOXERCESC}  -DDD4HEP_USE_XERCESC -DXERCESC_ROOT_DIR=${INSTALL_XERCESC}` \
0166                     -DROOTSYS=${ROOTSYS} -DCMAKE_INSTALL_PREFIX=${WORK_DIR}/DD4hep";
0167                     CMD="cd ${dir_name}/$folder ; cmake ${BUILD_TYPE} ${OPTS} ${CHECKOUT};";
0168                     make_build;
0169 
0170                     unset ROOTSYS;
0171                     DD4hep_DIR=${WORK_DIR}/DD4hep;
0172 
0173                     OPTS_ex="`make_opt ${DOGEANT4} -DDD4HEP_USE_GEANT4 -DGeant4_DIR=${INSTALL_G4}`\
0174                     `make_opt ${DOLCIO}     -DDD4HEP_USE_LCIO    -DLCIO_DIR=${INSTALL_LCIO}` \
0175                     `make_opt ${DOXERCESC}  -DDD4HEP_USE_XERCESC -DXERCESC_ROOT_DIR=${INSTALL_XERCESC}` \
0176                     -DROOTSYS=${ROOTSYS}";
0177                     source ${DD4hep_DIR}/bin/thisdd4hep.sh;
0178                     CMD="cd ${WORK_DIR}/EX; cmake ${BUILD_TYPE} ${OPTS} -DDD4hep_DIR=${DD4hep_DIR} ${CHECKOUT}/examples;";
0179                     make_build;
0180                     #
0181                     cd ../..;
0182                 done;
0183             done;
0184         done;
0185     done;
0186 }
0187 
0188 
0189 parse_command_line_args $*;
0190 if [ "$ARG_ERROR" != "" ]; then
0191     echo "Unknown option: ERROR CONDITION";
0192     exit 0;
0193 elif [ "$ROOT_VERSION" == "" ] || [ "$PLATFORMS" == "" ]; then
0194     echo "ERROR CONDITION ROOT_VERSION=${ROOT_VERSION}  PLATFORMS=${PLATFORMS}";
0195     exit 0;
0196 fi;
0197 export INSTALL_G4;
0198 export ROOTSYS=${SW}/root_v${ROOT_VERSION}_dbg;
0199 . ${ROOTSYS}/bin/thisroot.sh;
0200 #
0201 #
0202 build_all;
0203 #
0204 #
0205 #