if [ "${SAGE_LOCAL}" = "" ]; then
   echo "SAGE_LOCAL undefined ... exiting"
   echo "Maybe run 'sage -sh'?"
   exit 1
fi

echo "Building scipoptsuite with cmake"

cd src
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="${SAGE_LOCAL}"/ -DCMAKE_VERBOSE_MAKEFILE=ON -DGMP_DIR="${SAGE_LOCAL}" -DZLIB_ROOT="${SAGE_LOCAL}" -DReadline_ROOT_DIR="${SAGE_LOCAL}" -DBLISS_DIR="${SAGE_LOCAL}" -DIPOPT=FALSE
make
make install

$SAGE_LOCAL/bin/scip -s /dev/null -c quit

if [ $? -ne 0 ]; then
    echo "SCIP build completed but the scip executable does not work."
    exit 1
fi


echo "Finished building scipoptsuite"
