install_QnTools-cxx17.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #!/bin/bash
  2. #---Option: if set, script stops (with logout) when encounters errors
  3. #set -e
  4. NPROC=`nproc`
  5. echo "Number of available CPUs: $NPROC"
  6. export STARTING_PWD=$PWD
  7. export INSTALLATION_PATH=$PWD/testQn
  8. mkdir -p $INSTALLATION_PATH
  9. #---Save original environmant
  10. export PATH_Qn_original=$PATH
  11. export LD_LIBRARY_PATH_Qn_original=$LD_LIBRARY_PATH
  12. export BOOST_ROOT_Qn_original=$BOOST_ROOT
  13. export CC_Qn_original=$CC
  14. export CXX_Qn_original=$CXX
  15. #---Install gcc ver. 8.5.0
  16. if [ ! -d "${INSTALLATION_PATH}/gcc-8.5.0" ]
  17. then
  18. echo "Installing gcc ver. 8.5.0 ..."
  19. cd $INSTALLATION_PATH
  20. wget http://mirror.linux-ia64.org/gnu/gcc/releases/gcc-8.5.0/gcc-8.5.0.tar.gz
  21. tar xvfz gcc-8.5.0.tar.gz
  22. cd gcc-8.5.0/
  23. ./contrib/download_prerequisites
  24. ./configure --disable-multilib --prefix=${INSTALLATION_PATH}/gcc-8.5.0
  25. make -j${NPROC}
  26. make install
  27. else
  28. echo "Directory gcc-8.5.0 already exists in the installation path. Skipping this step."
  29. fi
  30. #---Install boost ver. 1.77.0
  31. if [ ! -d "${INSTALLATION_PATH}/boost_1_77_0" ]
  32. then
  33. echo "Installing boost ver. 1.77.0 ..."
  34. cd $INSTALLATION_PATH
  35. wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz
  36. tar xvfz boost_1_77_0.tar.gz
  37. cd boost_1_77_0/
  38. export PATH=${INSTALLATION_PATH}/gcc-8.5.0/bin:$PATH
  39. export LD_LIBRARY_PATH=${INSTALLATION_PATH}/gcc-8.5.0/lib64/:$LD_LIBRARY_PATH
  40. export BOOST_ROOT=${INSTALLATION_PATH}/boost_1_77_0/
  41. ./bootstrap.sh --prefix=${INSTALLATION_PATH}/boost_1_77_0/
  42. ./b2 install
  43. else
  44. echo "Directory boost_1_77_0 already exists in the installation path. Skipping this step."
  45. fi
  46. #---Install cmake ver. 3.18
  47. if [ ! -d "${INSTALLATION_PATH}/cmake-3.18.0" ]
  48. then
  49. echo "Installing cmake ver. 3.18.0 ..."
  50. cd $INSTALLATION_PATH
  51. wget https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz
  52. tar xfvz cmake-3.18.0.tar.gz
  53. cd cmake-3.18.0/
  54. ./bootstrap --prefix=${INSTALLATION_PATH}/cmake-3.18.0
  55. make -j${NPROC}
  56. make install
  57. export CMAKE_BIN=${INSTALLATION_PATH}/cmake-3.18.0/bin/cmake
  58. else
  59. echo "Directory cmake-3.18.0 already exists in the installation path. Skipping this step."
  60. export CMAKE_BIN=${INSTALLATION_PATH}/cmake-3.18.0/bin/cmake
  61. fi
  62. #---Install root 6.20 with cxx-17
  63. if [ ! -d "${INSTALLATION_PATH}/root/build-cxx17" ]
  64. then
  65. echo "Installing root ver. 6.20 with c++17 standard ..."
  66. cd $INSTALLATION_PATH
  67. mkdir root/
  68. cd root/
  69. git clone https://github.com/root-project/root.git src/
  70. cd src/
  71. git checkout v6-20-00-patches
  72. cd ../
  73. mkdir build-cxx17 install-cxx17
  74. cd build-cxx17/
  75. export CC=${INSTALLATION_PATH}/gcc-8.5.0/bin/gcc
  76. export CXX=${INSTALLATION_PATH}/gcc-8.5.0/bin/g++
  77. export LD_LIBRARY_PATH=${INSTALLATION_PATH}/gcc-8.5.0/lib64:$LD_LIBRARY_PATH
  78. $CMAKE_BIN -Dbuiltin_gsl=ON -Dmathmore=ON -Dbuiltin_xrootd=ON -Dbuiltin_glew=ON -Dbuiltin_afterimage=ON -Dbuiltin_vdt=ON -DCMAKE_INSTALL_PREFIX=${INSTALLATION_PATH}/root/install-cxx17/ -DCMAKE_CXX_STANDARD=17 ../src/
  79. make -j${NPROC} install
  80. else
  81. echo "Directory root/build-cxx17 already exists in the installation path. Skipping this step."
  82. fi
  83. #---Install AnalysisTree core part (with c++17 standard)
  84. if [ ! -d "${INSTALLATION_PATH}/AnalysisTree/build-cxx17" ]
  85. then
  86. echo "Installing AnalysisTree with c++17 standard ..."
  87. cd $INSTALLATION_PATH
  88. if [ ! -d "${INSTALLATION_PATH}/AnalysisTree/" ]
  89. then
  90. git clone https://github.com/HeavyIonAnalysis/AnalysisTree.git
  91. fi
  92. cd AnalysisTree/
  93. git checkout release-1.0
  94. mkdir build-cxx17 install-cxx17
  95. cd build-cxx17/
  96. source ${INSTALLATION_PATH}/root/build-cxx17/bin/thisroot.sh
  97. export CC=${INSTALLATION_PATH}/gcc-8.5.0/bin/gcc
  98. export CXX=${INSTALLATION_PATH}/gcc-8.5.0/bin/g++
  99. export LD_LIBRARY_PATH=${INSTALLATION_PATH}/gcc-8.5.0/lib64:$LD_LIBRARY_PATH
  100. export CPATH=${INSTALLATION_PATH}/root/build/include/
  101. $CMAKE_BIN -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=${INSTALLATION_PATH}/AnalysisTree/install-cxx17/ ../
  102. make -j${NPROC} install
  103. else
  104. echo "Directory AnalysisTree/build-cxx17 already exists in the installation path. Skipping this step."
  105. fi
  106. #---Install QnAnalysis with cxx17, root-6.20, gcc-8.5.0, boost-1.77.0
  107. if [ ! -d "${INSTALLATION_PATH}/QnAnalysis" ]
  108. then
  109. echo "Installing QnAnalysis (with cxx17 standard, root-6.20, gcc-8.5.0, boost-1.77.0) ..."
  110. cd $INSTALLATION_PATH
  111. git clone git@github.com:HeavyIonAnalysis/QnAnalysis.git
  112. cd QnAnalysis/
  113. mkdir build install
  114. cd build/
  115. source ${INSTALLATION_PATH}/root/build-cxx17/bin/thisroot.sh
  116. export PATH=${INSTALLATION_PATH}/gcc-8.5.0/bin:$PATH
  117. export LD_LIBRARY_PATH=${INSTALLATION_PATH}/gcc-8.5.0/lib64/:$LD_LIBRARY_PATH
  118. export BOOST_ROOT=${INSTALLATION_PATH}/boost_1_77_0/
  119. $CMAKE_BIN -DCMAKE_INSTALL_PREFIX=${INSTALLATION_PATH}/QnAnalysis/install -Dyaml-cpp_BUNDLED=ON ../
  120. make -j${NPROC} install
  121. else
  122. echo "Directory QnAnalysis already exists in the installation path. Skipping this step."
  123. fi
  124. cd $STARTING_PWD