Skip to content

Commit

Permalink
remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
171930433 committed Mar 20, 2024
1 parent 85ef005 commit 6263a6b
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 37 deletions.
15 changes: 5 additions & 10 deletions src/example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

set(ENV{proto_message} "proto_message")
set(ENV{struct_pb_options} "namespace=zhito.inner_struct,converter_namespace=zhito.converter")

# 设置编译器选项
add_compile_options(-Wno-attributes)
Expand Down Expand Up @@ -30,27 +31,21 @@ protobuf_generate_python(PROTO_PYTHON_SRCS

protobuf_generate_struct_pb(PROTO_STRUCT_SRCS PROTO_STRUCT_HDRS
${PROTO_FILES}
OPTION "namespace=zhito.inner_struct,converter_namespace=zhito.converter"
OPTION $ENV{struct_pb_options}
)


add_library(proto_common OBJECT
${PROTO_SRCS}
${PROTO_HDRS}
${PROTO_SRCS}
${PROTO_STRUCT_SRCS}
${PROTO_STRUCT_HDRS}
${PROTO_PYTHON_SRCS}
)

target_link_libraries(proto_common protobuf::libprotobuf )

target_include_directories(proto_common PUBLIC
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}
${PCL_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/src/protoc-plugin
${CMAKE_CURRENT_LIST_DIR} # base.h
${CMAKE_BINARY_DIR}/src/protoc-plugin # proto_to_struct.h
)


Expand Down
25 changes: 9 additions & 16 deletions src/example/message/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,23 @@ file(GLOB PROTO_FILES "*.proto")


# generate .pb.cc .pb.h
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS
${PROTO_FILES}
)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTO_FILES})

protobuf_generate_python(PROTO_PYTHON_SRCS
${PROTO_FILES}
)
protobuf_generate_python(PROTO_PYTHON_SRCS ${PROTO_FILES})

# 删除点云,图片proto记录文件
list(FILTER PROTO_FILES EXCLUDE REGEX "pointcloud\\.proto$|image\\.proto$")

protobuf_generate_struct_pb(PROTO_STRUCT_SRCS PROTO_STRUCT_HDRS
${PROTO_FILES}
OPTION "namespace=zhito.inner_struct,converter_namespace=zhito.converter"
OPTION $ENV{struct_pb_options}
)

add_library($ENV{proto_message} OBJECT
#
zpointcloud.cpp zimage.cpp
${PROTO_SRCS}
${PROTO_HDRS}
#
${PROTO_SRCS}
${PROTO_STRUCT_SRCS}
${PROTO_STRUCT_HDRS}
${PROTO_PYTHON_SRCS}
)

Expand All @@ -34,14 +28,13 @@ target_link_libraries($ENV{proto_message} protobuf::libprotobuf
)

target_include_directories($ENV{proto_message} PUBLIC
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/.. # 找到common
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR} # 找到build目录下的zframe.struct_pb.h
${CMAKE_CURRENT_LIST_DIR}/.. # 找到iguana
${CMAKE_CURRENT_BINARY_DIR}/.. # 找到common
# 第三方库
${PCL_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/src/protoc-plugin
)


4 changes: 2 additions & 2 deletions src/example/message/pointcloud.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ syntax = "proto3";
package zhito.inner_class;

import "zframe.proto";
import "base.proto";
import "proto_to_struct.proto";
// import "base.proto";
// import "proto_to_struct.proto";
message ZPointCloudXYZIT
{
ZFrame header = 1 ;
Expand Down
4 changes: 2 additions & 2 deletions src/example/message/zframe.proto
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
syntax = "proto3";
package zhito.inner_class;

import "base.proto";
import "proto_to_struct.proto";
// import "base.proto";
// import "proto_to_struct.proto";
enum ZFrameType{
None = 0;
VEHICLE_MODEL = 1; // 车辆运动约束虚拟帧
Expand Down
2 changes: 1 addition & 1 deletion src/example/message/zimage.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "zimage.hpp"
#include "src/example/message/zimage.hpp"

#include <opencv2/imgcodecs.hpp>
#include <string_view>
Expand Down
4 changes: 2 additions & 2 deletions src/example/message/zimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <pcl/point_cloud.h>

#include "zframe.struct_pb.h"
#include "image.pb.h"
#include "src/example/message/zframe.struct_pb.h"
#include "src/example/message/image.pb.h"

#include <opencv2/core.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/example/message/zpointcloud.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "zpointcloud.hpp"
#include "src/example/message/zpointcloud.hpp"

#include <pcl/compression/octree_pointcloud_compression.h>
#include <pcl/octree/octree_pointcloud.h>
Expand Down
6 changes: 3 additions & 3 deletions src/example/message/zpointcloud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <pcl/point_cloud.h>

#include "zframe.struct_pb.h"
#include "pointcloud.pb.h"
#include "xyzit_points.hpp"
#include "src/example/message/zframe.struct_pb.h"
#include "src/example/message/pointcloud.pb.h"
#include "src/example/message/xyzit_points.hpp"

// save to file
#include <pcl/io/pcd_io.h>
Expand Down

0 comments on commit 6263a6b

Please sign in to comment.