From 95897fd1e153843ee52b99c1b58e5835eaf831ae Mon Sep 17 00:00:00 2001 From: Liu Yiqun Date: Thu, 13 Jul 2017 08:39:44 +0000 Subject: [PATCH] Add build_android task on Travis CI. --- .travis.yml | 8 ++++++++ paddle/scripts/travis/build_android.sh | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 paddle/scripts/travis/build_android.sh diff --git a/.travis.yml b/.travis.yml index 498674469b2..8ac67e5720d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ cache: - $HOME/.ccache - $HOME/.cache/pip - $TRAVIS_BUILD_DIR/build/third_party + - $HOME/android-toolchain-gcc sudo: required dist: trusty os: @@ -11,6 +12,7 @@ os: env: - JOB=build_doc - JOB=check_style + - JOB=build_android addons: apt: packages: @@ -33,6 +35,12 @@ addons: - ccache before_install: - if [[ "$JOB" == "check_style" ]]; then sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format; fi + - if [[ "JOB" == "build_android" ]]; then + mkdir -p $HOME/tmp/$JOB; + cd $HOME/tmp/$JOB; wget -q https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip; unzip -q android-ndk-r14b-linux-x86_64.zip; + sh $HOME/tmp/$JOB/android-ndk-r14b/build/tools/make-standalone-toolchain.sh --arch=arm --platform=android-21 --install-dir=$HOME/android-toolchain-gcc; + cd $HOME; rm -rf $HOME/tmp/$JOB; + fi # Paddle is using protobuf 3.1 currently. Protobuf 3.2 breaks the compatibility. So we specify the python # protobuf version. - pip install numpy wheel 'protobuf==3.1' sphinx==1.5.6 recommonmark sphinx-rtd-theme==0.1.9 virtualenv pre-commit requests==2.9.2 LinkChecker diff --git a/paddle/scripts/travis/build_android.sh b/paddle/scripts/travis/build_android.sh new file mode 100755 index 00000000000..dd4ad29b187 --- /dev/null +++ b/paddle/scripts/travis/build_android.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +# Create the build directory for CMake. +mkdir -p $TRAVIS_BUILD_DIR/build_android +cd $TRAVIS_BUILD_DIR/build_android + +# Compile paddle binaries +cmake -DCMAKE_SYSTEM_NAME=Android \ + -DANDROID_STANDALONE_TOOLCHAIN=$HOME/android-toolchain-gcc \ + -DANDROID_ABI=armeabi-v7a \ + -DANDROID_ARM_NEON=ON \ + -DANDROID_ARM_MODE=ON \ + -DWITH_C_API=ON \ + -DWITH_SWIG_PY=OFF \ + -DWITH_STYLE_CHECK=OFF \ + .. + +make -j `nproc` -- GitLab