Skip to content

Commit

Permalink
using Protobuf_IMPORT_DIRS 变量,指定improt的查询目录
Browse files Browse the repository at this point in the history
  • Loading branch information
171930433 committed Mar 13, 2024
1 parent a503513 commit 7165cfe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 36 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@ if(CMAKE_PROJECT_NAME STREQUAL "yaLanTingLibs") # if ylt is top-level project
endif()


set(Protobuf_IMPORT_DIRS
${CMAKE_CURRENT_LIST_DIR}/src/protoc-plugin
)



# add_subdirectory(src/protoc-plugin)
add_subdirectory(src/example)
24 changes: 13 additions & 11 deletions src/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ find_package(OpenCV REQUIRED COMPONENTS core)

# generate .pb.cc .pb.h
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS
proto_to_struct.proto
base.proto
imu.proto
gnss.proto
state.proto
chasis.proto
perception.proto
pointcloud.proto
image.proto
../protoc-plugin/proto_to_struct.proto
base.proto
imu.proto
gnss.proto
state.proto
chasis.proto
perception.proto
pointcloud.proto
image.proto
)


protobuf_generate_python(PROTO_PYTHON_SRCS
proto_to_struct.proto
../protoc-plugin/proto_to_struct.proto
base.proto
imu.proto
gnss.proto
Expand All @@ -45,7 +45,8 @@ chasis.proto
perception.proto
OPTION "namespace=inner_struct,converter_namespace=converter")

add_executable(struct_pb_tutorial tutorial.cpp zpointcloud.cpp zimage.cpp
add_executable(struct_pb_tutorial tutorial.cpp
zpointcloud.cpp zimage.cpp
${PROTO_SRCS}
${PROTO_HDRS}
${PROTO_STRUCT_SRCS}
Expand All @@ -59,6 +60,7 @@ target_link_libraries(struct_pb_tutorial protobuf::libprotobuf
)

target_include_directories(struct_pb_tutorial PUBLIC
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}
${PCL_INCLUDE_DIRS}
Expand Down
3 changes: 0 additions & 3 deletions src/example/base.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ package inner_class;

import "proto_to_struct.proto";

// import "google/protobuf/descriptor.proto";


option(write_eigen_helper) = true;

enum ZFrameType{
Expand Down
22 changes: 0 additions & 22 deletions src/example/proto_to_struct.proto

This file was deleted.

0 comments on commit 7165cfe

Please sign in to comment.