Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protobuf file generation for SAI headers #1980

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions meta/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ saimetadatatest.c saimetadata.c saimetadata.h: xml $(XMLDEPS) parse.pl $(CONSTHE

RPC_MODULES=$(shell find rpc -type f -name "*.pm")

sai.proto: xml $(XMLDEPS) gensaiprotorpc.pl templates/*.tt $(RPC_MODULES)
perl -Irpc gensaiprotorpc.pl $(GEN_SAIRPC_OPTS)

protorpc: sai.proto

sai.thrift sai_rpc_server.cpp sai_adapter.py: xml $(XMLDEPS) gensairpc.pl templates/*.tt $(RPC_MODULES)
perl -Irpc gensairpc.pl $(GEN_SAIRPC_OPTS)

Expand Down Expand Up @@ -180,18 +185,18 @@ generated/gen-cpp/sai_rpc_server.skeleton: sai.thrift $(RPC_OBJ)

sai_rpc_server.skeleton: generated/gen-cpp/sai_rpc_server.skeleton

sai_rpc_frontend: rpc sai_rpc_frontend.cpp sai_rpc_frontend.main.cpp sai_rpc_server.cpp libsaimetadata.so libsai.so
sai_rpc_frontend: rpc protorpc sai_rpc_frontend.cpp sai_rpc_frontend.main.cpp sai_rpc_server.cpp libsaimetadata.so libsai.so
$(CXX) $(CFLAGS) -std=c++11 \
generated/gen-cpp/sai_rpc.o generated/gen-cpp/sai_types.o generated/gen-cpp/sai_constants.o \
sai_rpc_frontend.main.cpp sai_rpc_frontend.cpp \
libsaimetadata.so libsai.so -lthrift -lpthread -I generated/gen-cpp -o sai_rpc_frontend
.PHONY: clean rpc protorpc

.PHONY: clean rpc

clean:
rm -f *.o *~ .*~ *.tmp .*.swp .*.swo *.bak sai*.gv sai*.svg *.o.symbols doxygen*.db *.so
rm -f saimetadata.h saimetadatasize.h saimetadata.c saimetadatatest.c saiswig.i
rm -f saisanitycheck saimetadatatest saiserializetest saidepgraphgen sai_rpc_frontend
rm -f sai.thrift sai_rpc_server.cpp sai_adapter.py
rm -f sai.thrift sai_rpc_server.cpp sai_adapter.py sai.proto
rm -f *.gcda *.gcno *.gcov
rm -rf xml html dist temp generated
rm -rf xml html dist temp generated generated-protobuf
38 changes: 38 additions & 0 deletions meta/gensaiprotorpc.README
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
NAME
gensaiprotorpc.pl - generate protobuf interface of SAI

DESCRIPTION
This script generates GRPC interface of SAI function. It
should be used after SAI interface update.

For more details see the development documentation (rpc/README.md).

USAGE
In order to run, just call:

./gensaiprotorpc.pl

Before committing it is a good idea to clean before generation:

./gensaiprotorpc.pl --clean-meta

In order to generate debug files and avoid cleanup, use --dbg or --dump
flags. Use --experimental to generate extensions and experimental code.

For more information, use --help:

./gensaiprotorpc.pl --help

DEPENDENCIES
Ubuntu packages:
```
[sudo] apt-get install -y \
libtemplate-perl \
libconst-fast-perl \
libmoosex-aliases-perl \
libnamespace-autoclean-perl \
libgetopt-long-descriptive-perl \
doxygen \
graphviz \
aspell-en
```
Loading
Loading