message: create_ios_frameworks.sh : Add an option for GPU support
  The GPU library is still working-in-progress.
diff: -#!/bin/bash -x
  +#!/bin/bash
  # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  @@ -20,10 +20,41 @@ set -e
  echo "Starting"
  TFLITE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
  +usage() {
  + echo "Usage: $(basename "$0") [-a]"
  + echo "-g build with GPU delegate"
  + exit 1
  +}
  +
  +USE_GPU_DELEGATE="false"
  +FRAMEWORK_NAME="tensorflow_lite"
  +while getopts "g" opt_name; do
  + case "$opt_name" in
  + g)
  + USE_GPU_DELEGATE="true"
  + FRAMEWORK_NAME="tensorflow_lite_gpu"
  + ;;
  + *) usage;;
  + esac
  +done
  +shift $((OPTIND - 1))
  +readonly USE_GPU_DELEGATE
  +readonly FRAMEWORK_NAME
  +
  +if [ $USE_GPU_DELEGATE == "true" ] ; then
  + for filename in metal_delegate.h libmetal_delegate.a ; do
  + if [[ ! -f "${TFLITE_DIR}/delegates/gpu/${filename}" ]] ; then
  + echo "File ${TFLITE_DIR}/delegates/gpu/${filename} doesn't exist."
  + echo "It's requried for building TFLite Framework with GPU. Aborting."
  + exit 1
  + fi
  + done
  +fi
  +
  TMP_DIR=$(mktemp -d)
  echo "Package dir: " $TMP_DIR
  FW_DIR=$TMP_DIR/tensorflow_lite_ios_frameworks
  -FW_DIR_TFLITE=$FW_DIR/tensorflow_lite.framework
  +FW_DIR_TFLITE=$FW_DIR/$FRAMEWORK_NAME.framework
  FW_DIR_TFLITE_HDRS=$FW_DIR_TFLITE/Headers
  echo "Creating target Headers directories"
  @@ -58,8 +89,14 @@ cp $TFLITE_DIR/../../bazel-genfiles/tensorflow/tools/lib_package/include/tensorf
  $FW_DIR_TFLITE
  echo "Copying static libraries"
  +# Note: There must be a static library with the same name
  +# as the framework name.
  cp $TFLITE_DIR/tools/make/gen/lib/libtensorflow-lite.a \
  - $FW_DIR_TFLITE/tensorflow_lite
  + $FW_DIR_TFLITE/$FRAMEWORK_NAME
  +if [ $USE_GPU_DELEGATE == "true" ] ; then
  + cp "${TFLITE_DIR}/delegates/gpu/libmetal_delegate.a" \
  + $FW_DIR_TFLITE/libmetal_delegate.a
  +fi
  # This is required, otherwise they interfere with the documentation of the
  # pod at cocoapods.org.
  @@ -71,10 +108,10 @@ find . -type f -name readme\* -exec rm -f {} \;
  TARGET_GEN_LOCATION="$TFLITE_DIR/gen/ios_frameworks"
  echo "Moving results to target: " $TARGET_GEN_LOCATION
  cd $FW_DIR
  -zip -q -r tensorflow_lite.framework.zip tensorflow_lite.framework -x .DS_Store
  +zip -q -r $FRAMEWORK_NAME.framework.zip $FRAMEWORK_NAME.framework -x .DS_Store
  rm -rf $TARGET_GEN_LOCATION
  mkdir -p $TARGET_GEN_LOCATION
  -cp -r tensorflow_lite.framework.zip $TARGET_GEN_LOCATION
  +cp -r $FRAMEWORK_NAME.framework.zip $TARGET_GEN_LOCATION
  echo "Cleaning up"
  rm -rf $TMP_DIR
  