blob: b0bf1dcaa2507c12368b5ee121dd836046e06c88 [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}
James Conroy04cd6032022-04-20 17:16:50 +010070# shellcheck disable=SC1083
71if [ "$(git rev-parse HEAD)" = "$(git ls-remote "$(git rev-parse --abbrev-ref @{u} |
72sed 's/\// /g')" | cut -f1)" ]
Jegathesan Shanmugam0e6e8762020-03-26 22:25:32 +053073then
74 echo "Compute Lib Up-to-date"
75else
76 echo "New changes are availble for Compute Library repo."
77 echo "Do you wanna update (y/n)?"
James Conroy04cd6032022-04-20 17:16:50 +010078 read -r answer
Jegathesan Shanmugam0e6e8762020-03-26 22:25:32 +053079 if [ "$answer" != "${answer#[Yy]}" ] ;then
80 updateComputeLib
81 fi
82fi
83
84# Check Tensorflow changes from repo
85cd ${dTensorflow}
James Conroy04cd6032022-04-20 17:16:50 +010086# shellcheck disable=SC1083
87if [ "$(git rev-parse HEAD)" = "$(git ls-remote "$(git rev-parse --abbrev-ref @{u} |
88sed 's/\// /g')" | cut -f1)" ]
Jegathesan Shanmugam0e6e8762020-03-26 22:25:32 +053089then
90 echo "Tensrflow Lib Up-to-date"
91else
92 echo "Tensrflow Lib Not Up-to-date"
93 echo "Skipping for now. Issue: #267"
94 #echo "New changes are availble for Compute Library repo."
95 #echo "Do you wanna update (y/n)?"
96 #read answer
97 #if [ "$answer" != "${answer#[Yy]}" ] ;then
98 #
99 #fi
100fi
101
102# Check FlatBuffer changes from repo
103cd ${dFlatBuffer}
James Conroy04cd6032022-04-20 17:16:50 +0100104# shellcheck disable=SC1083
105if [ "$(git rev-parse HEAD)" = "$(git ls-remote "$(git rev-parse --abbrev-ref @{u} |
106sed 's/\// /g')" | cut -f1)" ]
Jegathesan Shanmugam0e6e8762020-03-26 22:25:32 +0530107then
108 echo "FlatBuffer Up-to-date"
109else
110 echo "FlatBuffer Not Up-to-date"
111 echo "New changes are availble for Compute Library repo."
112 echo "Do you wanna update (y/n)?"
James Conroy04cd6032022-04-20 17:16:50 +0100113 read -r answer
Jegathesan Shanmugam0e6e8762020-03-26 22:25:32 +0530114 if [ "$answer" != "${answer#[Yy]}" ] ;then
115 updateFlatBuffer
116 fi
117fi
118
119exec "$@"