Skip to content
Snippets Groups Projects
bc2-conf 2.55 KiB
#!/bin/sh

# This script is aware of out-of-source builds. Just call it from within the
# build directory. Does not work from top-level dir.
# Meant to work on bc2 cluster (and probably nowhere else)!

function usage_centos6
{
  echo 'usage:'
  echo '  bc2-conf [OPTIONS]'
  echo '  If no OPTIONS given, a default OST module is loaded.'
  echo '  If any OPTIONS given, they must contain one special option:'
  echo '  -DOST_ROOT=<PATH TO OST/stage>, which points to a specific OST path.'
  echo '  In that case, you must have all dependencies of OST loaded as modules'
  echo '  before calling this function!'
  echo '  Other valid options are anything that CMake accepts.'
  exit 1
}

NUM_PARAMS=$#
CENTOS_RELEASE=$(lsb_release -r |awk {'print $2'})
CENTOS_MAJOR=(${CENTOS_RELEASE//./ })
PROMOD3_SRC=$(cd `dirname $0`; pwd)
# Going up one level is intentionally, please go out of source. Just create
# a directory at your repository root, prefixed 'build'. Change into it and
# call script from there.
PROMOD3_SRC=${PROMOD3_SRC}/..

if test "$CENTOS_MAJOR" == "6"; then
    # configuration for the new environment

    # checking to switch OST_ROOT
    cmd_params=
    if test "$NUM_PARAMS" -gt "0"; then
        IFS=" "
        for opt in $@; do
            if test ${opt:0:11} == "-DOST_ROOT="; then
                EBROOTOPENSTRUCTURE=$(cd ${opt:11}; pwd)
            else
                cmd_params="${cmd_params} ${opt}"
            fi
        done
    else
        module load OpenStructure/.1.7.0-RC-goolf-1.4.10_20170822
    fi

    # load required modules
    module load git/1.8.5.6-goolf-1.4.10 \
                CMake/2.8.12-goolf-1.4.10 \
                Python/2.7.5-goolf-1.4.10 \
                Eigen/3.3.1 \
                Boost/1.53.0-goolf-1.4.10-Python-2.7.5
    # run cmake
    cmake $PROMOD3_SRC                                              \
         -DOST_ROOT=$EBROOTOPENSTRUCTURE                            \
         -DPYTHON_ROOT=$EBROOTPYTHON                                \
         -DEIGEN3_INCLUDE_DIR="${EBROOTEIGEN}/include"              \
         -DBOOST_ROOT=$EBROOTBOOST                                  \
         -DDISABLE_DOCUMENTATION=ON                                 \
         -DOPTIMIZE=1 -DENABLE_SSE=1                                \
         $cmd_params
else
    echo 'Only the CentOS 6 version of bc2 is supported'
    # TODO: update for CentOS 7
fi


## Emacs magic
# Local Variables:
# mode: shell-script
# End:

#  LocalWords:  SRC OST promod CMake NUM PARAMS lt fi cd dir centos bc EIGEN
#  LocalWords:  pwd dirname cmake DPYTHON DBOOST conf Eigen DEIGEN