
if [ "$(uname)" == "Darwin" ]; then

    # TOGGLE: intel for psi4
    # Intel atop conda Clang
    #CMAKE_C_FLAGS="${CFLAGS} -clang-name=${CLANG} -msse4.1 -axCORE-AVX2"
    #-DCMAKE_C_COMPILER=icc \

    CMAKE_C_FLAGS="${CFLAGS}"

    # configure
    ${BUILD_PREFIX}/bin/cmake \
        -H${SRC_DIR} \
        -Bbuild \
        -DCMAKE_INSTALL_PREFIX=${PREFIX} \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_C_COMPILER=${CC} \
        -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DNAMESPACE_INSTALL_INCLUDEDIR="/" \
        -DBUILD_SHARED_LIBS=ON \
        -DENABLE_XHOST=OFF \
        -DBUILD_TESTING=ON
fi

#####
#                       -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
#                       -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
#####
if [ "$(uname)" == "Linux" ]; then

    # load Intel compilers and mkl
    source /theoryfs2/common/software/intel2021/oneapi/setvars.sh --config="/theoryfs2/common/software/intel2021/oneapi/config-no-intelpython.txt" intel64

    # link against conda MKL & GCC
    ALLOPTS="-gnu-prefix=${HOST}- ${OPTS}"

    # configure
    ${BUILD_PREFIX}/bin/cmake \
        -H${SRC_DIR} \
        -Bbuild \
        -DCMAKE_INSTALL_PREFIX=${PREFIX} \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_C_COMPILER=icc \
        -DCMAKE_C_FLAGS="${ALLOPTS}" \
        -DCMAKE_CXX_COMPILER=icpc \
        -DCMAKE_CXX_FLAGS="${ALLOPTS}" \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DNAMESPACE_INSTALL_INCLUDEDIR="/" \
        -DBUILD_SHARED_LIBS=ON \
        -DLIBECPINT_USE_PUGIXML=OFF \
        -DLIBECPINT_BUILD_TESTS=OFF \
        -DLIBECPINT_BUILD_DOCS=OFF \
        -DLIBECPINT_MAX_UNROL=1 \
        -DLIBECPINT_MAX_L=5
fi

# build
cmake --build build --target install #-j${CPU_COUNT}

# install
#make install

# test
#make test

# Notes
#    source /theoryfs2/common/software/intel2018/bin/compilervars.sh intel64
