pkg: introduce nanoPb Protocol Buffers library
This commit is contained in:
parent
4c3d473e4e
commit
cd18dad5ca
@ -52,8 +52,8 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),)
|
|||||||
ASSMSRC := $(wildcard *.S)
|
ASSMSRC := $(wildcard *.S)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# include makefile snippets that modify GENSRC here:
|
# include makefile snippets for packages in $(USEPKG) that modify GENSRC:
|
||||||
#include foo/bar.inc.mk
|
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.gensrc)
|
||||||
|
|
||||||
GENOBJC := $(GENSRC:%.c=%.o)
|
GENOBJC := $(GENSRC:%.c=%.o)
|
||||||
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)
|
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)
|
||||||
|
|||||||
11
pkg/nanopb/Makefile
Normal file
11
pkg/nanopb/Makefile
Normal 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
|
||||||
23
pkg/nanopb/Makefile.gensrc
Normal file
23
pkg/nanopb/Makefile.gensrc
Normal 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
|
||||||
1
pkg/nanopb/Makefile.include
Normal file
1
pkg/nanopb/Makefile.include
Normal file
@ -0,0 +1 @@
|
|||||||
|
INCLUDES += -I$(PKGDIRBASE)/nanopb
|
||||||
3
pkg/nanopb/Makefile.nanopb
Normal file
3
pkg/nanopb/Makefile.nanopb
Normal 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
8
pkg/nanopb/doc.txt
Normal 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
|
||||||
|
*/
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
From 416436502170cfd77d19c6e967cc79267b4513d6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kaspar Schleiser <kaspar@schleiser.de>
|
||||||
|
Date: Sat, 12 Oct 2019 00:26:19 +0200
|
||||||
|
Subject: [PATCH] generator/nanopb_generator.py: use python3
|
||||||
|
|
||||||
|
---
|
||||||
|
generator/nanopb_generator.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
|
||||||
|
index 03f41a0..4f0ab47 100755
|
||||||
|
--- a/generator/nanopb_generator.py
|
||||||
|
+++ b/generator/nanopb_generator.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user