compile.sh 587 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/bash

#function:
#   script used to generate caffepb.py from caffe.proto using protoc
#

PROTOC=`which protoc`
if [[ -z $PROTOC ]];then
    echo "not found protoc, you should first install it following this[https://github.com/google/protobuf/releases]"
    exit 1
fi

WORK_ROOT=$(dirname `readlink -f "$BASH_SOURCE[0]"`)
14
PY_NAME="$WORK_ROOT/caffe_pb2.py"
15 16 17 18 19 20 21 22 23 24
$PROTOC --proto_path=$WORK_ROOT --python_out=$WORK_ROOT $WORK_ROOT/caffe.proto
ret=$?

if [ -e "$PY_NAME" ];then
    echo "succeed to generate [$PY_NAME]"
    exit 0
else
    echo "failed to generate [$PY_NAME]"
fi
exit $ret