mnn 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/bash
  2. set -e
  3. pushd $(cd $(dirname ${0})/..; pwd) > /dev/null
  4. clean() {
  5. echo "mnn clean"
  6. rm -rf "./third_party/source/mnn"
  7. }
  8. sync() {
  9. echo "mnn sync"
  10. mkdir -p "./third_party/source/mnn/schema/default"
  11. curl --silent --location --output "./third_party/source/mnn/schema/default/CaffeOp.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/CaffeOp.fbs?raw=true"
  12. curl --silent --location --output "./third_party/source/mnn/schema/default/ExtraInfo.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/ExtraInfo.fbs?raw=true"
  13. curl --silent --location --output "./third_party/source/mnn/schema/default/GpuLibrary.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/GpuLibrary.fbs?raw=true"
  14. curl --silent --location --output "./third_party/source/mnn/schema/default/MNN.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/MNN.fbs?raw=true"
  15. curl --silent --location --output "./third_party/source/mnn/schema/default/Tensor.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/Tensor.fbs?raw=true"
  16. curl --silent --location --output "./third_party/source/mnn/schema/default/TensorflowOp.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/TensorflowOp.fbs?raw=true"
  17. curl --silent --location --output "./third_party/source/mnn/schema/default/TFQuantizeOp.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/TFQuantizeOp.fbs?raw=true"
  18. curl --silent --location --output "./third_party/source/mnn/schema/default/Type.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/Type.fbs?raw=true"
  19. curl --silent --location --output "./third_party/source/mnn/schema/default/UserDefine.fbs" "https://github.com/alibaba/MNN/blob/master/schema/default/UserDefine.fbs?raw=true"
  20. }
  21. schema() {
  22. echo "mnn schema"
  23. [[ $(grep -U $'\x0D' ./source/mnn-schema.js) ]] && crlf=1
  24. node ./tools/flatc.js --root mnn --out ./source/mnn-schema.js ./third_party/source/mnn/schema/default/MNN.fbs
  25. if [[ -n ${crlf} ]]; then
  26. unix2dos --quiet --newfile ./source/mnn-schema.js ./source/mnn-schema.js
  27. fi
  28. }
  29. while [ "$#" != 0 ]; do
  30. command="$1" && shift
  31. case "${command}" in
  32. "clean") clean;;
  33. "sync") sync;;
  34. "schema") schema;;
  35. esac
  36. done