Added nanopb generation facilities
This commit is contained in:
parent
8d3e913424
commit
c9f88e5b93
2 changed files with 29 additions and 0 deletions
16
src/protocol/Makefile
Normal file
16
src/protocol/Makefile
Normal file
|
@ -0,0 +1,16 @@
|
|||
NANOPB_DIR = ../../dependencies/nanopb
|
||||
NANOPB_PROTO_DIR = $(NANOPB_DIR)/generator/proto
|
||||
|
||||
PROTOC = protoc
|
||||
PROTOC_OPTS = --plugin=protoc-gen-nanopb=protoc-gen-nanopb \
|
||||
-I$(NANOPB_PROTO_DIR) -I. --nanopb_out=.
|
||||
|
||||
gen: make-nanopb criterion.pb.c
|
||||
|
||||
make-nanopb:
|
||||
$(MAKE) -C $(NANOPB_PROTO_DIR)
|
||||
|
||||
criterion.pb.c: criterion.proto
|
||||
$(PROTOC) $(PROTOC_OPTS) $<
|
||||
|
||||
.PHONY: gen make-nanopb
|
13
src/protocol/protoc-gen-nanopb
Executable file
13
src/protocol/protoc-gen-nanopb
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This file is used to invoke nanopb_generator.py as a plugin
|
||||
# to protoc on Linux and other *nix-style systems.
|
||||
# Use it like this:
|
||||
# protoc --plugin=nanopb=..../protoc-gen-nanopb --nanopb_out=dir foo.proto
|
||||
#
|
||||
# Note that if you use the binary package of nanopb, the protoc
|
||||
# path is already set up properly and there is no need to give
|
||||
# --plugin= on the command line.
|
||||
|
||||
NANOPB_PATH="../../dependencies/nanopb/generator"
|
||||
exec python2 "$NANOPB_PATH/nanopb_generator.py" --protoc-plugin
|
Loading…
Add table
Reference in a new issue