XTL_VERSION=0.6.4
XSIMD_VERSION=7.2.3
XTENSOR_VERSION=0.20.8
XTENSOR_R_VERSION=0.11.1

# xtl
if [ -d "./inst/include/xtl" ]
then
    echo "xtl headers already vendored in source package"
else
    git clone https://github.com/QuantStack/xtl --branch ${XTL_VERSION}
    cp -r xtl/include/xtl ./inst/include
    rm -rf xtl
fi

# xsimd
if [ -d "./inst/include/xsimd" ]
then
    echo "xsimd headers already vendored in source package"
else
    git clone https://github.com/QuantStack/xsimd --branch ${XSIMD_VERSION}
    cp -r xsimd/include/xsimd ./inst/include
    rm -rf xsimd
fi

# xtensor
if [ -d "./inst/include/xtensor" ]
then
    echo "xtensor headers already vendored in source package"
else
    git clone https://github.com/QuantStack/xtensor --branch ${XTENSOR_VERSION}
    DIRECTORY=$(cd `dirname $0` && pwd)
    git -C xtensor apply $DIRECTORY/0001-Remove-pragmas.patch
    cp -r xtensor/include/xtensor ./inst/include
    rm -rf xtensor
fi

# xtensor-r
if [ -d "./inst/include/xtensor-r" ]
then
    echo "xtensor-r headers already vendored in source package"
else
    git clone https://github.com/QuantStack/xtensor-r --branch ${XTENSOR_R_VERSION}
    cp -r xtensor-r/include/xtensor-r ./inst/include
    rm -rf xtensor-r
fi

