forked from carla-simulator/carla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProtoc.sh
executable file
·38 lines (29 loc) · 942 Bytes
/
Protoc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd "$SCRIPT_DIR" >/dev/null
PROTOBUF_SRC_DIR=Proto
PROTOBUF_CPP_OUT_DIR=CarlaServer/source/carla/server
PROTOBUF_PY_OUT_DIR=../Deprecated/PythonClient/carla
PROTO_BASENAME=carla_server
if [ "$1" == "--clean" ]; then
# Delete existing ones.
rm -f ${PROTOBUF_CPP_OUT_DIR}/*.pb.h ${PROTOBUF_CPP_OUT_DIR}/*.pb.cc
rm -f ${PROTOBUF_PY_OUT_DIR}/*_pb2.py
exit 0
fi
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./Build/llvm-install/lib
PROTOC=./Build/protobuf-install/bin/protoc
if [[ ! -f $PROTOC ]]; then
echo >&2 "ERROR: Missing protobuf compiler."
echo >&2 "Did you forget to run Setup.sh?"
exit 1
fi
echo "Compiling ${PROTO_BASENAME}.proto..."
${PROTOC} \
-I=${PROTOBUF_SRC_DIR} \
--cpp_out=${PROTOBUF_CPP_OUT_DIR} \
--python_out=${PROTOBUF_PY_OUT_DIR} \
${PROTOBUF_SRC_DIR}/${PROTO_BASENAME}.proto
popd >/dev/null
echo "done."