Browse Source

【编译通过】protobuf作为独立模块

master
Lizongdi 2 weeks ago
parent
commit
f7e1e21eb7
  1. 1
      CMakeLists.txt
  2. 6
      RBcore/CMakeLists.txt
  3. 15
      library/protobuf/CMakeLists.txt
  4. 0
      library/protobuf/include/pb.h
  5. 0
      library/protobuf/include/pb_common.h
  6. 0
      library/protobuf/include/pb_decode.h
  7. 0
      library/protobuf/include/pb_encode.h
  8. 0
      library/protobuf/pb_common.c
  9. 0
      library/protobuf/pb_decode.c
  10. 0
      library/protobuf/pb_encode.c
  11. 2
      project

1
CMakeLists.txt

@ -114,6 +114,7 @@ add_module(log library/log OFF OFF)
add_module(common library/common ON OFF) add_module(common library/common ON OFF)
add_module(list library/list OFF OFF) add_module(list library/list OFF OFF)
add_module(ringbuffer library/ringbuffer OFF OFF) add_module(ringbuffer library/ringbuffer OFF OFF)
add_module(protobuf library/protobuf OFF OFF)
add_module(peripheral peripheral OFF ON) add_module(peripheral peripheral OFF ON)
add_module(littlefs library/littlefs OFF OFF) add_module(littlefs library/littlefs OFF OFF)
add_module(lua lua OFF ON) add_module(lua lua OFF ON)

6
RBcore/CMakeLists.txt

@ -15,6 +15,12 @@ else()
message(FATAL_ERROR "[${TARGET_NAME}] Dependency 'bspMCU' not found.") message(FATAL_ERROR "[${TARGET_NAME}] Dependency 'bspMCU' not found.")
endif() 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) get_filename_component(ROBOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE)
file(GLOB PROJECT_DIRS LIST_DIRECTORIES true "${ROBOT_DIR}/project/*") file(GLOB PROJECT_DIRS LIST_DIRECTORIES true "${ROBOT_DIR}/project/*")
foreach(PROJ_DIR ${PROJECT_DIRS}) foreach(PROJ_DIR ${PROJECT_DIRS})

15
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()

0
RBcore/include/pb.h → library/protobuf/include/pb.h

0
RBcore/include/pb_common.h → library/protobuf/include/pb_common.h

0
RBcore/include/pb_decode.h → library/protobuf/include/pb_decode.h

0
RBcore/include/pb_encode.h → library/protobuf/include/pb_encode.h

0
RBcore/pb_common.c → library/protobuf/pb_common.c

0
RBcore/pb_decode.c → library/protobuf/pb_decode.c

0
RBcore/pb_encode.c → library/protobuf/pb_encode.c

2
project

@ -1 +1 @@
Subproject commit bb250aa22b82811f6f752bb266d19092e6a78b61 Subproject commit 3cedc4451e7bdcb0a18bb3042c84e8db581b43ca
Loading…
Cancel
Save