diff --git a/CMakeLists.txt b/CMakeLists.txt index dc40e73d1..6b7b23d6e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,6 @@ # ----------------------------------------------------------------------------- cmake_minimum_required(VERSION 3.19.3 FATAL_ERROR) - set(policy_new CMP0072 CMP0077) foreach(policy ${policy_new}) if(POLICY ${policy}) @@ -98,6 +97,7 @@ set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_ROOT}/share") set(CMAKE_INSTALL_CMAKEDATADIR "${CMAKE_INSTALL_DATADIR}/cmake") set(CMAKE_INSTALL_THIRDPARTY "${CMAKE_INSTALL_ROOT}") + # It is used by format/style checks. It needs to be defined here such # to enable relocation of the scripts. set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/util/housekeeping") @@ -137,8 +137,14 @@ option(jemalloc "Use jemalloc for memory allocations." OFF) option(website "Enable website generation (make website<-live>)." OFF) option(valgrind "Enable valgrind tests and make build compatible with valgrind tool." ON) option(rpath "Link libraries with built-in RPATH (run-time search path)." OFF) +option(nest "Install The Neural Simulation Tool (NEST) for spiking neural network models." ON) option(real_t "Define data type for real numbers. Currently supported: float, double" double) +if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/gcc") + file(COPY "${CMAKE_SOURCE_DIR}/third_party/gcc" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") +endif() + + if(APPLE) # ParaView on Apple devices set(CMAKE_BDM_PVVERSION "5.10") @@ -416,7 +422,15 @@ endif() if(sbml) if(APPLE) - message(FATAL_ERROR "Currently SBML is not supported on MacOS (see https://trello.com/c/vKPbh4iG).") + SET(LLRR_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party") + if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner") + file(COPY "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + else() + execute_process(COMMAND bash ${LLRR_BLD_SCRIPT_LOCATION}/build-roadrunner_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE LLRR_DOWNLOAD_OR_BUILD) + file(COPY "${CMAKE_SOURCE_DIR}/third_party/install_roadrunner" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + endif() + find_package(Libroadrunner) + #message(FATAL_ERROR "Currently SBML is not supported on MacOS (see https://trello.com/c/vKPbh4iG).") endif() find_package(Libroadrunner) if(NOT Libroadrunner_FOUND) @@ -425,6 +439,16 @@ if(sbml) endif() endif() +if(nest) + if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/nest") + file(COPY "${CMAKE_SOURCE_DIR}/third_party/nest" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + else() + SET(NEST_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party") + execute_process(COMMAND bash ${NEST_BLD_SCRIPT_LOCATION}/build-nest_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE NEST_DOWNLOAD_OR_BUILD) + file(COPY "${CMAKE_SOURCE_DIR}/third_party/nest" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + endif() +endif() + # Load libgit2 if it is enabled if (libgit2) include(external/Libgit2) diff --git a/cmake/FindROOT.cmake b/cmake/FindROOT.cmake index 5443a8479..5c2f06724 100644 --- a/cmake/FindROOT.cmake +++ b/cmake/FindROOT.cmake @@ -16,9 +16,16 @@ # Updated by K. Smith (ksmith37@nd.edu) to properly handle # dependencies in ROOT_GENERATE_DICTIONARY +if(NOT DEFINED ENV{ROOTSYS}) +SET(ENV{ROOTSYS} "${CMAKE_SOURCE_DIR}/third_party/root") +elseif("$ENV{ROOTSYS}" STREQUAL "") +SET(ENV{ROOTSYS} "${CMAKE_SOURCE_DIR}/third_party/root") +endif() + find_program(ROOT_CONFIG_EXECUTABLE NAMES root-config HINTS "$ENV{ROOTSYS}/bin" "$ENV{BDM_ROOT_DIR}/bin" "${CMAKE_THIRD_PARTY_DIR}/root/bin") - + + execute_process( COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE ROOTSYS diff --git a/cmake/env/thisbdm.fish b/cmake/env/thisbdm.fish old mode 100755 new mode 100644 index e8d65814f..d9cc1e010 --- a/cmake/env/thisbdm.fish +++ b/cmake/env/thisbdm.fish @@ -101,7 +101,7 @@ function source_thisbdm set -l curr_filename (status --current-filename) set -gx BDMSYS (fish -c "cd (dirname $curr_filename)/..; and pwd"); or return 1 - + if test -n "$old_bdmsys"; and test "$old_bdmsys" != "$BDMSYS" _bdm_warn "[WARN] You've already sourced another 'thisbdm' in your current shell session." _bdm_warn " -> prev. installation='$old_bdmsys'" @@ -252,7 +252,7 @@ function source_thisbdm end pyenv init --path $PYENV_NO_REHASH | source; or return 1 - pyenv init - $PYENV_NO_REHASH | source; or return 1 + pyenv init - $PYENV_NO_REHASH | source; or return 1 pyenv shell @pythonvers@; or return 1 # Location of jupyter executable (installed with `pip install` command) @@ -269,7 +269,7 @@ function source_thisbdm end ######## - #### ROOT Specific Configurations #### + #### ROOT Specific Configurations #### if test -z "$BDM_CUSTOM_ROOT" if test -z "$ROOTSYS" set -gx BDM_CUSTOM_ROOT false @@ -278,7 +278,7 @@ function source_thisbdm end end - if begin; + if begin; test -z "$BDM_ROOT_DIR"; and test -z "$ROOTSYS"; end; or test "$BDM_CUSTOM_ROOT" = false set -gx BDM_ROOT_DIR "$BDMSYS/third_party/root" @@ -322,13 +322,13 @@ function source_thisbdm set -gx BDM_CUSTOM_PV true end end - + if test "$BDM_CUSTOM_PV" = false; or test -z "$ParaView_DIR" set -gx ParaView_DIR "$BDMSYS/third_party/paraview" else _bdm_info "[INFO] Custom ParaView 'ParaView_DIR=$ParaView_DIR'" end - + if not test -d "$ParaView_DIR" _bdm_err "[ERR] We are unable to find ParaView! Please make sure it is installed" _bdm_err " on your system! You can manually specify its location by executing" @@ -377,7 +377,7 @@ function source_thisbdm set -gx BDM_CUSTOM_QT true end end - + if test "$BDM_CUSTOM_QT" = false; or test -z "$Qt5_DIR" set -gx Qt5_DIR "$BDMSYS/third_party/qt" else @@ -415,6 +415,26 @@ function source_thisbdm # OpenMP set -gx OMP_PROC_BIND true + + #Select (export) the correct compiler version + if test (echo "$GCC_VER >= 12" | bc -q) -eq 1 || test (echo "$GCC_VER < 8" | bc -q) -eq 1 + if command -q gcc-11 && command -q g++-11 && command -q gfortran-11 + set -gx CC gcc-11 + set -gx CXX g++-11 + set -gx FC gfortran-11 + set -gx OMPI_CC gcc-11 + set -gx OMPI_CXX g++-11 + set -gx OMPI_FC gfortran-11 + else if test -d "$BDMSYS/third_party/gcc" + set -gx CC "$BDMSYS/third_party/gcc/bin/gcc" + set -gx CXX "$BDMSYS/third_party/gcc/bin/g++" + set -gx FC "$BDMSYS/third_party/gcc/bin/gfortran" + set -gx OMPI_CC "$BDMSYS/third_party/gcc/bin/gcc" + set -gx OMPI_CXX "$BDMSYS/third_party/gcc/bin/g++" + set -gx OMPI_FC "$BDMSYS/third_party/gcc/bin/gfortran" + end + end + ###### Platform-specific Configuration # Apple specific if test (uname) = 'Darwin' @@ -429,15 +449,21 @@ function source_thisbdm . scl_source enable devtoolset-10; or return 1 end - . /etc/profile.d/modules.sh; or return 1 - module load mpi; or return 1 - # load llvm 6 required for libroadrunner if test -d "$BDMSYS"/third_party/libroadrunner . scl_source enable llvm-toolset-7; or return 1 end end end + + #LOAD MPI SUPPORT MODULE FOR ALL RHEL DISTROS + if test (uname) = "Linux" + set PROCVERSION (cat /proc/version) + if string match -iq '*Red Hat*' -- $PROCVERSION + source /etc/profile.d/modules.sh; or return 1 + module load mpi; or return 1 + end + end ####### ### Enable commands in child shells (like in bash) ### diff --git a/cmake/env/thisbdm.sh b/cmake/env/thisbdm.sh old mode 100755 new mode 100644 index 7f2db183c..115500253 --- a/cmake/env/thisbdm.sh +++ b/cmake/env/thisbdm.sh @@ -109,7 +109,7 @@ _source_thisbdm() # silent->quiet export BDM_THISBDM_LOGLEVEL=0 # disable everything fi - + if [ "$BDM_THISBDM_LOGLEVEL" -le 2 ]; then export BDM_THISBDM_NOPROMPT=true else @@ -135,7 +135,7 @@ _source_thisbdm() return 1 fi ######## - + local old_bdmsys if [ -n "${BDMSYS}" ]; then old_bdmsys=${BDMSYS} @@ -232,7 +232,7 @@ _source_thisbdm() LD_LIBRARY_PATH=$_newpath fi fi - fi + fi # If we run on macOS, we add the following exports for libomp support if [ "$(uname)" = "Darwin" ]; then @@ -542,6 +542,7 @@ _source_thisbdm() # OpenMP export OMP_PROC_BIND=true + ###### Platform-specific Configuration # Apple specific if [ "$(uname)" = 'Darwin' ]; then @@ -553,21 +554,89 @@ _source_thisbdm() os_id=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') || return 1 if [ "$os_id" = 'centos' ]; then export MESA_GL_VERSION_OVERRIDE=3.3 - if [ -z "${CXX}" ] && [ -z "${CC}" ] ; then - . scl_source enable devtoolset-10 || return 1 - fi - . /etc/profile.d/modules.sh || return 1 - module load mpi || return 1 - + # load llvm 6 required for libroadrunner if [ -d "${BDMSYS}"/third_party/libroadrunner ]; then . scl_source enable llvm-toolset-7 || return 1 fi fi fi + + #LOAD MPI SUPPORT MODULE FOR ALL RHEL DISTROS + if [ "$(uname)" = "Linux" ]; then + # linux + PROCVERSION=$(cat /proc/version) + if echo "$PROCVERSION" | grep -Eiq 'Red Hat' ; then + . scl_source enable gcc-toolset-10 > /dev/null 2> /dev/null || true + . scl_source enable devtoolset-10 > /dev/null 2> /dev/null || true + . scl_source enable gcc-toolset-11 > /dev/null 2> /dev/null || true + . scl_source enable devtoolset-11 > /dev/null 2> /dev/null || true + . /etc/profile.d/modules.sh || return 1 + module load mpi || return 1 + fi + fi + + #Select (export) the correct compiler version + GCC_VER=$(gcc --version | grep gcc) + if [ -n "${GCC_VER}" ]; then + read -ra tokens <<< $GCC_VER + result=() + current_token="" + for token in "${tokens[@]}"; do + if [[ -n $current_token ]]; then + current_token+=" $token" + if [[ $current_token == *')' ]]; then + result+=("$current_token") + current_token="" + fi + else + if [[ $token == '('* && $token != *')' ]]; then + current_token="$token" + else + result+=("$token") + fi + fi + done + if [[ -n $current_token ]]; then + result+=("$current_token") + fi + GCC_VER=${result[2]} + GCC_VER=$( echo $GCC_VER | cut -d '.' -f 1-2) + fi + + if [ -z "${GCC_VER}" ] || [ `echo "$GCC_VER >= 12" | bc -q` -ne 0 ] || [ `echo "$GCC_VER < 9" | bc -q` -ne 0 ]; then + + + if $(command -v gcc-11 > /dev/null) && $(command -v g++-11 > /dev/null) && $(command -v gfortran-11 > /dev/null); then + + export CC=gcc-11 + export CXX=g++-11 + export FC=gfortran-11 + export OMPI_CC=gcc-11 + export OMPI_CXX=g++-11 + export OMPI_FC=gfortran-11 + export QMAKE_CC=gcc-11 + export QMAKE_CXX=g++-11 + export LINK=g++-11 + + elif [ -d $BDMSYS/third_party/gcc ]; then + + export CC=$BDMSYS/third_party/gcc/bin/gcc + export CXX=$BDMSYS/third_party/gcc/bin/g++ + export FC=$BDMSYS/third_party/gcc/bin/gfortran + export OMPI_CC=$BDMSYS/third_party/gcc/bin/gcc + export OMPI_CXX=$BDMSYS/third_party/gcc/bin/g++ + export OMPI_FC=$BDMSYS/third_party/gcc/bin/gfortran + export QMAKE_CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc + export QMAKE_CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + export LINK=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + + fi + fi + ####### - # completions for bash: really primitive (but useful nonetheless) + # completions for bash: really primitive (but useful nonetheless) if [ -n "$BASH_VERSION" ]; then complete -W "new build clean run demo" biodynamo fi @@ -625,6 +694,9 @@ _source_thisbdm() esac fi + + + return 0 } diff --git a/cmake/external/ParaView.cmake b/cmake/external/ParaView.cmake index 2cfc6de92..b71539df3 100644 --- a/cmake/external/ParaView.cmake +++ b/cmake/external/ParaView.cmake @@ -1,26 +1,57 @@ include(utils) SET(PARAVIEW_SOURCE_DIR "${CMAKE_THIRD_PARTY_DIR}/paraview") +SET(PARAVIEW_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party") + +if(NOT EXISTS "${CMAKE_SOURCE_DIR}/build/third_party") + file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/third_party") +endif() + +if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/paraview") + file(COPY "${CMAKE_SOURCE_DIR}/third_party/paraview" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + if(APPLE) + if (NOT EXISTS "${CMAKE_SOURCE_DIR}/third_party/paraview/include/paraview-3.10") + set(CMAKE_BDM_PVVERSION "5.9") + endif() + endif() -if(APPLE AND "${DETECTED_ARCH}" STREQUAL "i386") - # The release of cmake 3.23.0 broke our build of ParaView on MacOSX. - # The build was fixed with a reupload and carries the additional tag cm233. - SET(PARAVIEW_TAR_FILE paraview_v5.10.0_cm323_${DETECTED_OS_VERS}_default.tar.gz) -elseif(APPLE AND "${DETECTED_ARCH}" STREQUAL "arm64") - SET(PARAVIEW_TAR_FILE paraview_v5.10.0_${DETECTED_OS_VERS}_default.tar.gz) else() - SET(PARAVIEW_TAR_FILE paraview_v5.9.0_${DETECTED_OS_VERS}_default.tar.gz) + execute_process(COMMAND bash ${PARAVIEW_BLD_SCRIPT_LOCATION}/build-paraview_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE PARAVIEW_DOWNLOAD_OR_BUILD) + if(${PARAVIEW_DOWNLOAD_OR_BUILD} EQUAL 1) + if(APPLE AND "${DETECTED_ARCH}" STREQUAL "i386") + # The release of cmake 3.23.0 broke our build of ParaView on MacOSX. + # The build was fixed with a reupload and carries the additional tag cm233. + + SET(PARAVIEW_TAR_FILE paraview_v5.10.0_cm323_${DETECTED_OS_VERS_GENERAL}_default.tar.gz) + elseif(APPLE AND "${DETECTED_ARCH}" STREQUAL "arm64") + + SET(PARAVIEW_TAR_FILE paraview_v5.10.0_${DETECTED_OS_VERS_GENERAL}_default.tar.gz) + else() + SET(PARAVIEW_TAR_FILE paraview_v5.9.0_${DETECTED_OS_VERS}_default.tar.gz) + endif() + set(PARAVIEW_SHA_KEY ${DETECTED_OS_VERS}-ParaView) + set(PARAVIEW_SHA ${${PARAVIEW_SHA_KEY}}) + + message(STATUS "Using ParaView tarball : ${PARAVIEW_TAR_FILE}") + message(STATUS "Using ParaView source dir : ${PARAVIEW_SOURCE_DIR}") + message(STATUS "Using ParaView SHA key : ${PARAVIEW_SHA_KEY}") + message(STATUS "Verify ParaView SHA : ${PARAVIEW_SHA}") + + download_verify_extract( + http://cern.ch/biodynamo-lfs/third-party/${PARAVIEW_TAR_FILE} + ${PARAVIEW_SOURCE_DIR} + ${PARAVIEW_SHA} + ) + file(COPY "${CMAKE_SOURCE_DIR}/build/third_party/paraview" DESTINATION "${CMAKE_SOURCE_DIR}/third_party/paraview") + + elseif(${PARAVIEW_DOWNLOAD_OR_BUILD} EQUAL 0) + if(NOT EXISTS "${CMAKE_SOURCE_DIR}/build/third_party") + file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/third_party") + endif() + file(COPY "${CMAKE_SOURCE_DIR}/third_party/paraview" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + if(APPLE) + set(CMAKE_BDM_PVVERSION "5.9") + endif() + + endif() endif() -set(PARAVIEW_SHA_KEY ${DETECTED_OS_VERS}-ParaView) -set(PARAVIEW_SHA ${${PARAVIEW_SHA_KEY}}) - -message(STATUS "Using ParaView tarball : ${PARAVIEW_TAR_FILE}") -message(STATUS "Using ParaView source dir : ${PARAVIEW_SOURCE_DIR}") -message(STATUS "Using ParaView SHA key : ${PARAVIEW_SHA_KEY}") -message(STATUS "Verify ParaView SHA : ${PARAVIEW_SHA}") - -download_verify_extract( - http://cern.ch/biodynamo-lfs/third-party/${PARAVIEW_TAR_FILE} - ${PARAVIEW_SOURCE_DIR} - ${PARAVIEW_SHA} -) diff --git a/cmake/external/Qt.cmake b/cmake/external/Qt.cmake index 2ae195edc..e93cf70cb 100644 --- a/cmake/external/Qt.cmake +++ b/cmake/external/Qt.cmake @@ -1,15 +1,32 @@ include(utils) + SET(QT_SOURCE_DIR "${CMAKE_THIRD_PARTY_DIR}/qt") +SET(QT_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party") +if(NOT EXISTS "${CMAKE_SOURCE_DIR}/build/third_party") + file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/third_party") +endif() + +if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/qt") + file(COPY "${CMAKE_SOURCE_DIR}/third_party/qt" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") +else() + execute_process(COMMAND bash ${QT_BLD_SCRIPT_LOCATION}/build-qt_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE QT_DOWNLOAD_OR_BUILD) + -set(QT_TAR_FILE qt_v5.12.10_${DETECTED_OS_VERS}.tar.gz) -download_verify_extract( - http://cern.ch/biodynamo-lfs/third-party/${QT_TAR_FILE} - ${QT_SOURCE_DIR} - ${${DETECTED_OS_VERS}-Qt} -) + if(${QT_DOWNLOAD_OR_BUILD} EQUAL 1) + set(QT_TAR_FILE qt_v5.12.10_${DETECTED_OS_VERS}.tar.gz) + download_verify_extract( + http://cern.ch/biodynamo-lfs/third-party/${QT_TAR_FILE} + ${QT_SOURCE_DIR} + ${${DETECTED_OS_VERS}-Qt} + ) + elseif(${QT_DOWNLOAD_OR_BUILD} EQUAL 0) + file(COPY "${CMAKE_SOURCE_DIR}/third_party/qt" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + + endif() +endif() # temporal workaround to avoid libprotobuf error for paraview # use only until patched archive has been uploaded IF (NOT APPLE) diff --git a/cmake/external/ROOT.cmake b/cmake/external/ROOT.cmake index 5886b471e..b48680589 100644 --- a/cmake/external/ROOT.cmake +++ b/cmake/external/ROOT.cmake @@ -2,83 +2,99 @@ include(utils) # Directory in which ROOT will be downloaded SET(ROOT_SOURCE_DIR "${CMAKE_THIRD_PARTY_DIR}/root") +SET(ROOT_BLD_SCRIPT_LOCATION "${CMAKE_SOURCE_DIR}/util/build-third-party") +execute_process(COMMAND bash ${ROOT_BLD_SCRIPT_LOCATION}/build-root_new.sh ${CMAKE_SOURCE_DIR} RESULT_VARIABLE ROOT_DOWNLOAD_OR_BUILD) +message(VALUE="${ROOT_DOWNLOAD_OR_BUILD}") +message(VALUE="${ROOT_SOURCE_DIR}") +if(${ROOT_DOWNLOAD_OR_BUILD} EQUAL 1) + set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_${DETECTED_OS_VERS}.tar.gz) + set(ROOT_SHA_KEY ${DETECTED_OS_VERS}-ROOT) + if(APPLE) + if("${DETECTED_OS_VERS}" MATCHES "^osx-15" OR + "${DETECTED_OS_VERS}" MATCHES "^osx-14" OR + "${DETECTED_OS_VERS}" MATCHES "^osx-13" OR + "${DETECTED_OS_VERS}" MATCHES "^osx-12" OR + "${DETECTED_OS_VERS}" MATCHES "^osx-11.6" OR + "${DETECTED_OS_VERS}" MATCHES "^osx-11.7") + execute_process(COMMAND bash "-c" "xcodebuild -version | sed -En 's/Xcode[[:space:]]+([0-9\.]*)/\\1/p'" OUTPUT_VARIABLE XCODE_VERS) + message(STATUS "##### XCODE version: ${XCODE_VERS}") + if("${XCODE_VERS}" GREATER_EQUAL "16.3") + message(STATUS "##### Using ROOT builds for XCODE 16.3") + set(ROOT_TAR_FILE root_v6.34.08_cxx17_python3.9_osx-xcode-16.3-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-16.3-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "16.2") + message(STATUS "##### Using ROOT builds for XCODE 16.2") + set(ROOT_TAR_FILE root_v6.32.08_cxx17_python3.9_osx-xcode-16.2-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-16.2-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "16.1") + message(STATUS "##### Using ROOT builds for XCODE 16.1") + set(ROOT_TAR_FILE root_v6.32.06_cxx17_python3.9_osx-xcode-16.1-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-16.1-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "16.0") + message(STATUS "##### Using ROOT builds for XCODE 16.0") + set(ROOT_TAR_FILE root_v6.33.01_cxx17_python3.9_osx-xcode-16.0-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-16.0-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "15.4") + message(STATUS "##### Using ROOT builds for XCODE 15.4") + set(ROOT_TAR_FILE root_v6.30.06_cxx17_python3.9_osx-xcode-15.4-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-15.4-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "15.3") + message(STATUS "##### Using ROOT builds for XCODE 15.3") + set(ROOT_TAR_FILE root_v6.30.06_cxx17_python3.9_osx-xcode-15.3-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-15.3-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "15.0") + message(STATUS "##### Using ROOT builds for XCODE 15.2") + set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-15.2-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-15.2-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "14.3") + message(STATUS "##### Using ROOT builds for XCODE 14.3") + set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-14.3-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-14.3-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "14.2") + message(STATUS "##### Using ROOT builds for XCODE 14.2") + set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-14.2-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-14.2-${DETECTED_ARCH}-ROOT) + elseif("${XCODE_VERS}" GREATER_EQUAL "14.1") + message(STATUS "##### Using ROOT builds for XCODE 14.1") + set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-14.1-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-14.1-${DETECTED_ARCH}-ROOT) + else() + message(STATUS "##### Using ROOT builds for XCODE 13.1") + set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-13.1-${DETECTED_ARCH}.tar.gz) + set(ROOT_SHA_KEY osx-xcode-13.1-${DETECTED_ARCH}-ROOT) + endif() + elseif("${DETECTED_OS_VERS}" MATCHES "^osx-11") + message(FATAL_ERROR "We officially only support the latest macOS 11 versions 11.6, 11.7.") + endif() + #else() + #if("${DETECTED_OS_VERS}" MATCHES "^ubuntu-23" AND + #"${DETECTED_ARCH}" STREQUAL "aarch64") + #set(ROOT_SHA_KEY ubuntu-23.04-${DETECTED_ARCH}-ROOT) + #set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_ubuntu-23.04-${DETECTED_ARCH}.tar.gz) + # endif() + endif() + set(ROOT_SHA ${${ROOT_SHA_KEY}}) -set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_${DETECTED_OS_VERS}.tar.gz) -set(ROOT_SHA_KEY ${DETECTED_OS_VERS}-ROOT) -if(APPLE) - if("${DETECTED_OS_VERS}" MATCHES "^osx-15" OR - "${DETECTED_OS_VERS}" MATCHES "^osx-14" OR - "${DETECTED_OS_VERS}" MATCHES "^osx-13" OR - "${DETECTED_OS_VERS}" MATCHES "^osx-12" OR - "${DETECTED_OS_VERS}" MATCHES "^osx-11.6" OR - "${DETECTED_OS_VERS}" MATCHES "^osx-11.7") - execute_process(COMMAND bash "-c" "xcodebuild -version | sed -En 's/Xcode[[:space:]]+([0-9\.]*)/\\1/p'" OUTPUT_VARIABLE XCODE_VERS) - message(STATUS "##### XCODE version: ${XCODE_VERS}") - if("${XCODE_VERS}" GREATER_EQUAL "16.2") - message(STATUS "##### Using ROOT builds for XCODE 16.2") - set(ROOT_TAR_FILE root_v6.32.08_cxx17_python3.9_osx-xcode-16.2-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-16.2-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "16.1") - message(STATUS "##### Using ROOT builds for XCODE 16.1") - set(ROOT_TAR_FILE root_v6.32.06_cxx17_python3.9_osx-xcode-16.1-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-16.1-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "16.0") - message(STATUS "##### Using ROOT builds for XCODE 16.0") - set(ROOT_TAR_FILE root_v6.33.01_cxx17_python3.9_osx-xcode-16.0-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-16.0-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "15.4") - message(STATUS "##### Using ROOT builds for XCODE 15.4") - set(ROOT_TAR_FILE root_v6.30.06_cxx17_python3.9_osx-xcode-15.4-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-15.4-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "15.3") - message(STATUS "##### Using ROOT builds for XCODE 15.3") - set(ROOT_TAR_FILE root_v6.30.06_cxx17_python3.9_osx-xcode-15.3-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-15.3-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "15.0") - message(STATUS "##### Using ROOT builds for XCODE 15.2") - set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-15.2-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-15.2-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "14.3") - message(STATUS "##### Using ROOT builds for XCODE 14.3") - set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-14.3-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-14.3-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "14.2") - message(STATUS "##### Using ROOT builds for XCODE 14.2") - set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-14.2-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-14.2-${DETECTED_ARCH}-ROOT) - elseif("${XCODE_VERS}" GREATER_EQUAL "14.1") - message(STATUS "##### Using ROOT builds for XCODE 14.1") - set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-14.1-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-14.1-${DETECTED_ARCH}-ROOT) - else() - message(STATUS "##### Using ROOT builds for XCODE 13.1") - set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_osx-xcode-13.1-${DETECTED_ARCH}.tar.gz) - set(ROOT_SHA_KEY osx-xcode-13.1-${DETECTED_ARCH}-ROOT) - endif() - elseif("${DETECTED_OS_VERS}" MATCHES "^osx-11") - message(FATAL_ERROR "We officially only support the latest macOS 11 versions 11.6, 11.7.") - endif() -#else() - #if("${DETECTED_OS_VERS}" MATCHES "^ubuntu-23" AND - #"${DETECTED_ARCH}" STREQUAL "aarch64") - #set(ROOT_SHA_KEY ubuntu-23.04-${DETECTED_ARCH}-ROOT) - #set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_ubuntu-23.04-${DETECTED_ARCH}.tar.gz) -# endif() -endif() -set(ROOT_SHA ${${ROOT_SHA_KEY}}) + message(STATUS "Using ROOT tarball : ${ROOT_TAR_FILE}") + message(STATUS "Using ROOT source dir : ${ROOT_SOURCE_DIR}") + message(STATUS "Using ROOT SHA key : ${ROOT_SHA_KEY}") + message(STATUS "Verify ROOT SHA : ${ROOT_SHA}") + + download_verify_extract( + http://cern.ch/biodynamo-lfs/third-party/${ROOT_TAR_FILE} + ${ROOT_SOURCE_DIR} + ${ROOT_SHA} + ) -message(STATUS "Using ROOT tarball : ${ROOT_TAR_FILE}") -message(STATUS "Using ROOT source dir : ${ROOT_SOURCE_DIR}") -message(STATUS "Using ROOT SHA key : ${ROOT_SHA_KEY}") -message(STATUS "Verify ROOT SHA : ${ROOT_SHA}") -download_verify_extract( - http://cern.ch/biodynamo-lfs/third-party/${ROOT_TAR_FILE} - ${ROOT_SOURCE_DIR} - ${ROOT_SHA} -) +endif() # Run again find_package in order to find ROOT +if(${ROOT_DOWNLOAD_OR_BUILD} EQUAL 0) + file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/third_party") + file(COPY "${CMAKE_SOURCE_DIR}/third_party/root" DESTINATION "${CMAKE_SOURCE_DIR}/build") +endif() + find_package(ROOT COMPONENTS Geom Gui GenVector REQUIRED) # Set ROOTSYS variable diff --git a/cmake/external/SHA256Digests.cmake b/cmake/external/SHA256Digests.cmake index 1f584b16d..78e449bcf 100644 --- a/cmake/external/SHA256Digests.cmake +++ b/cmake/external/SHA256Digests.cmake @@ -96,6 +96,8 @@ SET(osx-xcode-16.1-i386-ROOT 5d8261b8a694151c802d9de2957e91380b31ddb2fa5c1028ed4 SET(osx-xcode-16.1-arm64-ROOT b339a8fac8e360087e533a30b4cd1d2a8059ec84d5826a3f9c8c64109fff1c41) SET(osx-xcode-16.2-i386-ROOT b0be8291d14c0c66f250297e524debc1d6888a95da32e80918fc51c5c582fc8b) SET(osx-xcode-16.2-arm64-ROOT 4cd66eca15c97b3ffbf159fb7aeb728483c745b275ef89b3679812561cf0e346) +SET(osx-xcode-16.3-i386-ROOT b0be8291d14c0c66f250297e524debc1d6888a95da32e80918fc51c5c582fc8b) +SET(osx-xcode-16.3-arm64-ROOT 6021e4d3b2ef5e75f8cb888f373917162f68385d1475dda135081f8cf5bf54a3) SET(ubuntu-18.04-Libroadrunner bf9293c1c95d0b65227bd7e08c0048116ba851bcec5028ef72ea13762ef79276) SET(ubuntu-18.04-ParaView e3fd74b13e9a4086988c5104c6b8d95c56365d25b491706a8e72018d0e5c76f1) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 2dd29ef4f..f7ae7c6d5 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -23,11 +23,16 @@ function(detect_os) execute_process(COMMAND sw_vers "-productVersion" COMMAND cut -d . -f 1-2 OUTPUT_VARIABLE MACOS_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND sw_vers -productVersion + COMMAND cut -d . -f 1 + COMMAND awk "{print $1 \".0\"}" + OUTPUT_VARIABLE MACOS_VERSION_GENERAL OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND arch OUTPUT_VARIABLE MACOS_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) set(BDM_OS "osx") set(DETECTED_OS "${BDM_OS}" PARENT_SCOPE) set(DETECTED_ARCH "${MACOS_ARCH}" PARENT_SCOPE) + set(DETECTED_OS_VERS_GENERAL "${BDM_OS}-${MACOS_VERSION_GENERAL}-${MACOS_ARCH}" PARENT_SCOPE) set(DETECTED_OS_VERS "${BDM_OS}-${MACOS_VERSION}-${MACOS_ARCH}" PARENT_SCOPE) else() set(GET_OS_ID "echo $(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '\"')") @@ -59,6 +64,7 @@ endfunction() # If a user installed ROOT is found we will check if ROOT # was compiled using c++17. function(verify_ROOT) + if(ROOT_FOUND AND CMAKE_THIRD_PARTY_DIR) # check if found ROOT is BDM installed (matchres > -1) string(FIND ${ROOT_INCLUDE_DIRS} ${CMAKE_THIRD_PARTY_DIR} matchres) @@ -93,12 +99,12 @@ function(verify_ROOT) endif() endif() if(NOT ROOT_FOUND) - print_warning() - message("We did not find any ROOT installed on the system. We will proceed to download it. " + print_warning() + message("We did not find any ROOT installed on the system. We will proceed to build or download it." "ROOT will be installed in the location ${CMAKE_THIRD_PARTY_DIR}/root.") - print_line() + print_line() include(external/ROOT) - + # Propagate the needed variables to the parent SET(ROOT_FOUND ${ROOT_FOUND} PARENT_SCOPE) SET(ROOT_VERSION ${ROOT_VERSION} PARENT_SCOPE) @@ -120,6 +126,10 @@ function(verify_ROOT) if (NOT DEFINED ROOTSYS OR NOT DEFINED ${ROOTSYS}) # Set ROOTSYS variable + if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/root") + file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/third_party") + file(COPY "${CMAKE_SOURCE_DIR}/third_party/root" DESTINATION "${CMAKE_SOURCE_DIR}/build/third_party") + endif() string(REGEX REPLACE "/include$" "" TMP_ROOT_PATH ${ROOT_INCLUDE_DIRS}) set(ENV{ROOTSYS} ${TMP_ROOT_PATH}) endif() @@ -226,6 +236,7 @@ function(install_inside_build) DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} GLOB "*.h" "*.cl" "*.py" ) + add_copy_files(copy_files_bdm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_SOURCE_DIR}/third_party/omp/omp.h diff --git a/install.sh b/install.sh index 48fc19759..8a3bc278a 100755 --- a/install.sh +++ b/install.sh @@ -33,16 +33,16 @@ BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Detect the OS (or get the one the user specified) if [ -z $1 ]; then - BDM_DETECTED_OS=$(DetectOs) + BDM_DETECTED_GEN_OS=$(DetectOs2) else - BDM_DETECTED_OS=$1 + BDM_DETECTED_GEN_OS=$1 fi # Install all prerequisites -$BDM_PROJECT_DIR/prerequisites.sh all ${BDM_DETECTED_OS} +$BDM_PROJECT_DIR/prerequisites.sh all ${BDM_DETECTED_GEN_OS} if [ $? != 0 ]; then exit 1 fi # call install script for the detected OS -$BDM_PROJECT_DIR/util/installation/common/install.sh ${BDM_DETECTED_OS} +$BDM_PROJECT_DIR/util/installation/common/install.sh ${BDM_DETECTED_GEN_OS} diff --git a/prerequisites.sh b/prerequisites.sh index 84e7c4214..5681b4907 100755 --- a/prerequisites.sh +++ b/prerequisites.sh @@ -49,7 +49,7 @@ BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Detect the OS if [ -z $2 ]; then - BDM_DETECTED_OS=$(DetectOs) + BDM_DETECTED_OS=$(DetectOs2) else BDM_DETECTED_OS=$2 fi diff --git a/third_party/ParaView-v5.9.0.tar.xz b/third_party/ParaView-v5.9.0.tar.xz new file mode 100644 index 000000000..f0a553c1c Binary files /dev/null and b/third_party/ParaView-v5.9.0.tar.xz differ diff --git a/third_party/brew_formulae/cmake.rb b/third_party/brew_formulae/cmake.rb new file mode 100644 index 000000000..75a619ace --- /dev/null +++ b/third_party/brew_formulae/cmake.rb @@ -0,0 +1,61 @@ +class Cmake < Formula + desc "Cross-platform make" + homepage "https://www.cmake.org/" + url "https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3.tar.gz" + sha256 "3faca7c131494a1e34d66e9f8972ff5369e48d419ea8ceaa3dc15b4c11367732" + license "BSD-3-Clause" + head "https://gitlab.kitware.com/cmake/cmake.git" + + livecheck do + url :stable + strategy :github_latest + end + + bottle do + sha256 cellar: :any_skip_relocation, arm64_big_sur: "ae145ddaf2b17c3a02cf76f06cb217fae88a0a009e409de00fa1b347a00b0c16" + sha256 cellar: :any_skip_relocation, big_sur: "474ab1548e4909a2565f44c46f90d03061211f695403419aedc2d7a2b71f1db0" + sha256 cellar: :any_skip_relocation, catalina: "4119d81cfa8435976e667af76a8b79a35f34d97aab69b646b2356eb69b8edf78" + sha256 cellar: :any_skip_relocation, mojave: "2b2cee31bfce62a116567bc295eca855b008630aafee860051aaa599eac7d657" + end + + + uses_from_macos "ncurses" + + on_linux do + depends_on "openssl@1.1" + end + + # The completions were removed because of problems with system bash + + # The `with-qt` GUI option was removed due to circular dependencies if + # CMake is built with Qt support and Qt is built with MySQL support as MySQL uses CMake. + # For the GUI application please instead use `brew install --cask cmake`. + + def install + args = %W[ + --prefix=#{prefix} + --no-system-libs + --parallel=#{ENV.make_jobs} + --datadir=/share/cmake + --docdir=/share/doc/cmake + --mandir=/share/man + ] + on_macos do + args += %w[ + --system-zlib + --system-bzip2 + --system-curl + ] + end + + system "./bootstrap", *args, "--", *std_cmake_args, + "-DCMake_INSTALL_EMACS_DIR=#{elisp}" + system "make" + system "make", "install" + end + + test do + (testpath/"CMakeLists.txt").write("find_package(Ruby)") + system bin/"cmake", "." + end +end diff --git a/third_party/brew_formulae/open-mpi.rb b/third_party/brew_formulae/open-mpi.rb new file mode 100644 index 000000000..401299345 --- /dev/null +++ b/third_party/brew_formulae/open-mpi.rb @@ -0,0 +1,129 @@ +class OpenMpi < Formula + desc "High performance message passing library" + homepage "https://www.open-mpi.org/" + url "https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.7.tar.bz2" + sha256 "7d3ecc8389161eb721982c855f89c25dca289001577a01a439ae97ce872be997" + license "BSD-3-Clause" + + livecheck do + url :homepage + regex(/MPI v?(\d+(?:\.\d+)+) release/i) + end + + bottle do + sha256 arm64_big_sur: "6134b45b6faa235377c5cd017b58393a0a124936c81a14da9902604671143ca8" + sha256 big_sur: "2afe47eb2c9664599a1bf8687d0244a9b9067bc96e3de184cdee8e3110fa8012" + sha256 catalina: "fd21d8d449c7fee6126f11994b6e0d12178b1eab55cbb17f99056d535cb1ace4" + sha256 mojave: "f3a7dca683792a4fe866b62004351b1dae6acf2376609cf36bdc771d9e9104ef" + sha256 high_sierra: "33d3cd119f7f7d7d3154d758cc0ad68ad513624c9a648c9b87d732ea6a8e6068" + end + + head do + url "https://github.com/open-mpi/ompi.git" + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "libtool" => :build + end + + # Regenerate for Big Sur due to configure issues + # https://github.com/open-mpi/ompi/issues/8218 + if MacOS.version >= :big_sur + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "libtool" => :build + end + + depends_on "gcc@11" + depends_on "hwloc" + depends_on "libevent" + + conflicts_with "mpich", because: "both install MPI compiler wrappers" + + def install + if MacOS.version == :big_sur + # Fix for current GCC on Big Sur, which does not like 11 as version value + # (reported at https://github.com/iains/gcc-darwin-arm64/issues/31#issuecomment-750343944) + ENV["MACOSX_DEPLOYMENT_TARGET"] = "11.0" + else + # Otherwise libmpi_usempi_ignore_tkr gets built as a static library + ENV["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version + end + + # Avoid references to the Homebrew shims directory + %w[ + ompi/tools/ompi_info/param.c + orte/tools/orte-info/param.c + oshmem/tools/oshmem_info/param.c + opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/support.c + ].each do |fname| + inreplace fname, /(OPAL|PMIX)_CC_ABSOLUTE/, "\"#{ENV.cc}\"" + end + + %w[ + ompi/tools/ompi_info/param.c + oshmem/tools/oshmem_info/param.c + ].each do |fname| + inreplace fname, "OMPI_CXX_ABSOLUTE", "\"#{ENV.cxx}\"" + end + + ENV.cxx11 + + args = %W[ + --prefix=#{prefix} + --disable-dependency-tracking + --disable-silent-rules + --enable-ipv6 + --enable-mca-no-build=reachable-netlink + --with-libevent=#{Formula["libevent"].opt_prefix} + --with-sge + ] + args << "--with-platform-optimized" if build.head? + + system "./autogen.pl", "--force" if build.head? || MacOS.version >= :big_sur + system "./configure", *args + system "make", "all" + system "make", "check" + system "make", "install" + + # Fortran bindings install stray `.mod` files (Fortran modules) in `lib` + # that need to be moved to `include`. + include.install Dir["#{lib}/*.mod"] + end + + test do + (testpath/"hello.c").write <<~EOS + #include + #include + + int main() + { + int size, rank, nameLen; + char name[MPI_MAX_PROCESSOR_NAME]; + MPI_Init(NULL, NULL); + MPI_Comm_size(MPI_COMM_WORLD, &size); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Get_processor_name(name, &nameLen); + printf("[%d/%d] Hello, world! My name is %s.\\n", rank, size, name); + MPI_Finalize(); + return 0; + } + EOS + system bin/"mpicc", "hello.c", "-o", "hello" + system "./hello" + system bin/"mpirun", "./hello" + (testpath/"hellof.f90").write <<~EOS + program hello + include 'mpif.h' + integer rank, size, ierror, tag, status(MPI_STATUS_SIZE) + call MPI_INIT(ierror) + call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror) + call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror) + print*, 'node', rank, ': Hello Fortran world' + call MPI_FINALIZE(ierror) + end + EOS + system bin/"mpif90", "hellof.f90", "-o", "hellof" + system "./hellof" + system bin/"mpirun", "./hellof" + end +end diff --git a/third_party/catalyst-for-paraview-5.9.tar.gz b/third_party/catalyst-for-paraview-5.9.tar.gz new file mode 100644 index 000000000..28d076ee9 Binary files /dev/null and b/third_party/catalyst-for-paraview-5.9.tar.gz differ diff --git a/third_party/gcc-11.5.0.tar.xz b/third_party/gcc-11.5.0.tar.xz new file mode 100644 index 000000000..b72124e01 Binary files /dev/null and b/third_party/gcc-11.5.0.tar.xz differ diff --git a/third_party/nest-simulator-3.8.tar.gz b/third_party/nest-simulator-3.8.tar.gz new file mode 100644 index 000000000..e28e952ad Binary files /dev/null and b/third_party/nest-simulator-3.8.tar.gz differ diff --git a/third_party/qtbase-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtbase-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..1d4a1af94 Binary files /dev/null and b/third_party/qtbase-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qtimageformats-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qtimageformats-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..dd121dbb9 Binary files /dev/null and b/third_party/qtmodules/qtimageformats-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qtknx-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qtknx-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..e3332bae5 Binary files /dev/null and b/third_party/qtmodules/qtknx-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qtmqtt-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qtmqtt-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..5731f8ac2 Binary files /dev/null and b/third_party/qtmodules/qtmqtt-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qtmultimedia-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qtmultimedia-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..56134a1d4 Binary files /dev/null and b/third_party/qtmodules/qtmultimedia-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qtsvg-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qtsvg-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..01d9a5db0 Binary files /dev/null and b/third_party/qtmodules/qtsvg-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qttools-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qttools-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..0f2081d40 Binary files /dev/null and b/third_party/qtmodules/qttools-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qtwayland-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qtwayland-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..979a74ad9 Binary files /dev/null and b/third_party/qtmodules/qtwayland-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/qtmodules/qtxmlpatterns-everywhere-opensource-src-5.15.16.tar.xz b/third_party/qtmodules/qtxmlpatterns-everywhere-opensource-src-5.15.16.tar.xz new file mode 100644 index 000000000..6d64a1796 Binary files /dev/null and b/third_party/qtmodules/qtxmlpatterns-everywhere-opensource-src-5.15.16.tar.xz differ diff --git a/third_party/root63002.patch b/third_party/root63002.patch new file mode 100644 index 000000000..2c3edce88 --- /dev/null +++ b/third_party/root63002.patch @@ -0,0 +1,87 @@ +From a028d13255f0c2d0c84f2e1b99ccb6a112598e0c Mon Sep 17 00:00:00 2001 +From: silverweed +Date: Thu, 17 Oct 2024 16:34:59 +0200 +Subject: [PATCH] [graf3d] use the proper (unsigned) type in FTContour + +Freetype 2.13.3 changed the type of a data member from char* to +unsigned char*, so we need to pass the correct type to FTContour to +avoid compiler warnings +--- + graf3d/ftgl/inc/FTContour.h | 11 ++++++++++- + graf3d/ftgl/src/FTContour.cxx | 10 +++++----- + graf3d/ftgl/src/FTVectoriser.cxx | 2 +- + 3 files changed, 16 insertions(+), 7 deletions(-) + +diff --git a/graf3d/ftgl/inc/FTContour.h b/graf3d/ftgl/inc/FTContour.h +index 8eb5132165f7b..15d7e0ccc42c7 100644 +--- a/graf3d/ftgl/inc/FTContour.h ++++ b/graf3d/ftgl/inc/FTContour.h +@@ -18,6 +18,15 @@ + class FTGL_EXPORT FTContour + { + public: ++ #define FREETYPE_VER_HEX ((FREETYPE_MAJOR << 16) | (FREETYPE_MINOR << 8) | (FREETYPE_PATCH)) ++ #if FREETYPE_VER_HEX >= 0x20d03 ++ // enabled from 2.13.3 ++ using PointTag_t = unsigned char; ++ #else ++ using PointTag_t = char; ++ #endif ++ #undef FREETYPE_VER_HEX ++ + /** + * Constructor + * +@@ -25,7 +34,7 @@ class FTGL_EXPORT FTContour + * @param pointTags + * @param numberOfPoints + */ +- FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints); ++ FTContour( FT_Vector* contour, PointTag_t* pointTags, unsigned int numberOfPoints); + + /** + * Destructor +diff --git a/graf3d/ftgl/src/FTContour.cxx b/graf3d/ftgl/src/FTContour.cxx +index 76ada3c9c7353..4234cdebe336b 100644 +--- a/graf3d/ftgl/src/FTContour.cxx ++++ b/graf3d/ftgl/src/FTContour.cxx +@@ -70,11 +70,11 @@ void FTContour::evaluateCubicCurve() + } + + +-FTContour::FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints) ++FTContour::FTContour( FT_Vector* contour, PointTag_t* pointTags, unsigned int numberOfPoints) + { + for( unsigned int pointIndex = 0; pointIndex < numberOfPoints; ++ pointIndex) + { +- char pointTag = pointTags[pointIndex]; ++ PointTag_t pointTag = pointTags[pointIndex]; + + if( pointTag == FT_Curve_Tag_On || numberOfPoints < 2) + { +@@ -93,9 +93,9 @@ FTContour::FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOf + + if( pointTag == FT_Curve_Tag_Conic) + { +- char nextPointTag = ( pointIndex == numberOfPoints - 1) +- ? pointTags[0] +- : pointTags[pointIndex + 1]; ++ PointTag_t nextPointTag = ( pointIndex == numberOfPoints - 1) ++ ? pointTags[0] ++ : pointTags[pointIndex + 1]; + + while( nextPointTag == FT_Curve_Tag_Conic) + { +diff --git a/graf3d/ftgl/src/FTVectoriser.cxx b/graf3d/ftgl/src/FTVectoriser.cxx +index df32ac2f8300c..0b1f3c0fd3aca 100644 +--- a/graf3d/ftgl/src/FTVectoriser.cxx ++++ b/graf3d/ftgl/src/FTVectoriser.cxx +@@ -140,7 +140,7 @@ void FTVectoriser::ProcessContours() + for( short contourIndex = 0; contourIndex < ftContourCount; ++contourIndex) + { + FT_Vector* pointList = &outline.points[startIndex]; +- char* tagList = &outline.tags[startIndex]; ++ auto* tagList = &outline.tags[startIndex]; + + endIndex = outline.contours[contourIndex]; + contourLength = ( endIndex - startIndex) + 1; diff --git a/util/build-third-party/build-gcc_new.sh b/util/build-third-party/build-gcc_new.sh new file mode 100755 index 000000000..431f82b92 --- /dev/null +++ b/util/build-third-party/build-gcc_new.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script builds GCC. + The archive will be stored in BDM_PROJECT_DIR/build/gcc.tar.gz +Arguments: + \$1 BDM_PROJECT_DIR" 1>&2; + exit 2 +fi + +GCC_VERSION_TXZ=gcc-11.5.0 + + +BDM_PROJECT_DIR=$1 + + +# import util functions +. $BDM_PROJECT_DIR/util/installation/common/util.sh + +GCC_INSTALL_DIR=$BDM_PROJECT_DIR/third_party/gcc + +GCC_TXZ_FILE=$BDM_PROJECT_DIR/third_party/$GCC_VERSION_TXZ.tar.xz + +build_gcc(){ + +DEST_DIR=$BDM_PROJECT_DIR/build/build-third-party/build_gcc +rm -rf $DEST_DIR +rm -rf $GCC_INSTALL_DIR +mkdir -p $DEST_DIR +mkdir -p $GCC_INSTALL_DIR +tar -Jxvf $GCC_TXZ_FILE -C $DEST_DIR --strip-components=1 +cd $DEST_DIR +./configure --disable-multilib --prefix="$GCC_INSTALL_DIR" +make -j$(CPUCount) +make install +return +} + +SPECIFIC_BDM_OS=$(DetectOs) + +DEFAULT_GCCBD_OPTION="Yes" + +if echo "$SPECIFIC_OSES_SUPPORTED" | grep -Eiq "$SPECIFIC_BDM_OS" ; then + DEFAULT_GCCBD_OPTION="No" +fi + +while true; do + read -p "Do you want to build GCC or use your platform's default version? (Y(Yes/build) / N(No/default)) +Default option for your platform: ($DEFAULT_GCCBD_OPTION): " GCCBD_ANS + + case $GCCBD_ANS in + [yY] ) echo "Building GCC:" 1>&2; + build_gcc + exit 0;; + [nN] ) echo "Using default GCC" 1>&2; + exit 0;; + "" ) echo "Initiating default option ($DEFAULT_GCCBD_OPTION): " 1>&2; + if [ "$DEFAULT_GCCBD_OPTION" == "Yes" ]; then + echo "Building GCC" 1>&2; + build_gcc + exit 0 + elif [ "$DEFAULT_GCCBD_OPTION" == "No" ]; then + echo "Using default GCC:" 1>&2; + exit 0 + fi ;; + * ) echo "Please answer yes (Y/y) or no (N/n) " 1>&2;; + esac + + +done diff --git a/util/build-third-party/build-nest_new.sh b/util/build-third-party/build-nest_new.sh new file mode 100755 index 000000000..4f68e3503 --- /dev/null +++ b/util/build-third-party/build-nest_new.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script builds NEST. + The archive will be stored in BDM_PROJECT_DIR/build/.tar.gz +Arguments: + \$1 BDM_PROJECT_DIR" 1>&2; + exit 2 +fi + +NEST_VERSION_TGZ=nest-simulator-3.8 + + +PYV2=`echo $PYVERS | cut -d . -f 1-2` + +BDM_PROJECT_DIR=$1 + + +# import util functions +. $BDM_PROJECT_DIR/util/installation/common/util.sh + +NEST_INSTALL_DIR=$BDM_PROJECT_DIR/third_party/nest + +NEST_TGZ_FILE=$BDM_PROJECT_DIR/third_party/$NEST_VERSION_TGZ.tar.gz + +build_NEST(){ +BDM_OS=$(DetectOs2) +PYTH="" +FEATURES="" +brewpy=no +if [ $BDM_OS == "osx" ]; then + brewpy=yes + if [ $brewpy == "yes" ]; then + PYTH="$(brew --prefix)/bin/python${PYV2}" + else + export PYENV_NEST=$(brew --prefix)/opt/.pyenv + eval "$(pyenv init -)" + pyenv shell $PYVERS + PYTH="`pyenv which python`" + fi +else + PYTH="`pyenv which python`" +fi +DEST_DIR=$BDM_PROJECT_DIR/build/build-third-party/build_nest +rm -rf $DEST_DIR +rm -rf $NEST_INSTALL_DIR +mkdir -p $DEST_DIR +mkdir -p $NEST_INSTALL_DIR +if ! [ -e $NEST_TGZ_FILE ]; then + curl -o $NEST_TGZ_FILE https://github.com/nest/nest-simulator/archive/refs/tags/v3.8.tar.gz +fi +tar -xvzf $NEST_TGZ_FILE -C $DEST_DIR --strip-components=1 +cd $DEST_DIR +mkdir obj +cd obj +echo $PYTH +cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL_DIR .. +cmake --build . --parallel $(CPUCount) --target install + +return +} +build_NEST +exit 0; + +done diff --git a/util/build-third-party/build-paraview_new.sh b/util/build-third-party/build-paraview_new.sh new file mode 100755 index 000000000..24b5eb30c --- /dev/null +++ b/util/build-third-party/build-paraview_new.sh @@ -0,0 +1,133 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script builds ParaView. + The archive will be stored in BDM_PROJECT_DIR/build/PARAVIEW.tar.gz +Arguments: + \$1 BDM_PROJECT_DIR" 1>&2; + exit 2 +fi + +PARAVIEW_VERSION_TXZ=ParaView-v5.9.0 +CATALYST_VERSTON_TGZ=catalyst-for-paraview-5.9 +BDM_PROJECT_DIR=$1 + + +# import util functions +. $BDM_PROJECT_DIR/util/installation/common/util.sh + +PARAVIEW_INSTALL_DIR=$BDM_PROJECT_DIR/third_party/paraview +CATALYST_TGZ_FILE=$BDM_PROJECT_DIR/third_party/$CATALYST_VERSTON_TGZ.tar.gz +PARAVIEW_TXZ_FILE=$BDM_PROJECT_DIR/third_party/$PARAVIEW_VERSION_TXZ.tar.xz + +build_paraview(){ +FEATURES="" +PYTH="" +BDM_OS=$(DetectOs2) +brewpy=no + +if [ $BDM_OS == "osx" ]; then + brewpy=yes + if [ $brewpy == "yes" ]; then + PYTH="$(brew --prefix)/bin/python${PYV2}" + else + export PYENV_ROOT=$(brew --prefix)/opt/.pyenv + eval "$(pyenv init -)" + pyenv shell $PYVERS + PYTH="`pyenv which python`" + fi + +else + PYTH="`pyenv which python`" +fi + +DEST_DIR=$BDM_PROJECT_DIR/build/build-third-party/build_paraview + + + +rm -rf $DEST_DIR +rm -rf $PARAVIEW_INSTALL_DIR +mkdir -p $DEST_DIR +mkdir -p $DEST_DIR/catalyst +mkdir -p $PARAVIEW_INSTALL_DIR +mkdir -p $PARAVIEW_INSTALL_DIR/catalyst +tar -xvzf $CATALYST_TGZ_FILE -C $DEST_DIR/catalyst --strip-components=1 +tar -Jxvf $PARAVIEW_TXZ_FILE -C $DEST_DIR --strip-components=1 +if [ $BDM_OS == "osx" ]; then + if [ -d $BDM_PROJECT_DIR/build/third_party/qt ]; then + export Qt5_DIR=$BDM_PROJECT_DIR/build/third_party/qt + else + export Qt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5 + fi +else + export Qt5_DIR=$BDM_PROJECT_DIR/build/third_party/qt +fi +cd $DEST_DIR/catalyst +mkdir obj +cd obj +cmake -DCMAKE_INSTALL_PREFIX=$PARAVIEW_INSTALL_DIR/catalyst .. +make -j$(CPUCount) +make install +cd $DEST_DIR +mkdir obj +cd obj +export catalyst_DIR=$PARAVIEW_INSTALL_DIR/catalyst +cmake -DENABLE_ospray:BOOL=ON -DENABLE_ospraymaterials:BOOL=ON -DENABLE_paraviewsdk:BOOL=ON -DPARAVIEW_USE_PYTHON=YES -DPARAVIEW_USE_CATALYST=YES -DPARAVIEW_ENABLE_CATALYST=YES -DPARAVIEW_ENABLE_NONESSENTIAL=YES -DPARAVIEW_USE_MPI=ON -DVTK_MODULE_ENABLE_ParaView_Catalyst=YES -DVTK_MODULE_ENABLE_ParaView_PythonCatalyst=YES -DPYTHON_EXECUTABLE="$PYTH" -DCMAKE_INSTALL_PREFIX=$PARAVIEW_INSTALL_DIR .. +make -j$(CPUCount) +make install +return +} + + +SPECIFIC_BDM_OS=$(DetectOs) + +DEFAULT_PARAVIEWBD_OPTION="Yes" + +if echo "$SPECIFIC_OSES_SUPPORTED" | grep -Eiq "$SPECIFIC_BDM_OS" ; then + DEFAULT_PARAVIEWBD_OPTION="No" +fi + +while true; do + read -p "Do you want to build, download or offer provided ParaView? (Y(Yes/build) / N(No/download)) +Default option for your platform: ($DEFAULT_PARAVIEWBD_OPTION): " PARAVIEWBD_ANS + + case $PARAVIEWBD_ANS in + [yY] ) echo "Building ParaView:" 1>&2; + build_paraview + exit 0;; + [nN] ) echo "Downloading ParaView:" 1>&2; + exit 1;; + #[pP] ) echo "Extracting Provided ParaView:" 1>&2; + # exit 3 ;; + "" ) echo "Initiating default option ($DEFAULT_PARAVIEWBD_OPTION): " 1>&2; + if [ "$DEFAULT_PARAVIEWBD_OPTION" == "Yes" ]; then + echo "Building ParaView:" 1>&2; + build_paraview + exit 0 + elif [ "$DEFAULT_PARAVIEWBD_OPTION" == "No" ]; then + echo "Downloading ParaView:" 1>&2; + exit 1 + elif [ "$DEFAULT_PARAVIEWBD_OPTION" == "Prov" ]; then + echo "Extracting Provided ParaView:" 1>&2; + exit 3 + fi ;; + * ) echo "Please answer yes (Y/y) or no (N/n) " 1>&2;; + esac + + +done diff --git a/util/build-third-party/build-qt_new.sh b/util/build-third-party/build-qt_new.sh new file mode 100755 index 000000000..1b80dcc35 --- /dev/null +++ b/util/build-third-party/build-qt_new.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script builds QT. + The archive will be stored in BDM_PROJECT_DIR/build/QT.tar.gz +Arguments: + \$1 BDM_PROJECT_DIR" 1>&2; + exit 2 +fi + +QT_VERSION_TXZ=qtbase-everywhere-opensource-src-5.15.16 + +BDM_PROJECT_DIR=$1 + + +# import util functions +. $BDM_PROJECT_DIR/util/installation/common/util.sh + +QT_INSTALL_DIR=$BDM_PROJECT_DIR/third_party/qt + +QT_TXZ_FILE=$BDM_PROJECT_DIR/third_party/$QT_VERSION_TXZ.tar.xz +declare -a QT_MODULE_TXZ=("qtsvg-everywhere-opensource-src-5.15.16" "qtxmlpatterns-everywhere-opensource-src-5.15.16" "qttools-everywhere-opensource-src-5.15.16" "qtwayland-everywhere-opensource-src-5.15.16" "qtmultimedia-everywhere-opensource-src-5.15.16" "qtmqtt-everywhere-opensource-src-5.15.16" "qtknx-everywhere-opensource-src-5.15.16" "qtimageformats-everywhere-opensource-src-5.15.16") + +build_qt(){ +BDM_OS=$(DetectOs2) + +DEST_DIR=$BDM_PROJECT_DIR/build/build-third-party/build_qt +rm -rf $DEST_DIR +rm -rf $QT_INSTALL_DIR +mkdir -p $DEST_DIR +tar -Jxvf $QT_TXZ_FILE -C $DEST_DIR --strip-components=1 +cd $DEST_DIR +sed -i 's@/usr/local/Qt-$\$\[QT_VERSION]@/usr/local/Qt@g' configure.pri +sed -i "s@/usr/local/Qt@$QT_INSTALL_DIR@g" configure.pri +./configure -xcb -xcb-xlib -bundled-xcb-xinput -opensource -confirm-license +make -j$(CPUCount) +make install +QMAKE_BIN=$QT_INSTALL_DIR/bin/qmake +arraylength=${#QT_MODULE_TXZ[@]} +for((i=0; i<${arraylength}; i++)); + do + mkdir $BDM_PROJECT_DIR/build/build-third-party/build_qt_module_$i + tar -Jxvf $BDM_PROJECT_DIR/third_party/qtmodules/${QT_MODULE_TXZ[$i]}.tar.xz -C $BDM_PROJECT_DIR/build/build-third-party/build_qt_module_$i --strip-components=1 + cd $BDM_PROJECT_DIR/build/build-third-party/build_qt_module_$i + $QMAKE_BIN . + make -j$(CPUCount) + make install +done +return +} + +SPECIFIC_BDM_OS=$(DetectOs) + +DEFAULT_QTBD_OPTION="Yes" + +if echo "$SPECIFIC_OSES_SUPPORTED" | grep -Eiq "$SPECIFIC_BDM_OS" ; then + DEFAULT_QTBD_OPTION="No" +fi + +while true; do + read -p "Do you want to build or download QT? (Y(Yes/build) / N(No/download)) +Default option for your platform: ($DEFAULT_QTBD_OPTION): " QTBD_ANS + + case $QTBD_ANS in + [yY] ) echo "Building QT:" 1>&2; + build_qt + exit 0;; + [nN] ) echo "Downloading QT:" 1>&2; + exit 1;; + "" ) echo "Initiating default option ($DEFAULT_QTBD_OPTION): " 1>&2; + if [ "$DEFAULT_QTBD_OPTION" == "Yes" ]; then + echo "Building QT:" 1>&2; + build_qt + exit 0 + elif [ "$DEFAULT_QTBD_OPTION" == "No" ]; then + echo "Downloading QT:" 1>&2; + exit 1 + fi ;; + * ) echo "Please answer yes (Y/y) or no (N/n) " 1>&2;; + esac + + +done diff --git a/util/build-third-party/build-roadrunner_new.sh b/util/build-third-party/build-roadrunner_new.sh new file mode 100755 index 000000000..0ec5556f0 --- /dev/null +++ b/util/build-third-party/build-roadrunner_new.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +if [[ $# -ne 1 ]]; then + + echo "ERROR: Wrong number of arguments. + Description: + This Script builds Libroadrunner. + Arguments: + \$1 BDM_PROJECT_DIR" 1>&2; + exit 2 +fi + + +BDM_PROJECT_DIR=$1 + + +. $BDM_PROJECT_DIR/util/installation/common/util.sh + +LLRR_INSTALL_DIR=$BDM_PROJECT_DIR/third_party/install_roadrunner + +build_libroadrunner(){ +echo $BDM_PROJECT_DIR +DEST_DIR=$BDM_PROJECT_DIR/build/build-third-party/build_roadrunner +rm -rf $DEST_DIR +rm -rf $LLRR_INSTALL_DIR +mkdir -p $DEST_DIR +mkdir -p $LLRR_INSTALL_DIR +cd $DEST_DIR +git clone https://github.com/sys-bio/llvm-13.x.git +cd llvm-13.x +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX="$LLRR_INSTALL_DIR/llvm" -DCMAKE_BUILD_TYPE="Release" ../llvm +cmake --build . --parallel $(CPUCount) --target install --config Release + + +cd $DEST_DIR +git clone https://github.com/sys-bio/libroadrunner-deps.git --recurse-submodules +cd libroadrunner-deps +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX="$LLRR_INSTALL_DIR/deps-install-Release" -DCMAKE_BUILD_TYPE="Release" .. +cmake --build . --parallel $(CPUCount) --target install --config Release + + +cd $DEST_DIR +git clone https://github.com/sys-bio/roadrunner.git +cd roadrunner +mkdir build-release +cd build-release +cmake -DCMAKE_INSTALL_PREFIX="$LLRR_INSTALL_DIR/roadrunner-Release" \ + -DLLVM_INSTALL_PREFIX="$LLRR_INSTALL_DIR/llvm" \ + -DRR_DEPENDENCIES_INSTALL_PREFIX="$LLRR_INSTALL_DIR/deps-install-Release" \ + -DCMAKE_BUILD_TYPE="Release" \ + -DRR_USE_CXX11=OFF -DUSE_TR1_CXX_NS=ON \ + -DBUILD_TESTS=ON .. +cmake --build . --parallel $(CPUCount) --target install --config Release +ctest --verbose . + +exit 0 +} + + +build_libroadrunner diff --git a/util/build-third-party/build-root_new.sh b/util/build-third-party/build-root_new.sh new file mode 100755 index 000000000..471fba1c7 --- /dev/null +++ b/util/build-third-party/build-root_new.sh @@ -0,0 +1,151 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script builds ROOT. + The archive will be stored in BDM_PROJECT_DIR/build/root.tar.gz +Arguments: + \$1 BDM_PROJECT_DIR" 1>&2; + exit 2 +fi + +ROOT_VERSION_TGZ=root_v6.30.02 + + +PYV2=`echo $PYVERS | cut -d . -f 1-2` + +BDM_PROJECT_DIR=$1 + + +# import util functions +. $BDM_PROJECT_DIR/util/installation/common/util.sh + +ROOT_INSTALL_DIR=$BDM_PROJECT_DIR/third_party/root + +ROOT_TGZ_FILE=$BDM_PROJECT_DIR/third_party/$ROOT_VERSION_TGZ.source.tar.gz + +build_root(){ +BDM_OS=$(DetectOs2) +PYTH="" +FEATURES="" +brewpy=no + +if [ $BDM_OS == "osx" ]; then + brewpy=yes + if [ $brewpy == "yes" ]; then + PYTH="$(brew --prefix)/bin/python${PYV2}" + else + export PYENV_ROOT=$(brew --prefix)/opt/.pyenv + eval "$(pyenv init -)" + pyenv shell $PYVERS + PYTH="`pyenv which python`" + fi + FEATURES="\ + -Dmacos_native=YES \ + -Dclad=OFF \ + -Dxrootd=OFF \ + -Dbuiltin_fftw3=ON \ + -Dbuiltin_freetype=ON \ + -Dbuiltin_ftgl=ON \ + -Dbuiltin_glew=ON \ + -Dbuiltin_gsl=ON \ + -Dbuiltin_lz4=ON \ + -Dbuiltin_lzma=ON \ + -Dbuiltin_openssl=OFF \ + -Dbuiltin_xrootd=OFF \ + -Dbuiltin_pcre=ON \ + -Dbuiltin_tbb=ON \ + -Dbuiltin_unuran=ON \ + -Dbuiltin_xxhash=ON \ + -Dbuiltin_zlib=ON \ + -Dbuiltin_zstd=ON" +else + FEATURES="\ + -Dclad=OFF \ + -Dxrootd=OFF \ + -Dbuiltin_fftw3=ON \ + -Dbuiltin_freetype=ON \ + -Dbuiltin_ftgl=ON \ + -Dbuiltin_glew=ON \ + -Dbuiltin_gsl=ON \ + -Dbuiltin_lz4=ON \ + -Dbuiltin_lzma=ON \ + -Dbuiltin_openssl=OFF \ + -Dbuiltin_xrootd=OFF \ + -Dbuiltin_pcre=ON \ + -Dbuiltin_tbb=ON \ + -Dbuiltin_unuran=ON \ + -Dbuiltin_xxhash=ON \ + -Dbuiltin_zlib=ON \ + -Dbuiltin_zstd=ON" + + PYTH="`pyenv which python`" +fi +DEST_DIR=$BDM_PROJECT_DIR/build/build-third-party/build_root +rm -rf $DEST_DIR +rm -rf $ROOT_INSTALL_DIR +mkdir -p $DEST_DIR +mkdir -p $ROOT_INSTALL_DIR +if ! [ -e $ROOT_TGZ_FILE ]; then + curl -o $ROOT_TGZ_FILE https://root.cern/download/$ROOT_VERSION_TGZ.source.tar.gz +fi +tar -xvzf $ROOT_TGZ_FILE -C $DEST_DIR --strip-components=1 +cd $DEST_DIR +if [ $ROOT_VERSION_TGZ=="root_v6.30.02" ]; then + patch -p1 < $BDM_PROJECT_DIR/third_party/root63002.patch +fi +mkdir obj +cd obj +echo $PYTH +cmake $FEATURES -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE="$PYTH" -DCMAKE_INSTALL_PREFIX=$ROOT_INSTALL_DIR .. +cmake --build . --parallel $(CPUCount) --target install +#source $ROOT_INSTALL_DIR/bin/thisroot.sh +return +} + +SPECIFIC_BDM_OS=$(DetectOs) + +DEFAULT_ROOTBD_OPTION="Yes" + +if echo "$SPECIFIC_OSES_SUPPORTED" | grep -Eiq "$SPECIFIC_BDM_OS" ; then + DEFAULT_ROOTBD_OPTION="No" +fi + +while true; do + read -p "Do you want to build or download ROOT? (Y(Yes/build) / N(No/download)) +Default option for your platform: ($DEFAULT_ROOTBD_OPTION): " ROOTBD_ANS + + case $ROOTBD_ANS in + [yY] ) echo "Building ROOT:" 1>&2; + build_root + exit 0;; + [nN] ) echo "Downloading ROOT:" 1>&2; + exit 1;; + "" ) echo "Initiating default option ($DEFAULT_ROOTBD_OPTION): " 1>&2; + if [ "$DEFAULT_ROOTBD_OPTION" == "Yes" ]; then + echo "Building ROOT:" 1>&2; + build_root + exit 0 + elif [ "$DEFAULT_ROOTBD_OPTION" == "No" ]; then + echo "Downloading ROOT:" 1>&2; + exit 1 + fi ;; + * ) echo "Please answer yes (Y/y) or no (N/n) " 1>&2;; + esac + + +done diff --git a/util/build-third-party/paraview/paraview-superbuild-openmp.v5.9.0.patch b/util/build-third-party/paraview/paraview-superbuild-openmp.v5.9.0.patch old mode 100644 new mode 100755 diff --git a/util/demo_to_notebook.py b/util/demo_to_notebook.py old mode 100644 new mode 100755 diff --git a/util/git/pr_checklist.md b/util/git/pr_checklist.md old mode 100644 new mode 100755 diff --git a/util/housekeeping/README b/util/housekeeping/README old mode 100644 new mode 100755 diff --git a/util/housekeeping/copyright_cpp.txt b/util/housekeeping/copyright_cpp.txt old mode 100644 new mode 100755 diff --git a/util/installation/common/echo.sh b/util/installation/common/echo.sh old mode 100644 new mode 100755 diff --git a/util/installation/common/install.sh b/util/installation/common/install.sh index 3a64f00e9..0cddf9f1c 100755 --- a/util/installation/common/install.sh +++ b/util/installation/common/install.sh @@ -34,9 +34,15 @@ BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../.." # include util functions . $BDM_PROJECT_DIR/util/installation/common/util.sh +BDM_SPECIFIC_OS=$(DetectOs) +if [ $BDM_OS = "rhel" ]; then + . /etc/profile.d/modules.sh + module load mpi +fi + # Custom instructions for CentOS set +e -if [ $BDM_OS = "centos-7" ]; then +if [ $BDM_SPECIFIC_OS = "centos-7" ]; then # Turn of NUMA for Github Actions CentOS runner, because we get "mbind # operation not permitted errors", due to docker security constraints if [ ! -z ${GITHUB_ACTIONS+x} ]; then diff --git a/util/installation/common/util.sh b/util/installation/common/util.sh old mode 100755 new mode 100644 index 45a53d168..f574bac14 --- a/util/installation/common/util.sh +++ b/util/installation/common/util.sh @@ -17,6 +17,7 @@ # (Thus reducing code duplication) SCRIPTPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SPECIFIC_OSES_SUPPORTED="ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, centos-7, osx" #include echo.sh . $SCRIPTPATH/echo.sh @@ -58,6 +59,29 @@ function DetectOs { fi } +function DetectOs2 { + # detect operating system + if [ `uname` = "Linux" ]; then + # linux + PROCVERSION=$(cat /proc/version) + if echo "$PROCVERSION" | grep -Eiq 'Red Hat' ; then + echo rhel; + elif echo "$PROCVERSION" | grep -Eiq 'debian|buntu|mint|eepin' ; then + echo debian; + elif echo "$PROCVERSION" | grep -Eiq 'SUSE|suse' ; then + echo suse; + else + echo other_distro; + fi + elif [ `uname` = "Darwin" ]; then + # macOS + echo osx + else + echo "ERROR: Operating system `uname` is not supported." + exit 1 + fi +} + # This function checks if the given operating system is supported. If not, it # prints an error message, a list of supported systems; and exits the script. # Arguments: @@ -71,10 +95,18 @@ function CheckOsSupported { local BDM_INSTALL_SRC=$1 local BDM_OS=$2 - - local BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS - - if [ ! -d "$BDM_INSTALL_OS_SRC" ]; then + local BDM_INSTALL_OS_SRC="" + local SPECIFIC_BDM_OS=$(DetectOs) + + if echo "$SPECIFIC_OSES_SUPPORTED" | grep -Eiq "$SPECIFIC_BDM_OS" ; then + if [ "$BDM_OS" == "osx" ]; then + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/common + else + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/$SPECIFIC_BDM_OS + fi + elif [ "$BDM_OS" == "osx" ] || [ "$BDM_OS" == "rhel" ] || [ "$BDM_OS" == "debian" ] || [ "$BDM_OS" == "suse" ] ; then + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/common + else echo "ERROR: This operating system (${BDM_OS}) is not supported" echo "Supported operating systems are: " pushd $BDM_INSTALL_SRC > /dev/null @@ -108,12 +140,27 @@ function CompileListOfPackages { local BDM_INSTALL_SRC="$2" local LOCAL_OS=$3 + local SPECIFIC_BDM_OS=$(DetectOs) + local BDM_OS=$(DetectOs2) # The list of packages on Ubuntu 20.04 is identical to Ubuntu 18.04 - if [ $LOCAL_OS == "ubuntu-20.04" ]; then - LOCAL_OS="ubuntu-18.04" + if [ $SPECIFIC_BDM_OS == "ubuntu-20.04" ]; then + SPECIFIC_BDM_OS="ubuntu-18.04" fi - local BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$LOCAL_OS + local BDM_INSTALL_OS_SRC="" + + if echo "$SPECIFIC_OSES_SUPPORTED" | grep -Eiq "$SPECIFIC_BDM_OS" ; then + if [ "$BDM_OS" == "osx" ]; then + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/common + else + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/$SPECIFIC_BDM_OS + fi + elif [ "$BDM_OS" == "osx" ] || [ "$BDM_OS" == "rhel" ] || [ "$BDM_OS" == "debian" ] || [ "$BDM_OS" == "suse" ]; then + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/common + else + echo "ERROR: This operating system (${BDM_OS}) is not supported" + exit 1; + fi BDM_PKG_LIST="" if [ $1 == "all" ]; then @@ -179,7 +226,129 @@ function CleanBuild { else mkdir -p $BUILD_DIR fi + cd $BDM_PROJECT_DIR + BDM_PROJECT_DIR_2=$(pwd) cd $BUILD_DIR + + CLEAN_BUILD_OS=$(DetectOs2) + if [ "$CLEAN_BUILD_OS" == "rhel" ]; then + . scl_source enable gcc-toolset-10 > /dev/null 2> /dev/null || true + . scl_source enable devtoolset-10 > /dev/null 2> /dev/null || true + . scl_source enable gcc-toolset-11 > /dev/null 2> /dev/null || true + . scl_source enable devtoolset-11 > /dev/null 2> /dev/null || true + fi + GCC_VER=$(gcc --version | grep gcc) || true + #GCC_VER=$(gcc --version | grep gcc | grep -oE ' |\S+' | awk '{print $NF}' | cut -d '.' -f 1-2) + if [ -n "${GCC_VER}" ]; then + read -ra tokens <<< $GCC_VER + result=() + current_token="" + for token in "${tokens[@]}"; do + if [[ -n $current_token ]]; then + current_token+=" $token" + if [[ $current_token == *')' ]]; then + result+=("$current_token") + current_token="" + fi + else + if [[ $token == '('* && $token != *')' ]]; then + current_token="$token" + else + result+=("$token") + fi + fi + done + if [[ -n $current_token ]]; then + result+=("$current_token") + fi + GCC_VER=${result[2]} + GCC_VER=$( echo $GCC_VER | cut -d '.' -f 1-2) + fi + if [ "$CLEAN_BUILD_OS"!="osx" ]; then + if [ -z "${GCC_VER}" ] || [ `echo "$GCC_VER >= 12" | bc -q` -ne 0 ] || [ `echo "$GCC_VER < 9" | bc -q` -ne 0 ]; then + + + if $(command -v gcc-11 > /dev/null) && $(command -v g++-11 > /dev/null) && $(command -v gfortran-11 > /dev/null); then + + echo "******************************************************************" + echo "Found suitable gcc version installed (gcc-11) via your +distribution's package manager. +Using that." + echo "******************************************************************"; + + export CC=gcc-11 + export CXX=g++-11 + export FC=gfortran-11 + export OMPI_CC=gcc-11 + export OMPI_CXX=g++-11 + export OMPI_FC=gfortran-11 + export QMAKE_CC=gcc-11 + export QMAKE_CXX=g++-11 + export LINK=g++-11 + + + + elif [ -d $BDM_PROJECT_DIR_2/third_party/gcc ]; then + + echo "******************************************************************" + echo "Found suitable gcc version installed in the +third party directory. +Using that." + echo "******************************************************************" + + export CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc + export CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + export FC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gfortran + export OMPI_CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc + export OMPI_CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + export OMPI_FC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gfortran + export QMAKE_CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc + export QMAKE_CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + export LINK=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + + else + + echo "******************************************************************" + echo "Warning: Selected GCC Version ($GCC_VER) is incompatible with + the project and can cause installation issues. + It is recommended that you install a compatible version + of GCC that is provided with this installation. + +*Note* It is possible that you are using a legacy but still + supported version of an operating system + ex. Ubuntu-18.04. In this case is is possible + to compile BioDynaMo itself but requirements + such as ROOT, QT and Paraview must be downloaded." + echo "******************************************************************" + + cd $BDM_PROJECT_DIR_2/util/build-third-party/ + ./build-gcc_new.sh $BDM_PROJECT_DIR_2 + cd $BUILD_DIR + if [ -d $BDM_PROJECT_DIR_2/third_party/gcc ]; then + + echo "******************************************************************" + echo "Found suitable gcc version installed in the +third party directory. +Using that." + echo "******************************************************************" + export CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc + export CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + export FC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gfortran + export OMPI_CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc + export OMPI_CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + export OMPI_FC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gfortran + export QMAKE_CC=$BDM_PROJECT_DIR_2/third_party/gcc/bin/gcc + export QMAKE_CXX=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + export LINK=$BDM_PROJECT_DIR_2/third_party/gcc/bin/g++ + + fi + fi + + + + fi + fi + echo "CMAKEFLAGS $BDM_CMAKE_FLAGS" cmake $BDM_CMAKE_FLAGS .. make -j$(CPUCount) && make install @@ -217,15 +386,28 @@ function CallOSSpecificScript { shift local BDM_SCRIPT_FILE="$1" shift - local BDM_LOCAL_OS=$(DetectOs) + local SPECIFIC_BDM_OS=$(DetectOs) + local BDM_OS=$(DetectOs2) local BDM_SCRIPT_ARGUMENTS=$@ local BDM_INSTALL_SRC=$BDM_PROJECT_DIR/util/installation # detect os - local BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_LOCAL_OS + local BDM_INSTALL_OS_SRC="" + + if echo "$SPECIFIC_OSES_SUPPORTED" | grep -Eiq "$SPECIFIC_BDM_OS" ; then + if [ "$BDM_OS" == "osx" ]; then + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/common + else + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/$SPECIFIC_BDM_OS + fi + elif [ "$BDM_OS" == "osx" ] || [ "$BDM_OS" == "rhel" ] || [ "$BDM_OS" == "debian" ] || [ "$BDM_OS" == "suse" ]; then + BDM_INSTALL_OS_SRC=$BDM_INSTALL_SRC/$BDM_OS/common + else + echo "ERROR: This operating system (${BDM_OS}) is not supported" + exit 1; + fi # check if this system is supported - CheckOsSupported $BDM_INSTALL_SRC $BDM_LOCAL_OS # check if script exists for the detected OS local BDM_SCRIPTPATH=$BDM_INSTALL_OS_SRC/$BDM_SCRIPT_FILE @@ -390,7 +572,7 @@ function EchoFinishInstallation { EchoNewStep "For other shells, or for more information, see:" EchoNewStep " ${BDM_ECHO_UNDERLINE}https://biodynamo.org/docs/userguide/first_steps/" echo - # any warnings about users' post-install shell + # any warnings about users' post-install shell # configuration may be added to the function called below WarnPossibleBadShellConfigs || true } diff --git a/util/installation/ubuntu-18.04/Dockerfile b/util/installation/debian/common/Dockerfile old mode 100644 new mode 100755 similarity index 100% rename from util/installation/ubuntu-18.04/Dockerfile rename to util/installation/debian/common/Dockerfile diff --git a/util/installation/ubuntu-18.04/package_list_extra b/util/installation/debian/common/package_list_extra old mode 100644 new mode 100755 similarity index 100% rename from util/installation/ubuntu-18.04/package_list_extra rename to util/installation/debian/common/package_list_extra diff --git a/util/installation/debian/common/package_list_required b/util/installation/debian/common/package_list_required new file mode 100755 index 000000000..544b46510 --- /dev/null +++ b/util/installation/debian/common/package_list_required @@ -0,0 +1,62 @@ +lsb-release +curl +build-essential +freeglut3-dev +g++ +gcc +gfortran +g++-11 +gcc-11 +gfortran-11 +libgmp-dev +libmpc-dev +libmpfr-dev +git +doxygen +libblas-dev +libbz2-dev +liblapack-dev +libnuma-dev +libomp5 +libomp-dev +libopenmpi-dev +libpthread-stubs0-dev +make +wget +zlib1g-dev +graphviz-dev +libgsl-dev +libblas-dev +liblapack-dev +libx11-dev +libxpm-dev +libxft-dev +libxext-dev +valgrind +libbz2-dev +libffi-dev +liblzma-dev +libreadline-dev +libsqlite3-dev +libglew-dev +libssl-dev +python3-openssl +libatlas-base-dev +tk-dev +xz-utils +uuid-dev +zlib1g-dev +python3-dev +libldap-dev +freeglut3-dev +libcfitsio-dev +libncurses-dev +libxkbcommon-dev +libxkbcommon-x11-dev +libxcb-* +libx11-xcb-dev +libglu1-mesa-dev +libxrender-dev +libxi-dev +ffmpeg +libavcodec-dev diff --git a/util/installation/ubuntu-18.04/pip_packages.txt b/util/installation/debian/common/pip_packages.txt old mode 100644 new mode 100755 similarity index 98% rename from util/installation/ubuntu-18.04/pip_packages.txt rename to util/installation/debian/common/pip_packages.txt index f500f6a68..aa7149252 --- a/util/installation/ubuntu-18.04/pip_packages.txt +++ b/util/installation/debian/common/pip_packages.txt @@ -20,3 +20,4 @@ ipython==8.8.0 traitlets==5.8.1 websocket-client==1.4.2 zipp==3.11.0 +cython diff --git a/util/installation/debian/common/prerequisites.sh b/util/installation/debian/common/prerequisites.sh new file mode 100755 index 000000000..4642b2deb --- /dev/null +++ b/util/installation/debian/common/prerequisites.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +#This script installs the required packages +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script installs the prerequisites of BioDynaMo, but not BioDynaMo + itself. Script install.sh installs both prerequisites and BioDynaMo. +Arguments: + all/required. If all is specified, then this script + will install all the prerequisites." + exit 1 +fi + +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." + + + +# Install required packages +sudo apt-get install -y \ + $(cat $BDM_PROJECT_DIR/util/installation/debian/common/package_list_required) + +curl -L -O https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh +chmod +x cmake-3.19.3-Linux-x86_64.sh +sudo ./cmake-3.19.3-Linux-x86_64.sh --skip-license --prefix=/usr/local + +if [ -n "${PYENV_ROOT}" ]; then + unset PYENV_ROOT +fi + +# If PyEnv is not installed, install it +if [ ! -f "$HOME/.pyenv/bin/pyenv" ]; then + echo "PyEnv was not found. Installing now..." + curl https://pyenv.run | bash +fi + +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init --path)" +eval "$(pyenv init -)" +pyenv update + +PYVERS=3.9.1 + +# If Python $PYVERS is not installed, install it +if [ ! -f "$HOME/.pyenv/versions/$PYVERS/lib/libpython3.so" ]; then + echo "Python $PYVERS was not found. Installing now..." + /usr/bin/env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f $PYVERS +fi +pyenv shell $PYVERS + +# Install optional packages +if [ $1 == "all" ]; then + # Don't install --user: the packages should end up in the PYENV_ROOT directory + python -m pip install -r $BDM_PROJECT_DIR/util/installation/debian/common/pip_packages.txt + + sudo apt-get install -y \ + $(cat $BDM_PROJECT_DIR/util/installation/debian/common/package_list_extra) +fi + +exit 0 diff --git a/util/installation/debian/ubuntu-18.04/Dockerfile b/util/installation/debian/ubuntu-18.04/Dockerfile new file mode 100755 index 000000000..4eb567163 --- /dev/null +++ b/util/installation/debian/ubuntu-18.04/Dockerfile @@ -0,0 +1,50 @@ +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +FROM ubuntu:18.04 + +# man required by ROOT +RUN apt-get update && apt-get install -y \ + git \ + sudo \ + man \ + software-properties-common \ + wget \ + xvfb + +# This will avoid tzdata package from requesting user interaction (tzdata is a +# dependency of one of the prerequisites of PyEnv) +RUN if ! [ -L /etc/localtime ]; then \ + sudo ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime; \ + fi + +RUN git config --system user.name "Test User" && \ + git config --system user.email user@test.com + +# update user id and group id such that mapped volumes can be accessed with the +# same rights as on the host. Files created by the container can also be +# accessed on the host without chowning. +ARG HOST_UID +ARG HOST_GID + +RUN groupadd -g $HOST_GID testuser && \ + useradd -u $HOST_UID -g $HOST_GID -m -c "Testuser" testuser && \ + passwd --delete testuser && \ + echo "testuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +USER testuser + +# preserve the environment variable BDM_LOCAL_LFS when calling scripts with +# sudo +RUN echo "Defaults env_keep += \"BDM_LOCAL_LFS\"" | sudo tee -a /etc/sudoers diff --git a/util/installation/debian/ubuntu-18.04/package_list_extra b/util/installation/debian/ubuntu-18.04/package_list_extra new file mode 100755 index 000000000..5b9cb80da --- /dev/null +++ b/util/installation/debian/ubuntu-18.04/package_list_extra @@ -0,0 +1,12 @@ +clang +clang-format +clang-tidy +doxygen +graphviz +libxml2-dev +llvm-7 +llvm-7-dev +llvm-7-runtime +valgrind +libgsl-dev +libgit2-dev diff --git a/util/installation/ubuntu-18.04/package_list_required b/util/installation/debian/ubuntu-18.04/package_list_required old mode 100644 new mode 100755 similarity index 97% rename from util/installation/ubuntu-18.04/package_list_required rename to util/installation/debian/ubuntu-18.04/package_list_required index 3ff3149d5..fdd6006ef --- a/util/installation/ubuntu-18.04/package_list_required +++ b/util/installation/debian/ubuntu-18.04/package_list_required @@ -1,4 +1,3 @@ -cmake curl freeglut3-dev g++ diff --git a/util/installation/debian/ubuntu-18.04/pip_packages.txt b/util/installation/debian/ubuntu-18.04/pip_packages.txt new file mode 100755 index 000000000..aa7149252 --- /dev/null +++ b/util/installation/debian/ubuntu-18.04/pip_packages.txt @@ -0,0 +1,23 @@ +jupyter==1.0.0 +jupyter-client==7.4.9 +jupyter-console==6.4.4 +jupyter-core==5.1.4 +jupyter-events==0.6.3 +jupyter-server==2.1.0 +jupyter-server-terminals==0.4.4 +jupyterlab==3.5.3 +jupyterlab-pygments==0.2.2 +jupyterlab-server==2.19.0 +jupyterlab-widgets==3.0.5 +metakernel==0.29.4 +nbclassic==0.4.8 +nbclient==0.6.6 +nbconvert==6.5.3 +nbformat==5.4.0 +markupsafe==2.0.1 +beautifulsoup4==4.11.1 +ipython==8.8.0 +traitlets==5.8.1 +websocket-client==1.4.2 +zipp==3.11.0 +cython diff --git a/util/installation/ubuntu-18.04/prerequisites.sh b/util/installation/debian/ubuntu-18.04/prerequisites.sh similarity index 78% rename from util/installation/ubuntu-18.04/prerequisites.sh rename to util/installation/debian/ubuntu-18.04/prerequisites.sh index 75f8425f3..3cf7f7f8d 100755 --- a/util/installation/ubuntu-18.04/prerequisites.sh +++ b/util/installation/debian/ubuntu-18.04/prerequisites.sh @@ -25,24 +25,22 @@ Arguments: exit 1 fi -BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../.." +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." # Required to add Kitware ppa below sudo apt-get update sudo apt-get install apt-transport-https -# Add ppa for newer CMake version -wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - -CODENAME=$(grep -oP '(?<=^UBUNTU_CODENAME=).+' /etc/os-release | tr -d '"') -REPO="deb https://apt.kitware.com/ubuntu/ ${CODENAME} main" -sudo apt-add-repository "$REPO" - # Update sudo apt-get update # Install required packages sudo apt-get install -y \ - $(cat $BDM_PROJECT_DIR/util/installation/ubuntu-18.04/package_list_required) + $(cat $BDM_PROJECT_DIR/util/installation/debian/ubuntu-18.04/package_list_required) + +curl -L -O https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh +chmod +x cmake-3.19.3-Linux-x86_64.sh +sudo ./cmake-3.19.3-Linux-x86_64.sh --skip-license --prefix=/usr/local if [ -n "${PYENV_ROOT}" ]; then unset PYENV_ROOT @@ -72,10 +70,10 @@ pyenv shell $PYVERS # Install optional packages if [ $1 == "all" ]; then # Don't install --user: the packages should end up in the PYENV_ROOT directory - python -m pip install -r $BDM_PROJECT_DIR/util/installation/ubuntu-18.04/pip_packages.txt + python -m pip install -r $BDM_PROJECT_DIR/util/installation/debian/ubuntu-18.04/pip_packages.txt sudo apt-get install -y \ - $(cat $BDM_PROJECT_DIR/util/installation/ubuntu-18.04/package_list_extra) + $(cat $BDM_PROJECT_DIR/util/installation/debian/ubuntu-18.04/package_list_extra) fi exit 0 diff --git a/util/installation/ubuntu-20.04/Dockerfile b/util/installation/debian/ubuntu-20.04/Dockerfile old mode 100644 new mode 100755 similarity index 100% rename from util/installation/ubuntu-20.04/Dockerfile rename to util/installation/debian/ubuntu-20.04/Dockerfile diff --git a/util/installation/ubuntu-20.04/prerequisites.sh b/util/installation/debian/ubuntu-20.04/prerequisites.sh similarity index 95% rename from util/installation/ubuntu-20.04/prerequisites.sh rename to util/installation/debian/ubuntu-20.04/prerequisites.sh index 1980b182d..1d6b8c591 100755 --- a/util/installation/ubuntu-20.04/prerequisites.sh +++ b/util/installation/debian/ubuntu-20.04/prerequisites.sh @@ -27,7 +27,7 @@ fi set -e -BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../.." +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." wget https://apt.llvm.org/llvm-snapshot.gpg.key sudo apt-key add llvm-snapshot.gpg.key @@ -44,7 +44,7 @@ sudo apt update sudo apt install -y cmake-data=3.21.3-0kitware1ubuntu20.04.1 # use ubuntu-18.04 prerequisites script -. $BDM_PROJECT_DIR/util/installation/ubuntu-18.04/prerequisites.sh $1 +. $BDM_PROJECT_DIR/util/installation/debian/ubuntu-18.04/prerequisites.sh $1 if [ $1 == "all" ]; then sudo apt-get install -y kcov diff --git a/util/installation/ubuntu-22.04/Dockerfile b/util/installation/debian/ubuntu-22.04/Dockerfile old mode 100644 new mode 100755 similarity index 100% rename from util/installation/ubuntu-22.04/Dockerfile rename to util/installation/debian/ubuntu-22.04/Dockerfile diff --git a/util/installation/ubuntu-22.04/package_list_extra b/util/installation/debian/ubuntu-22.04/package_list_extra old mode 100644 new mode 100755 similarity index 100% rename from util/installation/ubuntu-22.04/package_list_extra rename to util/installation/debian/ubuntu-22.04/package_list_extra diff --git a/util/installation/ubuntu-22.04/package_list_required b/util/installation/debian/ubuntu-22.04/package_list_required old mode 100644 new mode 100755 similarity index 95% rename from util/installation/ubuntu-22.04/package_list_required rename to util/installation/debian/ubuntu-22.04/package_list_required index 8dc3598c1..981db275f --- a/util/installation/ubuntu-22.04/package_list_required +++ b/util/installation/debian/ubuntu-22.04/package_list_required @@ -1,4 +1,3 @@ -cmake curl freeglut3-dev g++ @@ -16,6 +15,7 @@ make wget zlib1g-dev +python3-dev libbz2-dev libffi-dev liblzma-dev diff --git a/util/installation/ubuntu-22.04/pip_packages.txt b/util/installation/debian/ubuntu-22.04/pip_packages.txt old mode 100644 new mode 100755 similarity index 97% rename from util/installation/ubuntu-22.04/pip_packages.txt rename to util/installation/debian/ubuntu-22.04/pip_packages.txt index 36098f984..12f7330f1 --- a/util/installation/ubuntu-22.04/pip_packages.txt +++ b/util/installation/debian/ubuntu-22.04/pip_packages.txt @@ -20,3 +20,4 @@ ipython traitlets websocket-client zipp +cython diff --git a/util/installation/ubuntu-22.04/prerequisites.sh b/util/installation/debian/ubuntu-22.04/prerequisites.sh similarity index 79% rename from util/installation/ubuntu-22.04/prerequisites.sh rename to util/installation/debian/ubuntu-22.04/prerequisites.sh index aae82dfa0..55e5dd478 100755 --- a/util/installation/ubuntu-22.04/prerequisites.sh +++ b/util/installation/debian/ubuntu-22.04/prerequisites.sh @@ -25,25 +25,23 @@ Arguments: exit 1 fi -BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../.." +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." # Required to add Kitware ppa below sudo apt-get update sudo apt-get install apt-transport-https -# Add ppa for newer CMake version -wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - -CODENAME=$(grep -oP '(?<=^UBUNTU_CODENAME=).+' /etc/os-release | tr -d '"') -REPO="deb https://apt.kitware.com/ubuntu/ ${CODENAME} main" -sudo apt-add-repository "$REPO" - # Update sudo apt-get update sudo apt install -y cmake-data=3.22.1-1ubuntu1.22.04.1 # Install required packages sudo apt-get install -y \ - $(cat $BDM_PROJECT_DIR/util/installation/ubuntu-22.04/package_list_required) + $(cat $BDM_PROJECT_DIR/util/installation/debian/ubuntu-22.04/package_list_required) + +curl -L -O https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh +chmod +x cmake-3.19.3-Linux-x86_64.sh +sudo ./cmake-3.19.3-Linux-x86_64.sh --skip-license --prefix=/usr/local if [ -n "${PYENV_ROOT}" ]; then unset PYENV_ROOT @@ -73,10 +71,10 @@ pyenv shell $PYVERS # Install optional packages if [ $1 == "all" ]; then # Don't install --user: the packages should end up in the PYENV_ROOT directory - python -m pip install -r $BDM_PROJECT_DIR/util/installation/ubuntu-22.04/pip_packages.txt + python -m pip install -r $BDM_PROJECT_DIR/util/installation/debian/ubuntu-22.04/pip_packages.txt sudo apt-get install -y \ - $(cat $BDM_PROJECT_DIR/util/installation/ubuntu-22.04/package_list_extra) + $(cat $BDM_PROJECT_DIR/util/installation/debian/ubuntu-22.04/package_list_extra) fi exit 0 diff --git a/util/installation/osx/package_list_extra b/util/installation/osx/common/package_list_extra old mode 100644 new mode 100755 similarity index 100% rename from util/installation/osx/package_list_extra rename to util/installation/osx/common/package_list_extra diff --git a/util/installation/osx/package_list_required b/util/installation/osx/common/package_list_required old mode 100644 new mode 100755 similarity index 100% rename from util/installation/osx/package_list_required rename to util/installation/osx/common/package_list_required diff --git a/util/installation/osx/prerequisites.sh b/util/installation/osx/common/prerequisites.sh similarity index 87% rename from util/installation/osx/prerequisites.sh rename to util/installation/osx/common/prerequisites.sh index ef45853c4..fbb665044 100755 --- a/util/installation/osx/prerequisites.sh +++ b/util/installation/osx/common/prerequisites.sh @@ -24,7 +24,7 @@ Arguments: exit 1 fi -BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../.." +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." if [ `arch` == "i386" -a ! -x "/usr/local/bin/brew" ]; then echo "First install the Homebrew macOS package manager from https://brew.sh" @@ -52,23 +52,23 @@ fi # Install and upgrade required packages brew install \ - $(cat $BDM_PROJECT_DIR/util/installation/osx/package_list_required) || true + $(cat $BDM_PROJECT_DIR/util/installation/osx/common/package_list_required) || true # Install the optional packages if [ $1 == "all" ]; then # Fix jinja2 version because of failing build target `notebooks` on # macOS System CI. - PIP_PACKAGES="markupsafe==2.0.1 nbformat jupyter metakernel jupyterlab jinja2==3.0" + PIP_PACKAGES="markupsafe==2.0.1 nbformat jupyter metakernel jupyterlab jinja2==3.0 cython" # Don't install --user: the packages should end up in the PYENV_ROOT directory python3.9 -m pip install $PIP_PACKAGES brew install \ - $(cat $BDM_PROJECT_DIR/util/installation/osx/package_list_extra) || true + $(cat $BDM_PROJECT_DIR/util/installation/osx/common/package_list_extra) || true fi # Test installation of brew formulae such that the user gets feedback if # his/her brew installation did not work as expected. brew_required=0 -for package in $(cat $BDM_PROJECT_DIR/util/installation/osx/package_list_required) +for package in $(cat $BDM_PROJECT_DIR/util/installation/osx/common/package_list_required) do brew list $package &> /dev/null if [ $? -eq 1 ]; then @@ -84,11 +84,17 @@ else echo "log and make sure your homebrew works properly." fi +# install old brew formulae from source and pin them + brew remove cmake + brew install -s $BDM_PROJECT_DIR/third_party/brew_formulae/cmake.rb + brew pin cmake + + # Test installation of optional brew formulae. if [ $1 == "all" ]; then # Test if all extra packages were really successfully installed. brew_extra=0 - for package in $(cat $BDM_PROJECT_DIR/util/installation/osx/package_list_extra) + for package in $(cat $BDM_PROJECT_DIR/util/installation/osx/common/package_list_extra) do brew list $package &> /dev/null if [ $? -eq 1 ]; then diff --git a/util/installation/centos-7/Dockerfile b/util/installation/rhel/centos-7/Dockerfile old mode 100644 new mode 100755 similarity index 100% rename from util/installation/centos-7/Dockerfile rename to util/installation/rhel/centos-7/Dockerfile diff --git a/util/installation/centos-7/package_list_extra b/util/installation/rhel/centos-7/package_list_extra old mode 100644 new mode 100755 similarity index 100% rename from util/installation/centos-7/package_list_extra rename to util/installation/rhel/centos-7/package_list_extra diff --git a/util/installation/centos-7/package_list_required b/util/installation/rhel/centos-7/package_list_required old mode 100644 new mode 100755 similarity index 100% rename from util/installation/centos-7/package_list_required rename to util/installation/rhel/centos-7/package_list_required diff --git a/util/installation/centos-7/prerequisites.sh b/util/installation/rhel/centos-7/prerequisites.sh similarity index 92% rename from util/installation/centos-7/prerequisites.sh rename to util/installation/rhel/centos-7/prerequisites.sh index 86d80039e..219a92ca6 100755 --- a/util/installation/centos-7/prerequisites.sh +++ b/util/installation/rhel/centos-7/prerequisites.sh @@ -25,7 +25,7 @@ Arguments: exit 1 fi -BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../.." +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." sudo -v @@ -37,7 +37,7 @@ sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm \ # Install required packages sudo yum install -y \ - $(cat $BDM_PROJECT_DIR/util/installation/centos-7/package_list_required) + $(cat $BDM_PROJECT_DIR/util/installation/rhel/centos-7/package_list_required) curl -L -O https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh chmod +x cmake-3.19.3-Linux-x86_64.sh @@ -69,7 +69,7 @@ pyenv shell $PYVERS # Install optional packages if [ $1 == "all" ]; then - PIP_PACKAGES="markupsafe==2.0.1 nbformat jupyter metakernel jupyterlab nbformat==5.4.0 nbconvert==6.5.3 nbclient==0.6.6" + PIP_PACKAGES="markupsafe==2.0.1 nbformat jupyter metakernel jupyterlab nbformat==5.4.0 nbconvert==6.5.3 nbclient==0.6.6 cython" # Don't install --user: the packages should end up in the PYENV_ROOT directory python -m pip install $PIP_PACKAGES # SBML integration @@ -82,7 +82,7 @@ gpgcheck=1 gpgkey=http://springdale.math.ias.edu/data/puias/7.6/x86_64/os/RPM-GPG-KEY-puias EOF' sudo yum install -y --nogpgcheck \ - $(cat $BDM_PROJECT_DIR/util/installation/centos-7/package_list_extra) + $(cat $BDM_PROJECT_DIR/util/installation/rhel/centos-7/package_list_extra) fi exit 0 diff --git a/util/installation/rhel/common/Dockerfile b/util/installation/rhel/common/Dockerfile new file mode 100755 index 000000000..45e68264f --- /dev/null +++ b/util/installation/rhel/common/Dockerfile @@ -0,0 +1,52 @@ +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +FROM centos:7 + +# workaround for https://github.com/containers/buildah/issues/1046 +RUN echo "" >> /etc/hosts && cat /etc/hosts && yum -y install setup + +# man required by ROOT +# mesa-dri-drivers: OpenGl driver (software renderer) +RUN yum update -y && yum install -y \ + git \ + sudo \ + man \ + wget \ + xorg-x11-server-Xvfb \ + mesa-dri-drivers + +RUN git config --system user.name "Test User" && \ + git config --system user.email user@test.com + +# update user id and group id such that mapped volumes can be accessed with the +# same rights as on the host. Files created by the container can also be +# accessed on the host without chowning. +ARG HOST_UID +ARG HOST_GID + +RUN groupadd -g $HOST_GID testuser && \ + useradd -u $HOST_UID -g $HOST_GID -m -c "Testuser" testuser && \ + passwd --delete testuser && \ + echo "testuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +USER testuser + +# preserve the environment variable BDM_LOCAL_LFS when calling scripts with +# sudo +RUN echo "Defaults env_keep += \"BDM_LOCAL_LFS\"" | sudo tee -a /etc/sudoers + +# the OpenGL capabilities can be incorrectly detected -> override version +# https://python.develop-bugs.com/article/10118323/paraview+needs+higher+OpenGL+in+Mesa +ENV MESA_GL_VERSION_OVERRIDE=3.3 diff --git a/util/installation/rhel/common/package_list_extra b/util/installation/rhel/common/package_list_extra new file mode 100755 index 000000000..3faf4de15 --- /dev/null +++ b/util/installation/rhel/common/package_list_extra @@ -0,0 +1,42 @@ +doxygen +graphviz +libxml2-devel +fontconfig-devel +fontconfig +freetype +freetype-devel +llvm-toolset-7 +llvm-toolset-7-clang-tools-extra +llvm-toolset-7-llvm-devel +llvm-toolset-7-llvm-static +valgrind +gsl-devel +atlas-devel +blas-devel +lapack-devel +gcc-gfortran +openssl-devel +pcre-devel +mesa-libGL-devel +mesa-libGLU-devel +glew-devel +ftgl-devel +mysql-devel +fftw-devel +cfitsio-devel +graphviz-devel +avahi-compat-libdns_sd-devel +libldap-dev +python-devel +libxml2-devel +gsl-static +atlas-devel +libXt-devel +freeglut3-devel +ncurses-devel +libxml2-devel +bzip2 +bzip2-devel +zlib +zlib-devel + diff --git a/util/installation/rhel/common/package_list_required b/util/installation/rhel/common/package_list_required new file mode 100644 index 000000000..369971db0 --- /dev/null +++ b/util/installation/rhel/common/package_list_required @@ -0,0 +1,92 @@ +gcc +g++ +bzip2-devel +freeglut-devel +git +patch +libXext-devel +libXt-devel +numactl-devel +openmpi-devel +wget +zlib-devel +python3-tkinter +tk-devel + +@development +gmp-devel +mpfr-devel +libmpc-devel +zlib-devel +bzip2 +bzip2-devel +readline-devel +sqlite +doxygen +sqlite-devel +openssl-devel +xz +xz-devel +libffi-devel +findutils +lapack-devel +blas-devel +llvm-toolset +openmpi +libX11-devel +libXpm-devel +libXft-devel +libXext-devel +lapack-devel +valgrind +gsl-devel +atlas-devel +blas-devel +lapack-devel +gcc-gfortran +openssl-devel +pcre-devel +mesa-libGL-devel +mesa-libGLU-devel +glew-devel +ftgl-devel +mysql-devel +fftw-devel +cfitsio-devel +graphviz-devel +avahi-compat-libdns_sd-devel +libldap-devel +python-devel +libxml2-devel +gsl-static +atlas-devel +libXt-devel +freeglut3-devel +ncurses-devel +openldap-devel +freeglut-devel +gsl-devel +libxml2-devel +bzip2 +bzip2-devel +zlib +zlib-devel +libuuid-devel +ffmpeg-free-devel +libxkbcommon-devel +libxkbcommon-x11-devel +xcb-util-devel +xcb-util-image-devel +xcb-util-keysyms-devel +xcb-util-xrm-devel +xcb-util-cursor-devel +xcb-util-renderutil-devel +xcb-util-wm-devel +libXi-devel +xcb-proto +mesa-libGL-devel +tslib +tslib-devel +devtoolset-10-gcc* +devtoolset-11-gcc* +gcc-toolset-11* diff --git a/util/installation/rhel/common/prerequisites.sh b/util/installation/rhel/common/prerequisites.sh new file mode 100755 index 000000000..611215215 --- /dev/null +++ b/util/installation/rhel/common/prerequisites.sh @@ -0,0 +1,128 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +# This script installs the required packages +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script installs the prerequisites of BioDynaMo, but not BioDynaMo + itself. Script install.sh installs both prerequisites and BioDynaMo. +Arguments: + all/required. If all is specified, then this script + will install all the prerequisites." + exit 1 +fi + +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." + +sudo -v + + +sudo yum update -y + +# Install repositories + +sudo yum config-manager --enable *codeready* + +sudo yum config-manager --enable *crb* + +sudo yum config-manager --enable *powertools* + +sudo yum config-manager --enable *extras* + +sudo subscription-manager repos --enable *powertools* + +sudo subscription-manager repos --enable *codeready* + +sudo subscription-manager repos --disable "codeready-builder-for-rhel-*-x86_64-eus*" + +sudo yum update -y + +sudo yum install -y --nogpgcheck --skip-broken epel-release + +if $( cat /etc/os-release | grep -q 'PRETTY_NAME="Red Hat Enterprise Linux 9"' ); then + sudo dnf install \ +https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm +fi + +sudo yum update -y + + +# Install required packages + +if echo $(yum --version) | awk '{print $1}' | grep -Eiq 'dnf5' ; then + + sudo dnf install -y --nogpgcheck --skip-unavailable \ + $(cat $BDM_PROJECT_DIR/util/installation/rhel/common/package_list_required) + +else + + sudo yum install -y --nogpgcheck --skip-broken \ + $(cat $BDM_PROJECT_DIR/util/installation/rhel/common/package_list_required) + +fi + +curl -L -O https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh +chmod +x cmake-3.19.3-Linux-x86_64.sh +sudo ./cmake-3.19.3-Linux-x86_64.sh --skip-license --prefix=/usr/local + +if [ -n "${PYENV_ROOT}" ]; then + unset PYENV_ROOT +fi + +# If PyEnv is not installed, install it +if [ ! -f "$HOME/.pyenv/bin/pyenv" ]; then + echo "PyEnv was not found. Installing now..." + curl https://pyenv.run | bash +fi +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init --path)" +eval "$(pyenv init -)" +pyenv update + +PYVERS=3.9.1 + +# If Python $PYVERS is not installed, install it +if [ ! -f "$HOME/.pyenv/versions/$PYVERS/lib/libpython3.so" ]; then + echo "Python $PYVERS was not found. Installing now..." + /usr/bin/env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f $PYVERS +fi +pyenv shell $PYVERS + +# Install optional packages +if [ $1 == "all" ]; then + python -m pip install --upgrade pip + PIP_PACKAGES="markupsafe==2.0.1 nbformat jupyter metakernel jupyterlab nbformat==5.4.0 nbconvert==6.5.3 nbclient==0.6.6 setuptools cython" + # Don't install --user: the packages should end up in the PYENV_ROOT directory + python -m pip install $PIP_PACKAGES + # SBML integration + if echo $(yum --version) | awk '{print $1}' | grep -Eiq 'dnf5' ; then + + sudo dnf install -y --nogpgcheck --skip-unavailable \ + $(cat $BDM_PROJECT_DIR/util/installation/rhel/common/package_list_extra) + + else + + sudo yum install -y --nogpgcheck --skip-broken \ + $(cat $BDM_PROJECT_DIR/util/installation/rhel/common/package_list_extra) + + fi + +fi +. /etc/profile.d/modules.sh +module load mpi/openmpi-x86_64 + +exit 0 diff --git a/util/installation/suse/common/Dockerfile b/util/installation/suse/common/Dockerfile new file mode 100755 index 000000000..45e68264f --- /dev/null +++ b/util/installation/suse/common/Dockerfile @@ -0,0 +1,52 @@ +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +FROM centos:7 + +# workaround for https://github.com/containers/buildah/issues/1046 +RUN echo "" >> /etc/hosts && cat /etc/hosts && yum -y install setup + +# man required by ROOT +# mesa-dri-drivers: OpenGl driver (software renderer) +RUN yum update -y && yum install -y \ + git \ + sudo \ + man \ + wget \ + xorg-x11-server-Xvfb \ + mesa-dri-drivers + +RUN git config --system user.name "Test User" && \ + git config --system user.email user@test.com + +# update user id and group id such that mapped volumes can be accessed with the +# same rights as on the host. Files created by the container can also be +# accessed on the host without chowning. +ARG HOST_UID +ARG HOST_GID + +RUN groupadd -g $HOST_GID testuser && \ + useradd -u $HOST_UID -g $HOST_GID -m -c "Testuser" testuser && \ + passwd --delete testuser && \ + echo "testuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +USER testuser + +# preserve the environment variable BDM_LOCAL_LFS when calling scripts with +# sudo +RUN echo "Defaults env_keep += \"BDM_LOCAL_LFS\"" | sudo tee -a /etc/sudoers + +# the OpenGL capabilities can be incorrectly detected -> override version +# https://python.develop-bugs.com/article/10118323/paraview+needs+higher+OpenGL+in+Mesa +ENV MESA_GL_VERSION_OVERRIDE=3.3 diff --git a/util/installation/suse/common/package_list_extra b/util/installation/suse/common/package_list_extra new file mode 100755 index 000000000..7a9306e1b --- /dev/null +++ b/util/installation/suse/common/package_list_extra @@ -0,0 +1,41 @@ +doxygen +graphviz +libxml2-devel +fontconfig-devel +fontconfig +freetype +freetype-devel +llvm-toolset-7 +llvm-toolset-7-clang-tools-extra +llvm-toolset-7-llvm-devel +llvm-toolset-7-llvm-static +valgrind +gsl-devel +atlas-devel +blas-devel +lapack-devel +gcc-gfortran +openssl-devel +pcre-devel +mesa-libGL-devel +mesa-libGLU-devel +glew-devel +ftgl-devel +mysql-devel +fftw-devel +cfitsio-devel +graphviz-devel +avahi-compat-libdns_sd-devel +libldap-dev +python-devel +libxml2-devel +gsl-static +libXt-devel +freeglut3-devel +ncurses-devel +libxml2-devel +bzip2 +bzip2-devel +zlib +zlib-devel + diff --git a/util/installation/suse/common/package_list_required b/util/installation/suse/common/package_list_required new file mode 100755 index 000000000..1661e5d1c --- /dev/null +++ b/util/installation/suse/common/package_list_required @@ -0,0 +1,105 @@ +gcc +gcc-c++ +gcc-fortran +gcc11 +gcc11-c++ +gcc11-fortran +bc +make +patch +gmp-devel +mpfr-devel +mpc-devel +bzip2-devel +openmpi3-devel +freeglut-devel +git +clang-tools +libXext-devel +libXt-devel +numactl-devel +xmlsec1-devel +avahi-compat-mDNSResponder-devel +libnuma-devel +tk-devel +openmpi-devel +readline-devel +wget +zlib-devel +ffmpeg-devel +tk-devel +python-tk +bzip2 +libbz2-devel +readline-devel +sqlite +doxygen +sqlite-devel +openssl-devel +xz +xz-devel +libffi-devel +findutils +lapack-devel +blas-devel +llvm +clang +lldb +lld +libomp-devel +python3-lit +openmpi +libX11-devel +libXpm-devel +libXft-devel +libXext-devel +lapack-devel +valgrind +gsl-devel +atlascpp-devel +blas-devel +lapack-devel +openssl-devel +pcre-devel +Mesa-libGL-devel +Mesa-libGLU-devel +glew-devel +ftgl-devel +mysql-devel +fftw-devel +cfitsio-devel +graphviz-devel +avahi-compat-libdns_sd-devel +libdns_sd +python-devel +libxml2-devel +gsl-static +atlas-devel +libXt-devel +freeglut-devel +freeglut3-devel +ncurses-devel +openldap2-devel +freeglut-devel +gsl-devel +libxml2-devel +bzip2 +bzip2-devel +zlib +zlib-devel +libuuid-devel +ffmpeg-free-devel +libxkbcommon-devel +libxkbcommon-x11-devel +xcb-util-devel +xcb-util-image-devel +xcb-util-keysyms-devel +xcb-util-xrm-devel +xcb-util-cursor-devel +xcb-util-renderutil-devel +xcb-util-wm-devel +libXi-devel +xcb-proto-devel +tslib +tslib-devel +devtoolset-10-gcc* diff --git a/util/installation/suse/common/prerequisites.sh b/util/installation/suse/common/prerequisites.sh new file mode 100755 index 000000000..35fa9b297 --- /dev/null +++ b/util/installation/suse/common/prerequisites.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (C) 2021 CERN & University of Surrey for the benefit of the +# BioDynaMo collaboration. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# +# See the LICENSE file distributed with this work for details. +# See the NOTICE file distributed with this work for additional information +# regarding copyright ownership. +# +# ----------------------------------------------------------------------------- + +# This script installs the required packages +if [[ $# -ne 1 ]]; then + echo "ERROR: Wrong number of arguments. +Description: + This script installs the prerequisites of BioDynaMo, but not BioDynaMo + itself. Script install.sh installs both prerequisites and BioDynaMo. +Arguments: + all/required. If all is specified, then this script + will install all the prerequisites." + exit 1 +fi + +BDM_PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../.." + +sudo -v + + +sudo zypper update -y + +# Install repositories + + +# Install required packages +sudo zypper --no-gpg-checks --ignore-unknown install -y \ + $(cat $BDM_PROJECT_DIR/util/installation/suse/common/package_list_required) + +curl -L -O https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3-Linux-x86_64.sh +chmod +x cmake-3.19.3-Linux-x86_64.sh +sudo ./cmake-3.19.3-Linux-x86_64.sh --skip-license --prefix=/usr/local + +if [ -n "${PYENV_ROOT}" ]; then + unset PYENV_ROOT +fi + +# If PyEnv is not installed, install it +if [ ! -f "$HOME/.pyenv/bin/pyenv" ]; then + echo "PyEnv was not found. Installing now..." + curl https://pyenv.run | bash +fi +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init --path)" +eval "$(pyenv init -)" +pyenv update + +PYVERS=3.9.1 + +# If Python $PYVERS is not installed, install it +if [ ! -f "$HOME/.pyenv/versions/$PYVERS/lib/libpython3.so" ]; then + echo "Python $PYVERS was not found. Installing now..." + /usr/bin/env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f $PYVERS +fi +pyenv shell $PYVERS + +# Install optional packages +if [ $1 == "all" ]; then + python -m pip install --upgrade pip + PIP_PACKAGES="markupsafe==2.0.1 nbformat jupyter metakernel jupyterlab nbformat==5.4.0 nbconvert==6.5.3 nbclient==0.6.6 setuptools cython" + # Don't install --user: the packages should end up in the PYENV_ROOT directory + python -m pip install $PIP_PACKAGES + # SBML integration + + sudo zypper --no-gpg-checks --ignore-unknown install -y \ + $(cat $BDM_PROJECT_DIR/util/installation/suse/common/package_list_extra) +fi + +exit 0 diff --git a/util/simulation-template/.gitignore b/util/simulation-template/.gitignore old mode 100644 new mode 100755 diff --git a/util/simulation-template/CMakeLists.txt b/util/simulation-template/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/util/simulation-template/README.md b/util/simulation-template/README.md old mode 100644 new mode 100755 diff --git a/util/simulation-template/src/my-simulation.cc b/util/simulation-template/src/my-simulation.cc old mode 100644 new mode 100755 diff --git a/util/simulation-template/src/my-simulation.h b/util/simulation-template/src/my-simulation.h old mode 100644 new mode 100755 diff --git a/util/simulation-template/test/test-main.cc b/util/simulation-template/test/test-main.cc old mode 100644 new mode 100755 diff --git a/util/simulation-template/test/test-suite.cc b/util/simulation-template/test/test-suite.cc old mode 100644 new mode 100755 diff --git a/util/valgrind-bdm.supp b/util/valgrind-bdm.supp old mode 100644 new mode 100755 diff --git a/util/version/version.h b/util/version/version.h old mode 100644 new mode 100755 diff --git a/util/version/version.py b/util/version/version.py old mode 100644 new mode 100755