Skip to content

Commit

Permalink
Merge branch 'gsk/compile_in_1804_gcc9' into gsk/compile_in_2204
Browse files Browse the repository at this point in the history
  • Loading branch information
171930433 committed Mar 12, 2024
2 parents 80ae9e2 + 396a805 commit 7e15a7a
Show file tree
Hide file tree
Showing 66 changed files with 56 additions and 212 deletions.
19 changes: 14 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
cmake_minimum_required(VERSION 3.10)

set(CMAKE_C_COMPILER gcc-9)
set(CMAKE_CXX_COMPILER g++-9)
set(CMAKE_CXX_STANDARD 17)

project(yaLanTingLibs
VERSION 0.2.9
DESCRIPTION "yaLanTingLibs"
HOMEPAGE_URL "https://github.com/alibaba/yalantinglibs"
LANGUAGES CXX
)

find_package(Protobuf REQUIRED)

# 将插件目录添加到环境变量
execute_process(COMMAND export PATH=$PATH:${CMAKE_BINARY_DIR}/output/bin/)



# load pack finder
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Find/)

Expand All @@ -31,8 +43,5 @@ if(CMAKE_PROJECT_NAME STREQUAL "yaLanTingLibs") # if ylt is top-level project
endif()


# set(CMAKE_C_COMPILER gcc-9)
# set(CMAKE_CXX_COMPILER g++-9)
list(APPEND CMAKE_PREFIX_PATH "/home/gsk/pro/CyberRT/install/")

add_subdirectory(src/struct_pb/protoc-plugin)
# add_subdirectory(src/struct_pb/protoc-plugin)
add_subdirectory(src/example)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ add_compile_options(-Wno-attributes)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/examples)

include(../cmake/struct_pb.cmake)

set(protobuf_generate_PLUGIN "protoc-gen-struct_pb")
include(cmake/struct_pb.cmake)

cmake_policy(SET CMP0075 NEW)
find_package(PCL REQUIRED COMPONENTS common io)
Expand All @@ -27,24 +29,8 @@ if (Protobuf_FOUND)
pointcloud.proto
image.proto
)
add_executable(struct_pb_tutorial tutorial.cpp zpointcloud.cpp zimage.cpp
${PROTO_SRCS}
${PROTO_HDRS})
target_link_libraries(struct_pb_tutorial protobuf::libprotobuf
pcl_common pcl_io # pcl
opencv_imgcodecs opencv_core # opencv
)



target_include_directories(struct_pb_tutorial PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}
${PCL_INCLUDE_DIRS}
${OPENCV_INCLUDE_DIRS}
)

target_protos_struct_pb(struct_pb_tutorial PRIVATE
protobuf_generate_struct_pb(PROTO_STRUCT_SRCS PROTO_STRUCT_HDRS
# addressbook.proto
base.proto
imu.proto
Expand All @@ -55,4 +41,22 @@ if (Protobuf_FOUND)
# pointcloud.proto
OPTION "namespace=inner_struct,converter_namespace=converter")


add_executable(struct_pb_tutorial tutorial.cpp
${PROTO_SRCS}
${PROTO_HDRS}
${PROTO_STRUCT_SRCS}
${PROTO_STRUCT_HDRS}
)

target_link_libraries(struct_pb_tutorial protobuf::libprotobuf pcl_common)

target_include_directories(struct_pb_tutorial PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_LIST_DIR}
${PCL_INCLUDE_DIRS}
)



endif()
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package inner_class;

import "proto_to_struct.proto";

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


option(write_eigen_helper) = true;

enum ZFrameType{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function(protobuf_generate_modified)
set(_opt "${opt},dllexport_decl=${protobuf_generate_EXPORT_MACRO}")
endif()
set(_opt "${_opt}:")


if(protobuf_generate_PLUGIN)
set(_plugin "--plugin=${protobuf_generate_PLUGIN}")
endif()
Expand Down Expand Up @@ -172,7 +174,9 @@ function(protobuf_generate_struct_pb SRCS HDRS)
set(_outvar)
protobuf_generate_modified(${_append_arg} ${_descriptors}
LANGUAGE struct_pb EXPORT_MACRO ${protobuf_generate_struct_pb_EXPORT_MACRO}
PLUGIN $<TARGET_FILE:protoc-gen-struct_pb>
# PLUGIN $<TARGET_FILE:protoc-gen-struct_pb>
# PLUGIN "/home/gsk/pro/yalantinglibs/build/output/bin/protoc-gen-struct_pb"
PLUGIN "struct_pb"
OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files}
PROTOC_OPTION ${_opt}
)
Expand Down Expand Up @@ -224,7 +228,9 @@ function(target_protos_struct_pb target)
protobuf_generate_modified(
TARGET ${target}
LANGUAGE struct_pb EXPORT_MACRO ${target_protos_struct_pb_EXPORT_MACRO}
PLUGIN $<TARGET_FILE:protoc-gen-struct_pb>
# PLUGIN $<TARGET_FILE:protoc-gen-struct_pb>
# PLUGIN "/home/gsk/pro/yalantinglibs/build/output/bin/protoc-gen-struct_pb"
PLUGIN "struct_pb"
${_import_arg} PROTOS ${_proto_files}
PROTOC_OPTION ${_opt}
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 9 additions & 5 deletions src/struct_pb/protoc-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_C_COMPILER gcc-9)
# set(CMAKE_CXX_COMPILER g++-9)
# set(CMAKE_CXX_STANDARD 17)

project(protoc-gen-struct_pb)


# add_subdirectory(example)


set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin)
find_package(Protobuf QUIET)
if (Protobuf_FOUND)

file(GLOB SRCS "*.cpp" "*.cc" "*.h")
add_executable(protoc-gen-struct_pb ${SRCS})
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS proto_to_struct.proto)

add_executable(protoc-gen-struct_pb ${SRCS} ${PROTO_SRCS} ${PROTO_HDRS})
target_include_directories(protoc-gen-struct_pb PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(protoc-gen-struct_pb PUBLIC protobuf::libprotoc protobuf::libprotobuf)
install(
TARGETS protoc-gen-struct_pb
Expand All @@ -25,5 +31,3 @@ else ()
"see https://alibaba.github.io/yalantinglibs/en/struct_pb/struct_pb_generating_your_struct.html"
)
endif ()

add_subdirectory(example)
78 changes: 0 additions & 78 deletions src/struct_pb/protoc-plugin/proto_to_struct.pb.cc

This file was deleted.

104 changes: 0 additions & 104 deletions src/struct_pb/protoc-plugin/proto_to_struct.pb.h

This file was deleted.

0 comments on commit 7e15a7a

Please sign in to comment.