1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg: introduce nanoPb Protocol Buffers library

This commit is contained in:
Kaspar Schleiser 2018-09-16 14:48:35 +02:00
parent 4c3d473e4e
commit cd18dad5ca
7 changed files with 48 additions and 2 deletions

View File

@ -52,8 +52,8 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),)
ASSMSRC := $(wildcard *.S)
endif
# include makefile snippets that modify GENSRC here:
#include foo/bar.inc.mk
# include makefile snippets for packages in $(USEPKG) that modify GENSRC:
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.gensrc)
GENOBJC := $(GENSRC:%.c=%.o)
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)

11
pkg/nanopb/Makefile Normal file
View File

@ -0,0 +1,11 @@
PKG_NAME=nanopb
PKG_URL=https://github.com/nanopb/nanopb
PKG_VERSION=493adf3616bee052649c63c473f8355630c2797f # nanopb-0.3.9.4
PKG_LICENSE=MIT
.PHONY: all
all: git-download
"$(MAKE)" -C $(PKG_BUILDDIR) -f $(CURDIR)/Makefile.nanopb
include $(RIOTBASE)/pkg/pkg.mk

View File

@ -0,0 +1,23 @@
PROTOC ?= protoc
PROTOC_GEN_NANOPB ?= $(PKGDIRBASE)/nanopb/generator/protoc-gen-nanopb
PROTOBUF_FILES ?= $(wildcard *.proto)
GENSRC += $(PROTOBUF_FILES:%.proto=$(BINDIR)/$(MODULE)/%.pb.c)
GENOBJC := $(GENSRC:%.c=%.o)
ifneq (, $(PROTOBUF_FILES))
INCLUDES += -I$(BINDIR)/$(MODULE)
endif
$(SRC): $(GENSRC)
$(GENSRC): $(PROTOBUF_FILES)
$(Q)D=$(BINDIR)/$(MODULE) && \
mkdir -p "$$D" && \
cd $(CURDIR) && \
make -C $(PKGDIRBASE)/nanopb/generator/proto && \
for protofile in $(PROTOBUF_FILES); do \
protoc --plugin=protoc-gen-nanopb=$(PROTOC_GEN_NANOPB) \
--nanopb_out="$$D" \
$^ \
; done

View File

@ -0,0 +1 @@
INCLUDES += -I$(PKGDIRBASE)/nanopb

View File

@ -0,0 +1,3 @@
SRCS := pb_encode.c pb_decode.c pb_common.c
include $(RIOTBASE)/Makefile.base

8
pkg/nanopb/doc.txt Normal file
View File

@ -0,0 +1,8 @@
/**
* @defgroup pkg_nanopb small Protocol Buffers library
* @ingroup pkg
* @ingroup sys
* @brief Provides a protocol buffers library to RIOT
*
* @see https://github.com/nanopb/nanopb
*/