Skip to content

Commit

Permalink
Added option to specify build configuration for ios.
Browse files Browse the repository at this point in the history
  • Loading branch information
Canming Huang committed Nov 1, 2024
1 parent ac3e049 commit 16969b9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions platforms/ios/bazel_build_tflite_ios
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/bash -v

if [ \( -n "$1" \) ]; then
echo "Building with config $1"
else
echo "Please specify the ios config and architecture to build. e.g. $0 ios_fat; $0 x86_64; $0 ios_sim_arm64; $0 arm64; $0 armv7; $0 i386;"
exit 1
fi

cd "$(dirname "$0")"
cd ../../
mkdir -p lib/ios
Expand Down Expand Up @@ -42,16 +49,18 @@ export TF_DOWNLOAD_CLANG=0
export CC_OPT_FLAGS="-match=native -Wno-sign-compare"
export TF_SET_ANDROID_WORKSPACE=0

BAZEL_OUTPUT_USER_ROOT="$(pwd)/../bazel_output"
BAZEL_OUTPUT_USER_ROOT="$(pwd)/../bazel_output_$1"

cp -f tensorflow/lite/ios/BUILD.apple tensorflow/lite/ios/BUILD

rm -rf bazel-bin/tensorflow/lite/ios/TensorFlowLiteC_framework.zip

./configure
#alias python="/usr/local/bin/python3"
#bazel --output_user_root=$BAZEL_OUTPUT_USER_ROOT build --verbose_failures --config=ios_fat --copt="-DCL_DELEGATE_NO_GL" --copt="-D__IOS__" -c opt --action_env PATH="$PATH" //tensorflow/lite/ios:TensorFlowLiteC_framework
bazel --output_user_root=$BAZEL_OUTPUT_USER_ROOT build --verbose_failures --incompatible_run_shell_command_string=false --config=ios_fat --copt="-DCL_DELEGATE_NO_GL" --copt="-D__IOS__" -c opt ${@:1} //tensorflow/lite/ios:TensorFlowLiteC_framework
unzip -o bazel-bin/tensorflow/lite/ios/TensorFlowLiteC_framework.zip
cp -r TensorFlowLiteC.framework/TensorFlowLiteC ../lib/ios/libtfliteextern.a
bazel --output_user_root=$BAZEL_OUTPUT_USER_ROOT build --verbose_failures --incompatible_run_shell_command_string=false --config=$1 --copt="-DCL_DELEGATE_NO_GL" --copt="-D__IOS__" -c opt ${@:2} //tensorflow/lite/ios:TensorFlowLiteC_framework
unzip -o bazel-bin/tensorflow/lite/ios/TensorFlowLiteC_framework.zip TensorFlowLiteC.framework/TensorFlowLiteC ../lib/ios/libtfliteextern_$1.a
#cp -r TensorFlowLiteC.framework/TensorFlowLiteC ../lib/ios/libtfliteextern.a
cd ..


0 comments on commit 16969b9

Please sign in to comment.