Install ecCodes with intel compilers

module load intel/2022.2
export CC=icc
export FC=ifort

module load cmake/3.26.4
module load netcdf/intel/4.9.1
 
mkdir build ; cd build
echo `pwd`
parentdir="$(dirname "$(pwd)")"
export PREFIX=$parentdir
echo "builing for "$PREFIX
echo "Press ENTER to run cmake";read aaa

export HDF5=/sw/dataformats/hdf5/intel.22/1.12.2/skl
#export HDF5_LIBRARIES=$HDF5/lib 
export HDF5_LIBRARIES="$HDF5/lib/libhdf5.a $HDF5/lib/libhdf5_hl.a"
export HDF5_INCLUDE_DIRS=$HDF5/include
export PATH=$HDF5:$PATH

export NETCDF=`nc-config --prefix`

FFLAGS="-O3 -fPIC -xCORE-AVX512 -qopt-zmm-usage=high"
CFLAGS="-O3 -fPIC -xCORE-AVX512 -qopt-zmm-usage=high" 

export CC=icc
export FC=ifort
export CXX=icpc

cmake \
  -DCMAKE_C_COMPILER="$CC" -DCMAKE_Fortran_COMPILER="$FC" \
  -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_Fortran_FLAGS="$FFLAGS" \
  -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_CXX_FLAGS="$CFLAGS" \
  -DBUILD_SHARED_LIBS=BOTH \
  -DENABLE_MEMFS=ON \
  -DENABLE_PNG=ON \
  -DENABLE_JPG=ON \
  -DENABLE_AEC=ON -DAEC_DIR=/sw/dataformats/aec/1.0.6/skl/intel.19 \
  -DENABLE_FORTRAN=ON \
  -DENABLE_NETCDF=ON \
  -DENABLE_ECCODES_OMP_THREADS=ON \
  -DNETCDF_PATH=$NETCDF \
  -DENABLE_INSTALL_ECCODES_DEFINITIONS=ON \
  -DENABLE_INSTALL_ECCODES_SAMPLES=ON \
  -DCMAKE_INSTALL_PREFIX="$PREFIX" ../src

echo "Press ENTER to run make";read aaa
make -j8
echo "Press ENTER to run ctest";read aaa
ctest
echo "Press ENTER to run make install";read aaa
make install
echo "Do not forget to run make clean!"