diff options
author | James Conroy <james.conroy@arm.com> | 2022-07-13 12:57:53 +0100 |
---|---|---|
committer | Nikhil Raj <nikhil.raj@arm.com> | 2022-07-27 15:58:17 +0100 |
commit | 919ec71ea7f44bb2d284eb88cda511c2424358b2 (patch) | |
tree | 2b1c086805324ae4f4517653a913ba177baeccc2 /build-tool/scripts/common.sh | |
parent | 4073e147982df3022ea97cb85179c8c7a695a17a (diff) | |
download | armnn-919ec71ea7f44bb2d284eb88cda511c2424358b2.tar.gz |
IVGCVSW-6776 Add Arm NN build-tool scripts
* Initial scripts which download and build Arm NN
dependencies (setup-armnn.sh) and build both
Arm NN and ACL (build-armnn.sh).
* Also added common.sh for handling common variables
between scripts and validation.sh for common
command line arg validation.
Signed-off-by: James Conroy <james.conroy@arm.com>
Change-Id: I6a61149d048f618b4cc9770cc9dd6ec2e5f64ea5
Diffstat (limited to 'build-tool/scripts/common.sh')
-rwxr-xr-x | build-tool/scripts/common.sh | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/build-tool/scripts/common.sh b/build-tool/scripts/common.sh new file mode 100755 index 0000000000..522bfb68cd --- /dev/null +++ b/build-tool/scripts/common.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +# Script which stores common variables and paths used by setup-armnn.sh and build-armnn.sh + +# shellcheck disable=SC2034 +# SC2034: false positives for variables appear unused - variables are used in setup-armnn.sh and build-armnn.sh + +set -o nounset # Catch references to undefined variables. +set -o pipefail # Catch non zero exit codes within pipelines. +set -o errexit # Catch and propagate non zero exit codes. + +# ROOT_DIR is the directory in which a script is called from +ROOT_DIR=$(pwd) +SOURCE_DIR="$ROOT_DIR"/source +BUILD_DIR="$ROOT_DIR"/build + +# Host architecture e.g. x86_64, aarch64 +HOST_ARCH=$(uname -m) + +# Number of online cores on host +NUM_THREADS=$(getconf _NPROCESSORS_ONLN) + +# Validate common user-defined options +# shellcheck source=validation.sh +source "$rel_path"/validation.sh + +# target_arch supplied as command line arg +TARGET_ARCH="$target_arch" + +NATIVE_BUILD=0 +if [ "$TARGET_ARCH" == "$HOST_ARCH" ]; then + NATIVE_BUILD=1 +fi + +AARCH64_COMPILER_FLAGS+="CC=/usr/bin/aarch64-linux-gnu-gcc CXX=/usr/bin/aarch64-linux-gnu-g++ " +AARCH32_COMPILER_FLAGS+="CC=/usr/bin/arm-linux-gnueabihf-gcc CXX=/usr/bin/arm-linux-gnueabihf-g++ " + +# Flatbuffers +FLATBUFFERS_VERSION=1.12.0 +FLATBUFFERS_SRC="$SOURCE_DIR"/flatbuffers-"$FLATBUFFERS_VERSION" +FLATBUFFERS_BUILD_ROOT="$BUILD_DIR"/flatbuffers +FLATBUFFERS_BUILD_TARGET="$FLATBUFFERS_BUILD_ROOT"/"$TARGET_ARCH"_build +FLATBUFFERS_BUILD_HOST="$FLATBUFFERS_BUILD_ROOT"/"$HOST_ARCH"_build # Location of flatc compiler + +# Tensorflow +TENSORFLOW_SRC="$SOURCE_DIR"/tensorflow +TFLITE_SRC="$TENSORFLOW_SRC"/tensorflow/lite +SCHEMA_SRC="$TFLITE_SRC"/schema/schema.fbs + +# TF Lite Schema +FLATC="$FLATBUFFERS_BUILD_HOST"/bin/flatc +TFLITE_BUILD_ROOT="$BUILD_DIR"/tflite # Generated TF Lite Schema location +TFLITE_BUILD_TARGET="$TFLITE_BUILD_ROOT"/"$TARGET_ARCH"_build + +# Protobuf +PROTOBUF_VERSION=3.12.0 +PROTOBUF_SRC="$SOURCE_DIR"/protobuf-"$PROTOBUF_VERSION" +PROTOBUF_BUILD_ROOT="$BUILD_DIR"/protobuf +PROTOBUF_BUILD_HOST="$PROTOBUF_BUILD_ROOT"/"$HOST_ARCH"_build +PROTOCOL_COMPILER_HOST="$PROTOBUF_BUILD_HOST"/bin/protoc +PROTOBUF_BUILD_TARGET="$PROTOBUF_BUILD_ROOT"/"$TARGET_ARCH"_build +PROTOBUF_LIBRARY_TARGET="$PROTOBUF_BUILD_TARGET"/lib/libprotobuf.so.23.0.0 + +# ONNX +ONNX_VERSION=1.6.0 +ONNX_SRC="$SOURCE_DIR"/onnx-"$ONNX_VERSION" +ONNX_BUILD_TARGET="$BUILD_DIR"/onnx/"$TARGET_ARCH"_build + +# Arm NN / ACL +ARMNN_SRC="$SOURCE_DIR"/armnn +ACL_SRC="$SOURCE_DIR"/acl
\ No newline at end of file |