armnn 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. set -e
  3. root=$(cd $(dirname ${0})/..; pwd)
  4. build=${root}/build
  5. src=${root}/src
  6. third_party=${root}/third_party
  7. tools=${root}/tools
  8. identifier=armnn
  9. bold() {
  10. echo "$(tty -s && tput bold)$1$(tty -s && tput sgr0)"
  11. }
  12. clean() {
  13. bold "armnn clean"
  14. rm -rf ${third_party}/armnn
  15. }
  16. sync() {
  17. bold "armnn sync"
  18. mkdir -p "${third_party}"
  19. if [ -d "${third_party}/armnn" ]; then
  20. git -C "${third_party}/armnn" pull --quiet --prune
  21. else
  22. git -C "${third_party}" clone --quiet --branch master --recursive https://github.com/ARM-software/armnn.git
  23. fi
  24. git -C "${third_party}/armnn" submodule sync --quiet
  25. git -C "${third_party}/armnn" submodule update --quiet --init --recursive
  26. }
  27. schema() {
  28. bold "armnn schema"
  29. case "${OSTYPE}" in
  30. linux*)
  31. FLATC_VERSION=$(curl -s https://api.github.com/repos/google/flatbuffers/releases/latest | grep tag_name | cut -f 2 -d : | cut -f 2 -d '"')
  32. FLATC_DIR=$(dirname $(mktemp -u))/flatbuffers/${FLATC_VERSION}
  33. if [ ! -f "${FLATC_DIR}/flatc" ]; then
  34. mkdir -p "${FLATC_DIR}"
  35. pushd "${FLATC_DIR}" > /dev/null
  36. curl -sL https://github.com/google/flatbuffers/archive/${FLATC_VERSION}.tar.gz | tar zx --strip-components 1
  37. cmake -G "Unix Makefiles" . &> /dev/null
  38. make > /dev/null
  39. popd > /dev/null
  40. fi
  41. FLATC=${FLATC_DIR}/flatc
  42. ;;
  43. darwin*)
  44. brew list flatbuffers > /dev/null 2>&1 || brew install flatbuffers > /dev/null
  45. FLATC=flatc
  46. ;;
  47. msys*)
  48. echo "msys flatc not supported" 1>&2
  49. exit 1
  50. ;;
  51. esac
  52. ${FLATC} --no-js-exports --js ${third_party}/armnn/src/armnnSerializer/ArmnnSchema.fbs
  53. mv ./ArmnnSchema_generated.js ${src}/armnn-schema.js
  54. cat <<EOT >> ${src}/armnn-schema.js
  55. if (typeof module !== 'undefined' && typeof module.exports === 'object') {
  56. module.exports = armnnSerializer;
  57. }
  58. EOT
  59. }
  60. while [ "$#" != 0 ]; do
  61. command="$1" && shift
  62. case "${command}" in
  63. "clean") clean;;
  64. "sync") sync;;
  65. "schema") schema;;
  66. esac
  67. done