#!/bin/bash
preparelist="objectdetectioncpu
objectdetectiongpu
facedetectioncpu
facedetectiongpu
facemeshgpu
handdetectiongpu
handtrackinggpu
multihandtrackinggpu
objectdetection3d
templatematchingcpu
hairsegmentationgpu
edgedetectiongpu
facedetection"
#echo ${preparelist[@]}
if [ $# != 1 ] ; then
echo "请输入要编译的项目:"
for indexii in $preparelist
do
echo " e.g.: $0 $indexii";
done
exit 1;
else
if [[ $1 =~ $indexii ]];then
echo "要编译的项目: $1"
fi
fi
cd ${HOME}/githubSave/mediapipe
##bazel clean --expunge
bazel build --cxxopt='--std=c++14' -c opt --fat_apk_cpu=arm64-v8a,armeabi-v7a //mediapipe/examples/android/src/java/com/google/mediapipe/apps/$1:$1 --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --local_ram_resources=1024 --verbose_failures
sleep 1
##echo build complete.
path="bazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/"$1
myFile=$1".apk"
if [ -f "$path/$myFile" ];then
echo "build apk name:"$myFile
cd $path
echo -e "###################################################################################"
echo -e "\033[35mbazel-bin/mediapipe/examples/android/src/java/com/google/mediapipe/apps/$1"
sub_apk_string=".apk"
filelist=`ls ${PWD}`
for file in $filelist
do
if [[ $file =~ $sub_apk_string ]]
then
echo -e "\033[32m$file"
else
echo -e "\033[34m$file"
fi
done
fi