# The Android NDK requires CMake 3.6 or higher.
# See https://github.com/caffe2/caffe2/pull/1740 for more info.
CMAKE_VERSION=3.6.3
+
+ if [[ "$image" == *-ndk-* ]]; then
+ ANDROID_NDK_VERSION="$(echo "${image}" | perl -n -e'/-ndk-([^-]+)/ && print $1')"
+ fi
fi
if [[ "$image" == *-gcc* ]]; then
--build-arg "CUDNN_VERSION=${CUDNN_VERSION}" \
--build-arg "MKL=${MKL}" \
--build-arg "ANDROID=${ANDROID}" \
+ --build-arg "ANDROID_NDK=${ANDROID_NDK_VERSION}" \
--build-arg "GCC_VERSION=${GCC_VERSION}" \
--build-arg "CLANG_VERSION=${CLANG_VERSION}" \
--build-arg "CMAKE_VERSION=${CMAKE_VERSION:-}" \
set -ex
+[ -n "${ANDROID_NDK}" ] || ANDROID_NDK=r13b
+
apt-get update
apt-get install -y --no-install-recommends autotools-dev autoconf unzip
apt-get autoclean && apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
pushd /tmp
-curl -Os https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
+curl -Os https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK}-linux-x86_64.zip
popd
_ndk_dir=/opt/ndk
mkdir -p "$_ndk_dir"
# (optional) Install Android NDK
ARG ANDROID
+ARG ANDROID_NDK
ADD ./install_android.sh install_android.sh
RUN if [ -n "${ANDROID}" ]; then bash ./install_android.sh; fi
RUN rm install_android.sh