From f7e1e21eb7ed5b4c7d002608dcebd25b8bc37cf6 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Thu, 29 Oct 2026 15:50:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BC=96=E8=AF=91=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E3=80=91protobuf=E4=BD=9C=E4=B8=BA=E7=8B=AC=E7=AB=8B=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 + RBcore/CMakeLists.txt | 6 ++++++ library/protobuf/CMakeLists.txt | 15 +++++++++++++++ {RBcore => library/protobuf}/include/pb.h | 0 {RBcore => library/protobuf}/include/pb_common.h | 0 {RBcore => library/protobuf}/include/pb_decode.h | 0 {RBcore => library/protobuf}/include/pb_encode.h | 0 {RBcore => library/protobuf}/pb_common.c | 0 {RBcore => library/protobuf}/pb_decode.c | 0 {RBcore => library/protobuf}/pb_encode.c | 0 project | 2 +- 11 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 library/protobuf/CMakeLists.txt rename {RBcore => library/protobuf}/include/pb.h (100%) rename {RBcore => library/protobuf}/include/pb_common.h (100%) rename {RBcore => library/protobuf}/include/pb_decode.h (100%) rename {RBcore => library/protobuf}/include/pb_encode.h (100%) rename {RBcore => library/protobuf}/pb_common.c (100%) rename {RBcore => library/protobuf}/pb_decode.c (100%) rename {RBcore => library/protobuf}/pb_encode.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5258d95..03043d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,7 @@ add_module(log library/log OFF OFF) add_module(common library/common ON OFF) add_module(list library/list OFF OFF) add_module(ringbuffer library/ringbuffer OFF OFF) +add_module(protobuf library/protobuf OFF OFF) add_module(peripheral peripheral OFF ON) add_module(littlefs library/littlefs OFF OFF) add_module(lua lua OFF ON) diff --git a/RBcore/CMakeLists.txt b/RBcore/CMakeLists.txt index 632e82d..43b5bd5 100644 --- a/RBcore/CMakeLists.txt +++ b/RBcore/CMakeLists.txt @@ -15,6 +15,12 @@ else() message(FATAL_ERROR "[${TARGET_NAME}] Dependency 'bspMCU' not found.") endif() +if(TARGET protobuf) + target_link_libraries(${TARGET_NAME} PUBLIC protobuf) +else() + message(FATAL_ERROR "[${TARGET_NAME}] Dependency 'protobuf' not found.") +endif() + get_filename_component(ROBOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE) file(GLOB PROJECT_DIRS LIST_DIRECTORIES true "${ROBOT_DIR}/project/*") foreach(PROJ_DIR ${PROJECT_DIRS}) diff --git a/library/protobuf/CMakeLists.txt b/library/protobuf/CMakeLists.txt new file mode 100644 index 0000000..bc2429e --- /dev/null +++ b/library/protobuf/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.10) + +set(COMMON_CMAKE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt") + +if(EXISTS ${COMMON_CMAKE_PATH}) + include(${COMMON_CMAKE_PATH}) +else() + message(FATAL_ERROR "Cannot find common build logic at ${COMMON_CMAKE_PATH}") +endif() + +if(TARGET common) + target_link_libraries(${TARGET_NAME} PUBLIC common) +else() + message(FATAL_ERROR "[${TARGET_NAME}] Dependency 'common' not found.") +endif() diff --git a/RBcore/include/pb.h b/library/protobuf/include/pb.h similarity index 100% rename from RBcore/include/pb.h rename to library/protobuf/include/pb.h diff --git a/RBcore/include/pb_common.h b/library/protobuf/include/pb_common.h similarity index 100% rename from RBcore/include/pb_common.h rename to library/protobuf/include/pb_common.h diff --git a/RBcore/include/pb_decode.h b/library/protobuf/include/pb_decode.h similarity index 100% rename from RBcore/include/pb_decode.h rename to library/protobuf/include/pb_decode.h diff --git a/RBcore/include/pb_encode.h b/library/protobuf/include/pb_encode.h similarity index 100% rename from RBcore/include/pb_encode.h rename to library/protobuf/include/pb_encode.h diff --git a/RBcore/pb_common.c b/library/protobuf/pb_common.c similarity index 100% rename from RBcore/pb_common.c rename to library/protobuf/pb_common.c diff --git a/RBcore/pb_decode.c b/library/protobuf/pb_decode.c similarity index 100% rename from RBcore/pb_decode.c rename to library/protobuf/pb_decode.c diff --git a/RBcore/pb_encode.c b/library/protobuf/pb_encode.c similarity index 100% rename from RBcore/pb_encode.c rename to library/protobuf/pb_encode.c diff --git a/project b/project index bb250aa..3cedc44 160000 --- a/project +++ b/project @@ -1 +1 @@ -Subproject commit bb250aa22b82811f6f752bb266d19092e6a78b61 +Subproject commit 3cedc4451e7bdcb0a18bb3042c84e8db581b43ca