forked from nvidia-riva/common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (36 loc) · 1.3 KB
/
Makefile
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
39
40
41
DST_DIR ?= .
SRC_DIR ?= ./riva/proto
setup:
@mkdir -p ${DST_DIR}
.PHONY: setup
# Requires protoc-gen-go and protoc-gen-go-grpc
# go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
# go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
golang: setup
@echo "==> Generating golang bindings"
@which protoc-gen-go protoc-gen-go-grpc > /dev/null
protoc --go_out=${DST_DIR} --go_opt=paths=source_relative \
--go-grpc_out=${DST_DIR} --go-grpc_opt=paths=source_relative \
${SRC_DIR}/*.proto
.PHONY: golang
# Requires protoc-gen-grpc-java
# https://mvnrepository.com/artifact/io.grpc/protoc-gen-grpc-java
java: setup
@echo "==> Generating java bindings"
@which protoc-gen-grpc-java > /dev/null
protoc --java_out=${DST_DIR} \
--grpc-java_out=${DST_DIR} --plugin=protoc-gen-grpc-java=`which protoc-gen-grpc-java` \
${SRC_DIR}/*.proto
.PHONY: java
# Requires python libraries grpcio and grpcio-tools
# pip3 install grpcio grpcio-tools
python: setup
@echo "==> Generating python bindings"
python3 -m grpc_tools.protoc --python_out=${DST_DIR} \
--grpc_python_out=${DST_DIR} \
-I=. ${SRC_DIR}/*.proto
@sed -i -r 's/from riva.proto import (.+_pb2.*)/from . import \1/g' ${DST_DIR}/riva/proto/*_pb2*.py
.PHONY: python
clean:
rm -vI ${DST_DIR}/riva/proto/*.py ${DST_DIR}/riva/proto/*.go
.PHONY: clean