Просмотр исходного кода

GitHub flatc.exe install script

Lutz Roeder 5 лет назад
Родитель
Сommit
748312864e
3 измененных файлов с 30 добавлено и 3 удалено
  1. 10 1
      tools/armnn
  2. 10 1
      tools/mnn
  3. 10 1
      tools/tflite

+ 10 - 1
tools/armnn

@@ -40,7 +40,16 @@ schema() {
             brew list flatbuffers > /dev/null 2>&1 || brew install flatbuffers > /dev/null
             ;;
         msys*)
-            [ -x "$(command -v flatc)" ] || $(choco install flatc) > /dev/null
+            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=./third_party/bin/flatbuffers/${flatc_version}
+            if [ ! -f "${flatc_dir}/flatc.exe" ]; then
+                mkdir -p "${flatc_dir}"
+                pushd "${flatc_dir}" > /dev/null
+                curl -sL -O https://github.com/google/flatbuffers/releases/download/${flatc_version}/flatc_windows.zip
+                unzip flatc_windows.zip > /dev/null
+                popd > /dev/null
+            fi
+            flatc=${flatc_dir}/flatc.exe
             ;;
     esac
     [[ $(grep -U $'\x0D' ./src/armnn-schema.js) ]] && crlf=1

+ 10 - 1
tools/mnn

@@ -40,7 +40,16 @@ schema() {
             brew list flatbuffers > /dev/null 2>&1 || brew install flatbuffers > /dev/null
             ;;
         msys*)
-            [ -x "$(command -v flatc)" ] || $(choco install flatc) > /dev/null
+            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=./third_party/bin/flatbuffers/${flatc_version}
+            if [ ! -f "${flatc_dir}/flatc.exe" ]; then
+                mkdir -p "${flatc_dir}"
+                pushd "${flatc_dir}" > /dev/null
+                curl -sL -O https://github.com/google/flatbuffers/releases/download/${flatc_version}/flatc_windows.zip
+                unzip flatc_windows.zip > /dev/null
+                popd > /dev/null
+            fi
+            flatc=${flatc_dir}/flatc.exe
             ;;
     esac
     [[ $(grep -U $'\x0D' ./src/mnn-schema.js) ]] && crlf=1

+ 10 - 1
tools/tflite

@@ -58,7 +58,16 @@ schema() {
             brew list flatbuffers > /dev/null 2>&1 || brew install flatbuffers > /dev/null
             ;;
         msys*)
-            [ -x "$(command -v flatc)" ] || $(choco install flatc) > /dev/null
+            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=./third_party/bin/flatbuffers/${flatc_version}
+            if [ ! -f "${flatc_dir}/flatc.exe" ]; then
+                mkdir -p "${flatc_dir}"
+                pushd "${flatc_dir}" > /dev/null
+                curl -sL -O https://github.com/google/flatbuffers/releases/download/${flatc_version}/flatc_windows.zip
+                unzip flatc_windows.zip > /dev/null
+                popd > /dev/null
+            fi
+            flatc=${flatc_dir}/flatc.exe
             ;;
     esac
     [[ $(grep -U $'\x0D' ./src/tflite-schema.js) ]] && crlf=1