| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #!/bin/bash
- set -e
- root=$(cd $(dirname ${0})/..; pwd)
- build=${root}/build
- src=${root}/src
- third_party=${root}/third_party
- tools=${root}/tools
- identifier=armnn
- bold() {
- echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
- }
- clean() {
- bold "armnn clean"
- rm -rf ${third_party}/armnn
- }
- sync() {
- bold "armnn sync"
- mkdir -p "${third_party}"
- if [ -d "${third_party}/armnn" ]; then
- git -C "${third_party}/armnn" pull --quiet --prune
- else
- git -C "${third_party}" clone --quiet --branch master --recursive https://github.com/ARM-software/armnn.git
- fi
- git -C "${third_party}/armnn" submodule sync --quiet
- git -C "${third_party}/armnn" submodule update --quiet --init --recursive
- }
- schema() {
- bold "armnn schema"
- case "${OSTYPE}" in
- linux*)
- FLATC_VERSION=$(curl -s https://api.github.com/repos/google/flatbuffers/releases/latest | grep tag_name | cut -f 2 -d : | cut -f 2 -d '"')
- FLATC_DIR=$(dirname $(mktemp -u))/flatbuffers/${FLATC_VERSION}
- if [ ! -f "${FLATC_DIR}/flatc" ]; then
- mkdir -p "${FLATC_DIR}"
- pushd "${FLATC_DIR}" > /dev/null
- curl -sL https://github.com/google/flatbuffers/archive/${FLATC_VERSION}.tar.gz | tar zx --strip-components 1
- cmake -G "Unix Makefiles" . &> /dev/null
- make > /dev/null
- popd > /dev/null
- fi
- FLATC=${FLATC_DIR}/flatc
- ;;
- darwin*)
- brew list flatbuffers > /dev/null 2>&1 || brew install flatbuffers > /dev/null
- FLATC=flatc
- ;;
- msys*)
- echo "msys flatc not supported" 1>&2
- exit 1
- ;;
- esac
- ${FLATC} --no-js-exports --js ${third_party}/armnn/src/armnnSerializer/ArmnnSchema.fbs
- mv ./ArmnnSchema_generated.js ${src}/armnn-schema.js
- cat <<EOT >> ${src}/armnn-schema.js
- if (typeof module !== 'undefined' && typeof module.exports === 'object') {
- module.exports = armnnSerializer;
- }
- EOT
- }
- while [ "$#" != 0 ]; do
- command="$1" && shift
- case "${command}" in
- "clean") clean;;
- "sync") sync;;
- "schema") schema;;
- esac
- done
|