Skip to content
This repository was archived by the owner on Jan 28, 2023. It is now read-only.

Commit 58efe43

Browse files
authored
Merge pull request #44 from spiralray/dev/protobuf-package
Imprement protobuf package
2 parents c12fb1f + 6056775 commit 58efe43

20 files changed

Lines changed: 132 additions & 35 deletions

consai2r2_protobuf/CMakeLists.txt

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(consai2r2_protobuf)
3+
4+
# Default to C++14
5+
if(NOT CMAKE_CXX_STANDARD)
6+
set(CMAKE_CXX_STANDARD 14)
7+
endif()
8+
9+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
10+
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
11+
endif()
12+
13+
# find dependencies
14+
find_package(ament_cmake REQUIRED)
15+
find_package(Protobuf REQUIRED)
16+
find_package(python_cmake_module REQUIRED)
17+
18+
set(_PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
19+
20+
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
21+
set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_DEBUG}")
22+
endif()
23+
24+
ament_python_install_package(${PROJECT_NAME})
25+
26+
# Protobuf
27+
include_directories(
28+
${PROTOBUF_INCLUDE_DIRS}
29+
)
30+
31+
set(protobuf_files
32+
proto/messages_robocup_ssl_wrapper.proto
33+
proto/messages_robocup_ssl_geometry.proto
34+
proto/messages_robocup_ssl_detection.proto
35+
proto/messages_robocup_ssl_robot_status.proto
36+
proto/messages_robocup_ssl_refbox_log.proto
37+
proto/referee.proto
38+
proto/game_event.proto
39+
proto/grSim_Replacement.proto
40+
proto/grSim_Commands.proto
41+
proto/grSim_Packet.proto
42+
)
43+
44+
protobuf_generate_cpp(PROTO_CPP PROTO_H
45+
${protobuf_files}
46+
)
47+
48+
include_directories(include ${CMAKE_CURRENT_BINARY_DIR})
49+
50+
add_library(consai2r2_protobuf
51+
SHARED ${PROTO_CPP} ${PROTO_H}
52+
)
53+
54+
target_link_libraries(consai2r2_protobuf ${PROTOBUF_LIBRARIES})
55+
56+
protobuf_generate_python(PROTO_PY
57+
${protobuf_files}
58+
)
59+
60+
add_custom_target(consai2r2_protobuf_py ALL DEPENDS ${PROTO_PY})
61+
62+
install(
63+
FILES ${PROTO_H}
64+
DESTINATION include/${PROJECT_NAME})
65+
66+
install(
67+
TARGETS consai2r2_protobuf
68+
ARCHIVE DESTINATION lib
69+
LIBRARY DESTINATION lib)
70+
71+
install(FILES ${PROTO_PY}
72+
DESTINATION "${PYTHON_INSTALL_DIR}")
73+
74+
ament_export_include_directories(include)
75+
ament_export_libraries(consai2r2_protobuf)
76+
ament_export_dependencies(ament_cmake)
77+
ament_export_dependencies(Protobuf)
78+
ament_export_dependencies(python_cmake_module)
79+
80+
81+
if(BUILD_TESTING)
82+
find_package(ament_lint_auto REQUIRED)
83+
# the following line skips the linter which checks for copyrights
84+
# uncomment the line when a copyright and license is not present in all source files
85+
#set(ament_cmake_copyright_FOUND TRUE)
86+
# the following line skips cpplint (only works in a git repo)
87+
# uncomment the line when this package is not in a git repo
88+
#set(ament_cmake_cpplint_FOUND TRUE)
89+
ament_lint_auto_find_test_dependencies()
90+
endif()
91+
92+
ament_package()

consai2r2_protobuf/consai2r2_protobuf/__init__.py

Whitespace-only changes.

consai2r2_protobuf/package.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>consai2r2_protobuf</name>
5+
<version>0.0.0</version>
6+
<description>Protobuf package for CON-SAI2</description>
7+
<maintainer email="macakasit@gmail.com">akshota</maintainer>
8+
<license>MIT</license>
9+
10+
<buildtool_depend>ament_cmake</buildtool_depend>
11+
12+
<depend>protobuf-dev</depend>
13+
14+
<test_depend>ament_lint_auto</test_depend>
15+
<test_depend>ament_lint_common</test_depend>
16+
17+
<export>
18+
<build_type>ament_cmake</build_type>
19+
</export>
20+
</package>

consai2r2_receiver/include/consai2r2_receiver/proto/game_event.proto renamed to consai2r2_protobuf/proto/game_event.proto

File renamed without changes.

consai2r2_sender/include/consai2r2_sender/proto/grSim_Commands.proto renamed to consai2r2_protobuf/proto/grSim_Commands.proto

File renamed without changes.

consai2r2_sender/include/consai2r2_sender/proto/grSim_Packet.proto renamed to consai2r2_protobuf/proto/grSim_Packet.proto

File renamed without changes.

consai2r2_sender/include/consai2r2_sender/proto/grSim_Replacement.proto renamed to consai2r2_protobuf/proto/grSim_Replacement.proto

File renamed without changes.

consai2r2_receiver/include/consai2r2_receiver/proto/messages_robocup_ssl_detection.proto renamed to consai2r2_protobuf/proto/messages_robocup_ssl_detection.proto

File renamed without changes.

consai2r2_receiver/include/consai2r2_receiver/proto/messages_robocup_ssl_geometry.proto renamed to consai2r2_protobuf/proto/messages_robocup_ssl_geometry.proto

File renamed without changes.

consai2r2_receiver/include/consai2r2_receiver/proto/messages_robocup_ssl_refbox_log.proto renamed to consai2r2_protobuf/proto/messages_robocup_ssl_refbox_log.proto

File renamed without changes.

0 commit comments

Comments
 (0)