store_environment.sh 3.06 KB
Newer Older
1 2 3 4
# script to store environment settings for later use in cmake

echo "set(compile_user $USER)" >config.cmake

Daniel Wortmann's avatar
Daniel Wortmann committed
5
#Some freqeuntly used Environment variables
6 7 8 9 10
if [ ! -z ${HDF5_ROOT+x} ] ; then FLEUR_LIBDIR="$FLEUR_LIBDIR $HDF5_ROOT/lib" ; FLEUR_INCLUDEDIR="$FLEUR_INCLUDEDIR $HDF5_ROOT/include" ; fi
if [ ! -z ${HDF5_DIR+x} ] ; then FLEUR_LIBDIR="$FLEUR_LIBDIR $HDF5_DIR/lib" ; FLEUR_INCLUDEDIR="$FLEUR_INCLUDEDIR $HDF5_DIR/include" ; fi
if [ ! -z ${HDF5_LIB+x} ] ; then FLEUR_LIBDIR="$FLEUR_LIBDIR $HDF5_LIB" ; fi
if [ ! -z ${HDF5_INCLUDE+x} ] ; then FLEUR_INCLUDEDIR="$FLEUR_INCLUDEDIR $HDF5_INCLUDE" ; fi
if [ ! -z ${HDF5_MODULES+x} ] ; then FLEUR_INCLUDEDIR="$FLEUR_INCLUDEDIR $HDF5_MODULES" ; fi
Daniel Wortmann's avatar
Daniel Wortmann committed
11 12


13 14 15 16 17 18 19 20 21 22 23 24 25 26

#Set options for linker
#1. if environment variable FLEUR_LIBRARIES is present use it 
#2. if CLI_LIBRARIES is present, use it
#3. if FLEUR_LIBDIR is present, add these directories with -L option

if [ "$FLEUR_LIBRARIES" ]
then
    cmake_lib="$FLEUR_LIBRARIES"
fi
if [ "$CLI_LIBRARIES" ]
then
    if [ "cmake_lib" ]
    then
27
	cmake_lib="$CLI_LIBRARIES;$cmake_lib"
28 29 30 31 32
    else
	cmake_lib="$CLI_LIBRARIES"
    fi
fi
#check the FLEUR_LIBDIR variable
Daniel Wortmann's avatar
Daniel Wortmann committed
33 34

for lib in $FLEUR_LIBDIR $CLI_LIBDIR 
35 36 37
do
    if [ "cmake_lib" ]
    then
38
	cmake_lib="-L$lib;$cmake_lib"
39 40 41 42 43 44 45 46 47 48 49 50
    else
	cmake_lib="-L$lib"
    fi
done

echo "set(FLEUR_LIBRARIES $cmake_lib)" >>config.cmake

#Set compiler flags
#1. If CMAKE_Fortran_FLAGS is given use that
#2. If CLI_FLAGS is given use that
#3. If FLEUR_INCLUDEDIR/CLI_INCLUDEDIR is given, add -I options for these

51
if [ "$CMAKE_Fortran_FLAGS" ]
52 53 54 55 56
then
    cmake_flags="$CMAKE_Fortran_FLAGS"
fi
if [ "$CLI_FLAGS" ]
then
Daniel Wortmann's avatar
Daniel Wortmann committed
57
    cmake_flags="$CLI_FLAGS $cmake_flags"
58 59 60
fi
for lib in $FLEUR_INCLUDEDIR $CLI_INCLUDEDIR
do
61
    cmake_flags="-I$lib $cmake_flags"
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
done
echo "set(CMAKE_Fortran_FLAGS \"$cmake_flags\")" >>config.cmake

#Set options to turn on/off specific features


if [ "$FLEUR_USE_HDF5" ] || [ "$FLEUR_USE_SERIAL" ] || [ "$FLEUR_USE_MPI" ] || [ "$FLEUR_USE_WANNIER" ] || [ "$FLEUR_USE_MAGMA" ] || [ "$FLEUR_USE_GPU" ]
then
    echo "WARNING"
    echo "The FLEUR_USE_XXX environment variables are no longer supported, use the command line options instead"
fi    

if [ "$CLI_USE_HDF5" ]
then
    echo "set(CLI_FLEUR_USE_HDF5 $CLI_USE_HDF5)"  >>config.cmake
fi

if [ "$CLI_USE_MPI" ]
then
    echo "set(CLI_FLEUR_USE_MPI $CLI_USE_MPI)"  >>config.cmake
fi

if [ "$CLI_USE_WANNIER" ]
then
    echo "set(CLI_FLEUR_USE_WANNIER $CLI_USE_WANNIER)"  >>config.cmake
fi

89 90 91 92 93
if [ "$CLI_USE_CHASE" ]
then
    echo "set(CLI_FLEUR_USE_CHASE $CLI_USE_CHASE)"  >>config.cmake
fi

94 95 96 97 98 99 100 101 102 103
if [ "$CLI_USE_MAGMA" ]
then
    echo "set(CLI_FLEUR_USE_MAGMA $CLI_USE_MAGMA)"  >>config.cmake
fi

if [ "$CLI_USE_GPU" ]
then
    echo "set(CLI_FLEUR_USE_GPU $CLI_USE_GPU)"  >>config.cmake
fi

104 105 106 107 108
if [ "$CLI_USE_LIBXC" ]
then
    echo "set(CLI_FLEUR_USE_LIBXC $CLI_USE_LIBXC)"  >>config.cmake
fi

109 110
if [ "$CLI_USE_SERIAL" ]
then
111
    echo "set(CLI_FLEUR_USE_SERIAL $CLI_USE_SERIAL)"  >>config.cmake
112 113 114 115 116 117 118
fi

if [ "$CLI_ELPA_OPENMP" ]
then
    echo "set(CLI_ELPA_OPENMP 1)"  >>config.cmake
fi

119 120 121 122 123
if [ "$CLI_WARN_ONLY" ]
then
    echo "set(CLI_WARN_ONLY 1)"  >>config.cmake
fi

124 125