summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorPieter Noordhuis <pietern@fb.com>2018-01-16 12:55:17 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-01-16 12:59:35 -0800
commit559380c9ea60456d920ad570729953b6035e8169 (patch)
tree57ea509fe55c78fd405ced62a0a2ef6693d17215 /docker
parent1fd05df738c50b099c3e3cdc91acee1d72cea9fb (diff)
downloadpytorch-559380c9ea60456d920ad570729953b6035e8169.tar.gz
pytorch-559380c9ea60456d920ad570729953b6035e8169.tar.bz2
pytorch-559380c9ea60456d920ad570729953b6035e8169.zip
Install CMake 3.6.3 in base image for Android build
Summary: This is needed for #1740. Verified that `./build.sh py2-android-ubuntu16.04` builds an Android base image with CMake 3.6.3. Closes https://github.com/caffe2/caffe2/pull/1747 Differential Revision: D6729823 Pulled By: pietern fbshipit-source-id: f7c888b4fba14ff6ea703cc269175b327b49f6b8
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/jenkins/build.sh5
-rwxr-xr-xdocker/jenkins/common/install_cmake.sh16
-rw-r--r--docker/jenkins/ubuntu/Dockerfile6
3 files changed, 27 insertions, 0 deletions
diff --git a/docker/jenkins/build.sh b/docker/jenkins/build.sh
index 418df2e0e8..5b83d57198 100755
--- a/docker/jenkins/build.sh
+++ b/docker/jenkins/build.sh
@@ -69,6 +69,10 @@ fi
if [[ "$image" == *-android-* ]]; then
ANDROID=yes
+
+ # 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
fi
if [[ "$image" == *-gcc* ]]; then
@@ -105,5 +109,6 @@ docker build \
--build-arg "ANDROID=${ANDROID}" \
--build-arg "GCC_VERSION=${GCC_VERSION}" \
--build-arg "CLANG_VERSION=${CLANG_VERSION}" \
+ --build-arg "CMAKE_VERSION=${CMAKE_VERSION:-}" \
"$@" \
"$(dirname ${DOCKERFILE})"
diff --git a/docker/jenkins/common/install_cmake.sh b/docker/jenkins/common/install_cmake.sh
new file mode 100755
index 0000000000..ddae4cbccc
--- /dev/null
+++ b/docker/jenkins/common/install_cmake.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -ex
+
+[ -n "$CMAKE_VERSION" ]
+
+# Turn 3.6.3 into v3.6
+path=$(echo "${CMAKE_VERSION}" | sed -e 's/\([0-9].[0-9]\+\).*/v\1/')
+file="cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
+
+# Download and install specific CMake version in /usr/local
+pushd /tmp
+curl -Os "https://cmake.org/files/${path}/${file}"
+tar -C /usr/local --strip-components 1 --no-same-owner -zxf cmake-*.tar.gz
+rm -f cmake-*.tar.gz
+popd
diff --git a/docker/jenkins/ubuntu/Dockerfile b/docker/jenkins/ubuntu/Dockerfile
index a102c747ae..6e57d6c8d2 100644
--- a/docker/jenkins/ubuntu/Dockerfile
+++ b/docker/jenkins/ubuntu/Dockerfile
@@ -45,6 +45,12 @@ ADD ./install_clang.sh install_clang.sh
RUN if [ -n "${CLANG_VERSION}" ]; then bash ./install_clang.sh; fi
RUN rm install_clang.sh
+# (optional) Install non-default CMake version
+ARG CMAKE_VERSION
+ADD ./install_cmake.sh install_cmake.sh
+RUN if [ -n "${CMAKE_VERSION}" ]; then bash ./install_cmake.sh; fi
+RUN rm install_cmake.sh
+
# (optional) Add Jenkins user
ARG JENKINS
ARG JENKINS_UID