blob: 3a8258937b2a98449d53acd08622ea521724386c [file] [log] [blame]
Jegathesan Shanmugam0e6e8762020-03-26 22:25:32 +05301#!/bin/bash
2
3set -e
4
5dArmNN=/work
6dComputeLib=/home/armnn-devenv/ComputeLibrary
7dTensorflow=/home/armnn-devenv/google/tensorflow
8dFlatBuffer=/home/armnn-devenv/flatbuffers
9
10#Function to build ARMNN
11function buildArmNN()
12{
13 mkdir -p ${dArmNN}/armnn-devenv && cd ${dArmNN}/armnn-devenv
14 git clone https://github.com/ARM-software/armnn.git && cd armnn/
15 mkdir build && cd build
16 CXX=aarch64-linux-android-clang++ \
17 CC=aarch64-linux-android-clang \
18 CXX_FLAGS="-fPIE -fPIC" \
19 cmake .. \
20 -DCMAKE_SYSTEM_NAME=Android \
21 -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
22 -DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=/home/armnn-devenv/toolchains/aarch64-android-r17b/ \
23 -DCMAKE_EXE_LINKER_FLAGS="-pie -llog" \
24 -DARMCOMPUTE_ROOT=/home/armnn-devenv/ComputeLibrary/ \
25 -DARMCOMPUTE_BUILD_DIR=/home/armnn-devenv/ComputeLibrary/build \
26 -DBOOST_ROOT=/home/armnn-devenv/boost/install/ \
27 -DARMCOMPUTENEON=1 -DARMCOMPUTECL=1 -DARMNNREF=1 \
28 -DTF_GENERATED_SOURCES=/home/armnn-devenv/google/tf_pb/ -DBUILD_TF_PARSER=1 \
29 -DPROTOBUF_ROOT=/home/armnn-devenv/google/arm64_pb_install/
30 make -j8
31}
32
33# Function to update Compute Lib
34function updateComputeLib()
35{
36 pushd ${dComputeLib}
37 git pull
38 scons arch=arm64-v8a neon=1 opencl=1 embed_kernels=1 extra_cxx_flags="-fPIC" \
39 benchmark_tests=0 validation_tests=0 os=android -j8
40 echo "Compute Lib updated"
41 popd
42}
43
44# Function to update FlatBuffer Lib
45function updateFlatBuffer()
46{
47 pushd ${dFlatBuffer}
48 git pull
49 cd android && cd jni && \
50 rm -rf Application.mk && \
51 echo "APP_STL := c++_static" >> Application.mk && \
52 echo "NDK_TOOLCHAIN_VERSION" := clang >> Application.mk && \
53 echo "APP_CPPFLAGS :=-std=c++11" >> Application.mk && \
54 echo "APP_ABI := arm64-v8a" >> Application.mk && \
55 echo "APP_PLATFORM := android-23" >> Application.mk && \
56 echo "NDK_PLATFORM=android-23" >> Application.mk && \
57 cd ../ && ndk-build -B
58 echo "Compute Lib updated"
59 popd
60}
61
62# Main
63if [ ! -d "/work/armnn-devenv/armnn/" ];
64then
65 buildArmNN
66fi
67
68# Check Compute Library changes from repo
69cd ${dComputeLib}
70if [ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} |
71sed 's/\// /g') | cut -f1) ]
72then
73 echo "Compute Lib Up-to-date"
74else
75 echo "New changes are availble for Compute Library repo."
76 echo "Do you wanna update (y/n)?"
77 read answer
78 if [ "$answer" != "${answer#[Yy]}" ] ;then
79 updateComputeLib
80 fi
81fi
82
83# Check Tensorflow changes from repo
84cd ${dTensorflow}
85if [ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} |
86sed 's/\// /g') | cut -f1) ]
87then
88 echo "Tensrflow Lib Up-to-date"
89else
90 echo "Tensrflow Lib Not Up-to-date"
91 echo "Skipping for now. Issue: #267"
92 #echo "New changes are availble for Compute Library repo."
93 #echo "Do you wanna update (y/n)?"
94 #read answer
95 #if [ "$answer" != "${answer#[Yy]}" ] ;then
96 #
97 #fi
98fi
99
100# Check FlatBuffer changes from repo
101cd ${dFlatBuffer}
102if [ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} |
103sed 's/\// /g') | cut -f1) ]
104then
105 echo "FlatBuffer Up-to-date"
106else
107 echo "FlatBuffer Not Up-to-date"
108 echo "New changes are availble for Compute Library repo."
109 echo "Do you wanna update (y/n)?"
110 read answer
111 if [ "$answer" != "${answer#[Yy]}" ] ;then
112 updateFlatBuffer
113 fi
114fi
115
116exec "$@"