diff --git a/install.sh b/install.sh new file mode 100644 index 0000000000000000000000000000000000000000..e6cb0ac3a3e6cb198cc2c57523b620b2e8623b2a --- /dev/null +++ b/install.sh @@ -0,0 +1,96 @@ +# one click install script dune-mmdg +echo " " +echo " " +echo "*********************************************************************************************" +echo "(0/3) Checking all prerequistes. (git cmake gcc g++ paraview)" +echo "*********************************************************************************************" + +# check some prerequistes +for PRGRM in git cmake gcc g++ paraview; do + if ! [ -x "$(command -v $PRGRM)" ]; then + echo "Error: $PRGRM is not installed." >&2 + exit 1 + fi +done + +# check gcc version for C++17 support +currentver="$(gcc -dumpversion)" +requiredver="7" +if [ "$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head -n1)" != "$requiredver" ]; then + echo "gcc greater than or equal to $requiredver is required!" >&2 + exit 1 +fi + +if [ $? -ne 0 ]; then + echo "*********************************************************************************************" + echo "(0/3) An error occured while checking for prerequistes." + echo "*********************************************************************************************" + exit $? +else + echo "*********************************************************************************************" + echo "(1/3) All prerequistes found." + echo "*********************************************************************************************" +fi + +echo " " +echo " " + +echo "*********************************************************************************************" +echo "(1/3) Cloning repositories. This may take a while. Make sure to be connected to the internet." +echo "*********************************************************************************************" + +# the core modules +for MOD in common geometry grid istl; do + if [ ! -d "dune-$MOD" ]; then + git clone https://gitlab.dune-project.org/core/dune-$MOD.git + else + echo "Skip cloning dune-$MOD because the folder already exists." + fi +done + +# dune-mmesh +if [ ! -d "dune-mmesh" ]; then + git clone https://gitlab.dune-project.org/samuel.burbulla/dune-mmesh +else + echo "Skip cloning dune-mmesh because the folder already exists." +fi + +# dune-mmdg +if [ ! -d "dune-mmdg" ]; then + git clone https://gitlab.mathematik.uni-stuttgart.de/hoerlmn/dune-mmdg +else + echo "Skip cloning dune-mmdg because the folder already exists." +fi + +if [ $? -ne 0 ]; then + echo "*********************************************************************************************" + echo "(1/3) Failed to clone the repositories. Look for repository specific errors." + echo "*********************************************************************************************" + exit $? +else + echo "*********************************************************************************************" + echo "(2/3) All repositories have been cloned into a containing folder." + echo "*********************************************************************************************" +fi + +echo " " +echo " " + +echo "**************************************************************************************************" +echo "(2/3) Configure and build dune modules using dunecontrol. This may take several minutes." +echo "**************************************************************************************************" + +# run dunecontrol +./dune-common/bin/dunecontrol --opts=dune-mmdg/cmake.opts all + +if [ $? -ne 0 ]; then + echo "*********************************************************************************************" + echo "(2/3) Failed to build the dune libaries." + echo "*********************************************************************************************" + exit $? +else + echo "*****************************************************************************************************" + echo "(3/3) Succesfully configured and built dune." + echo " Go to dune-mmdg/README for further information." + echo "*****************************************************************************************************" +fi