@@ -6,15 +6,20 @@ find_package(ament_cmake_python REQUIRED)
6
6
find_package (bitbots_docs REQUIRED )
7
7
find_package (Protobuf REQUIRED )
8
8
9
- add_custom_target (${PROJECT_NAME} _generate_proto ALL )
9
+ add_custom_target (
10
+ ${PROJECT_NAME} _generate_proto ALL
11
+ COMMENT "Generating protobuf python interface including stubs" )
12
+
13
+ set (PROTO_FILES
14
+ bitbots_team_communication/RobocupProtocol/robocup_extension.proto )
10
15
11
16
add_custom_command (
12
17
TARGET ${PROJECT_NAME} _generate_proto
13
- COMMAND protoc
14
- --pyi_out ${CMAKE_SOURCE_DIR} /bitbots_team_communication/
15
- --python_out ${CMAKE_SOURCE_DIR} /bitbots_team_communication/
16
- --proto_path ${CMAKE_SOURCE_DIR} /bitbots_team_communication/RobocupProtocol
17
- ${CMAKE_SOURCE_DIR} /bitbots_team_communication/RobocupProtocol/robocup_extension.proto
18
+ COMMAND
19
+ protoc --pyi_out ${CMAKE_SOURCE_DIR} /bitbots_team_communication/
20
+ --python_out ${CMAKE_SOURCE_DIR} /bitbots_team_communication/ --proto_path
21
+ ${CMAKE_SOURCE_DIR} /bitbots_team_communication/RobocupProtocol
22
+ ${CMAKE_SOURCE_DIR} /${PROTO_FILES}
18
23
COMMENT "Generating protobuf python interface including stubs" )
19
24
20
25
enable_bitbots_docs ()
@@ -48,33 +53,31 @@ if(BUILD_TESTING)
48
53
49
54
find_package (ament_cmake_mypy REQUIRED )
50
55
56
+ # The following logic for manually filtering out the files can be removed if
57
+ # https://github.com/ament/ament_lint/pull/516 is merged and released in our
58
+ # ROS distro
51
59
52
- # The following logic for manually filtering out the files can be removed if
53
- # https://github.com/ament/ament_lint/pull/516 is merged and released in our ROS distro
54
-
55
60
# Collect all .py and .pyi files
56
61
file (GLOB_RECURSE PY_FILES "${CMAKE_CURRENT_LIST_DIR} /**/*.py" )
57
62
file (GLOB_RECURSE PYI_FILES "${CMAKE_CURRENT_LIST_DIR} /**/*.pyi" )
58
63
59
64
# Filter out .py files if a corresponding .pyi file exists
60
65
foreach (py_file IN LISTS PY_FILES )
61
- # Get the directory and basename (without extension)
62
- get_filename_component (py_dir "${py_file} " DIRECTORY )
63
- get_filename_component (py_basename "${py_file} " NAME_WE )
64
-
65
- # Construct the corresponding .pyi file path
66
- set (pyi_file "${py_dir} /${py_basename} .pyi" )
67
-
68
- # If a corresponding .pyi file exists, remove the .py file from the list
69
- if (EXISTS "${pyi_file } " )
70
- list (REMOVE_ITEM PY_FILES "${py_file} " )
71
- endif ()
66
+ # Get the directory and basename (without extension)
67
+ get_filename_component (py_dir "${py_file} " DIRECTORY )
68
+ get_filename_component (py_basename "${py_file} " NAME_WE )
69
+
70
+ # Construct the corresponding .pyi file path
71
+ set (PYI_FILE "${py_dir} /${py_basename} .pyi" )
72
+
73
+ # If a corresponding .pyi file exists, remove the .py file from the list
74
+ if (EXISTS "${PYI_FILE } " )
75
+ list (REMOVE_ITEM PY_FILES "${py_file} " )
76
+ endif ()
72
77
endforeach ()
73
78
74
- ament_mypy (
75
- CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR} /mypy.ini"
76
- ${PY_FILES} ${PYI_FILES}
77
- )
79
+ ament_mypy (CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR} /mypy.ini" ${PY_FILES}
80
+ ${PYI_FILES} )
78
81
endif ()
79
82
80
83
ament_package ()
0 commit comments