From 95a0cbd5e8473c7a43e5e8cd5e28ffe4cf8f7891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=B5=B7=E4=B8=B9?= Date: Tue, 19 Mar 2024 02:54:44 +0000 Subject: [PATCH 1/6] Initial commit --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9befa0 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# lib-pybind11_protobuf + +#### 介绍 +{**以下是 Gitee 平台说明,您可以替换此简介** +Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 +无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} + +#### 软件架构 +软件架构说明 + + +#### 安装教程 + +1. xxxx +2. xxxx +3. xxxx + +#### 使用说明 + +1. xxxx +2. xxxx +3. xxxx + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 +4. 新建 Pull Request + + +#### 特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) -- Gitee From b9b9080fcb770d70efed0a16ffbeaa71a0e67470 Mon Sep 17 00:00:00 2001 From: Li Haode Date: Tue, 2 Apr 2024 12:06:13 +0800 Subject: [PATCH 2/6] lib/pybind11_protobuf: port pybind11_protobuf to unikraft Signed-off-by: Li Haode --- Config.uk | 4 ++++ Makefile.uk | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ patches/.keep | 0 3 files changed, 61 insertions(+) create mode 100644 Config.uk create mode 100644 Makefile.uk create mode 100644 patches/.keep diff --git a/Config.uk b/Config.uk new file mode 100644 index 0000000..fc90312 --- /dev/null +++ b/Config.uk @@ -0,0 +1,4 @@ +menuconfig LIBPYBIND11_PROTOBUF + bool "pybind11_protobuf" + select LIBPROTOBUF + default n diff --git a/Makefile.uk b/Makefile.uk new file mode 100644 index 0000000..a7261fa --- /dev/null +++ b/Makefile.uk @@ -0,0 +1,57 @@ +# pybind11_protobuf Makefile.uk + +################################################################################ +# Library registration +################################################################################ +$(eval $(call addlib_s,libpybind11_protobuf,$(CONFIG_LIBPYBIND11_PROTOBUF))) + +################################################################################ +# Sources +################################################################################ +LIBPYBIND11_PROTOBUF_COMMIT=9750a61a0a0e6978c5fa91b764b1e4886e9009cc +LIBPYBIND11_PROTOBUF_URL=https://github.com/pybind/pybind11_protobuf/archive/$(LIBPYBIND11_PROTOBUF_COMMIT).zip +LIBPYBIND11_PROTOBUF_DIRNAME=pybind11_protobuf-$(LIBPYBIND11_PROTOBUF_COMMIT) + +$(eval $(call fetch,libpybind11_protobuf,$(LIBPYBIND11_PROTOBUF_URL))) + +################################################################################ +# Helpers +################################################################################ +LIBPYBIND11_PROTOBUF_SRC = $(LIBPYBIND11_PROTOBUF_ORIGIN)/$(LIBPYBIND11_PROTOBUF_DIRNAME) + +################################################################################ +# Library includes +################################################################################ +CINCLUDES-$(CONFIG_LIBPYBIND11_PROTOBUF) += -I$(LIBPYBIND11_PROTOBUF_SRC) +CXXINCLUDES-$(CONFIG_LIBPYBIND11_PROTOBUF) += -I$(LIBPYBIND11_PROTOBUF_SRC) + +################################################################################ +# Global flags +################################################################################ +LIBPYBIND11_PROTOBUF_CFLAGS-$(CONFIG_ARCH_X86_64) += -idirafter /usr/lib/gcc/x86_64-linux-gnu/11/include/ +LIBPYBIND11_PROTOBUF_CXXFLAGS-$(CONFIG_ARCH_X86_64) += -idirafter /usr/lib/gcc/x86_64-linux-gnu/11/include/ + +################################################################################ +# Library sources +################################################################################ +LIBPYBIND11_PROTOBUF_SRCS-y += $(LIBPYBIND11_PROTOBUF_SRC)/pybind11_protobuf/proto_cast_util.cc +LIBPYBIND11_PROTOBUF_SRCS-y += $(LIBPYBIND11_PROTOBUF_SRC)/pybind11_protobuf/proto_utils.cc + +# ################################################################################ +# # Root filesystem +# ################################################################################ + +ifeq ($(CONFIG_LIBPYBIND11_PROTOBUF),y) +# Install pybind11_protobuf lib into main python rootfs & cleanup non-python files +$(PYTHON_ROOTFS)/.pybind11_protobuf_done: $(PYTHON_ROOTFS)/.keep + . $(PYTHON_ROOTFS)/bin/activate && pip install protobuf==3.20.3 + _dir=`find "$(PYTHON_ROOTFS)" -maxdepth 5 -type d -name protobuf`; \ + find "$$_dir" -type f -name '*.so' -delete; \ + find "$$_dir" -type d -name '__pycache__' | xargs rm -rf; \ + find "$$_dir" -type f | grep -v '\.py$$' | tr "\n" "\0" | xargs -0 rm; \ + touch $@ + +# Add pybind11_protobuf rootfs to main python +python-rootfs: $(PYTHON_ROOTFS)/.pybind11_protobuf_done + +endif diff --git a/patches/.keep b/patches/.keep new file mode 100644 index 0000000..e69de29 -- Gitee From ff8abf3e416e293bb7f34d3b837a2d3bc736086e Mon Sep 17 00:00:00 2001 From: Li Haode Date: Tue, 2 Apr 2024 12:07:53 +0800 Subject: [PATCH 3/6] lib/pybind11_protobuf: update README Signed-off-by: Li Haode --- README.md | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index c9befa0..e4b8ffe 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,15 @@ # lib-pybind11_protobuf -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} -#### 软件架构 -软件架构说明 +pybind11_protobuf是一个将Google的Protocol Buffers(protobuf)库与pybind11结合的工具,它允许开发者在C++和Python之间高效地序列化和反序列化Protocol Buffers消息。通过pybind11提供的简洁而强大的API,pybind11_protobuf简化了在两种语言之间传输复杂数据结构的过程,使得Python代码能够直接访问和操作C++中定义的protobuf消息类型。 +pybind11_protobuf支持的详细特性可见其官方文档: https://github.com/pybind/pybind11_protobuf -#### 安装教程 +本仓库将pybind11_protobuf作为微库移植到TenonOS,目录结构如下: -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +``` +. +├── Config.uk ------ 维护微库配置 +├── Makefile.uk ------ 用于微库构建 +└── patches ------ 维护对pybind11_protobuf源码的修改 +``` -- Gitee From 99b0bd24f82d1e4aa69dfab656d8b3bce4db582d Mon Sep 17 00:00:00 2001 From: wangguokun Date: Fri, 19 Jul 2024 09:16:24 +0800 Subject: [PATCH 4/6] lib/pybind11_protobuf: remove unconditional download of source code during build process Signed-off-by: wangguokun --- Makefile.uk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.uk b/Makefile.uk index a7261fa..da4982b 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -12,7 +12,9 @@ LIBPYBIND11_PROTOBUF_COMMIT=9750a61a0a0e6978c5fa91b764b1e4886e9009cc LIBPYBIND11_PROTOBUF_URL=https://github.com/pybind/pybind11_protobuf/archive/$(LIBPYBIND11_PROTOBUF_COMMIT).zip LIBPYBIND11_PROTOBUF_DIRNAME=pybind11_protobuf-$(LIBPYBIND11_PROTOBUF_COMMIT) +ifeq ($(CONFIG_LIBPYBIND11_PROTOBUF), y) $(eval $(call fetch,libpybind11_protobuf,$(LIBPYBIND11_PROTOBUF_URL))) +endif ################################################################################ # Helpers -- Gitee From 285bf504e0391839a9330cb15fadc462a21d8536 Mon Sep 17 00:00:00 2001 From: wangguokun Date: Fri, 19 Jul 2024 15:40:02 +0800 Subject: [PATCH 5/6] lib/pybind11_protobuf: update README Signed-off-by: wangguokun --- Config.uk | 2 +- Makefile.uk | 15 ++++++++++++++- README.md | 15 +++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Config.uk b/Config.uk index fc90312..8530c4d 100644 --- a/Config.uk +++ b/Config.uk @@ -1,4 +1,4 @@ menuconfig LIBPYBIND11_PROTOBUF - bool "pybind11_protobuf" + bool "pybind11_protobuf: Pybind11 bindings for Google's Protocol Buffers" select LIBPROTOBUF default n diff --git a/Makefile.uk b/Makefile.uk index da4982b..95c1aa2 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -1,4 +1,17 @@ -# pybind11_protobuf Makefile.uk +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Hangzhou Yingyi Technology Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ################################################################################ # Library registration diff --git a/README.md b/README.md index e4b8ffe..72956df 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # lib-pybind11_protobuf +## 微库提供的功能与说明 pybind11_protobuf是一个将Google的Protocol Buffers(protobuf)库与pybind11结合的工具,它允许开发者在C++和Python之间高效地序列化和反序列化Protocol Buffers消息。通过pybind11提供的简洁而强大的API,pybind11_protobuf简化了在两种语言之间传输复杂数据结构的过程,使得Python代码能够直接访问和操作C++中定义的protobuf消息类型。 @@ -7,9 +8,15 @@ pybind11_protobuf支持的详细特性可见其官方文档: https://github.co 本仓库将pybind11_protobuf作为微库移植到TenonOS,目录结构如下: -``` +```powershell . -├── Config.uk ------ 维护微库配置 -├── Makefile.uk ------ 用于微库构建 -└── patches ------ 维护对pybind11_protobuf源码的修改 +├── Config.uk ------ 维护微库配置 +├── Makefile.uk ------ 用于微库构建 +└── patches ------ 维护对pybind11_protobuf源码的修改 ``` + +## 编译构建与配置说明 + +依赖微库 + +* `lib-protobuf` -- Gitee From c34d7e401e6a1d84f17d0281cf9174e5b761b72b Mon Sep 17 00:00:00 2001 From: wangguokun Date: Wed, 14 Aug 2024 15:32:29 +0800 Subject: [PATCH 6/6] lib/pybind11_protobuf: add the compilation conditions of the gcc hrader file path search Signed-off-by: wangguokun --- Makefile.uk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile.uk b/Makefile.uk index 95c1aa2..323da18 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -43,8 +43,18 @@ CXXINCLUDES-$(CONFIG_LIBPYBIND11_PROTOBUF) += -I$(LIBPYBIND11_PROTOBUF_SRC) ################################################################################ # Global flags ################################################################################ -LIBPYBIND11_PROTOBUF_CFLAGS-$(CONFIG_ARCH_X86_64) += -idirafter /usr/lib/gcc/x86_64-linux-gnu/11/include/ -LIBPYBIND11_PROTOBUF_CXXFLAGS-$(CONFIG_ARCH_X86_64) += -idirafter /usr/lib/gcc/x86_64-linux-gnu/11/include/ +GCC_INSTALLDIR_FLAGS := -idirafter $(shell LC_ALL=C $(CC) -v 2>&1 | \ + $(SED) -e '/^COLLECT_LTO_WRAPPER=\(.*\)\/lto-wrapper/!d' -e 's//\1/')/include + +ifdef CONFIG_ARCH_X86_64 +LIBPYBIND11_PROTOBUF_CFLAGS-$(CONFIG_ARCH_X86_64) += $(GCC_INSTALLDIR_FLAGS) +LIBPYBIND11_PROTOBUF_CXXFLAGS-$(CONFIG_ARCH_X86_64) += $(GCC_INSTALLDIR_FLAGS) +endif + +ifdef CONFIG_ARCH_ARM_64 +LIBPYBIND11_PROTOBUF_CFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) +LIBPYBIND11_PROTOBUF_CXXFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) +endif ################################################################################ # Library sources -- Gitee