3 # Copyright © 2017 Arm Ltd. All rights reserved.
4 # SPDX-License-Identifier: MIT
9 PROTOBUF_INSTALL_DIR=$2
14 echo "Usage: ${THIS_SCRIPT} <OUTPUT_DIR> [PROTOBUF_INSTALL_DIR]"
16 echo " <OUTPUT_DIR> is the location where the generated files will be placed"
17 echo " [PROTOBUF_INSTALL_DIR] the location of the protobuf installation"
21 if [ "x$OUTPUT_DIR" = "x" ]
27 mkdir -p ${OUTPUT_DIR}
32 echo "Cannot create output dir: ${OUTPUT_DIR}"
33 echo "mkdir returned: $ERR"
40 if [ "x${PROTOBUF_INSTALL_DIR}" = "x" ]
42 PROTOBUF_INSTALL_DIR=/usr/local
45 if [ ! -x "${PROTOBUF_INSTALL_DIR}/bin/protoc" ]
48 echo "No usable protocol buffer (protoc) compiler found in ${PROTOBUF_INSTALL_DIR}/bin/"
49 echo "You can specify the location of the protobuf installation as the second"
50 echo "argument of ${THIS_SCRIPT}."
56 TF_PROTO_FILES=tensorflow/contrib/makefile/tf_proto_files.txt
57 if [ -r $TF_PROTO_FILES ]
59 OLD_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
60 for i in `cat $TF_PROTO_FILES`
62 LD_LIBRARY_PATH=$OLD_LD_LIBRARY_PATH:${PROTOBUF_INSTALL_DIR}/lib \
63 $PROTOBUF_INSTALL_DIR/bin/protoc $i \
65 --proto_path=${PROTOBUF_INSTALL_DIR}/include \
69 echo "Couldn't find $TF_PROTO_FILES. This script should be run from the"
70 echo "tensorflow source directory."