Skip to content

Commit

Permalink
Allow proto2ros_generate() to depend on protobuf_generate() (#124)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <mhidalgo@theaiinstitute.com>
  • Loading branch information
mhidalgo-bdai authored Oct 7, 2024
1 parent 6ed50d7 commit 9d610c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions proto2ros/cmake/proto2ros_generate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function(proto2ros_generate target)
cmake_parse_arguments(
ARG "NO_LINT"
"PACKAGE_NAME;CONFIG_FILE;INTERFACES_OUT_VAR;PYTHON_OUT_VAR;CPP_OUT_VAR;INCLUDE_OUT_VAR"
"PROTOS;PROTO_DESCRIPTORS;IMPORT_DIRS;CONFIG_OVERLAYS;APPEND_PYTHONPATH" ${ARGN})
"PROTOS;PROTO_DESCRIPTORS;IMPORT_DIRS;CONFIG_OVERLAYS;APPEND_PYTHONPATH;DEPENDS" ${ARGN})
if(NOT ARG_PACKAGE_NAME)
set(ARG_PACKAGE_NAME ${PROJECT_NAME})
endif()
Expand Down Expand Up @@ -138,7 +138,7 @@ function(proto2ros_generate target)
${PYTHON_EXECUTABLE} -m proto2ros.cli.generate ${PROTO2ROS_GENERATE_OPTIONS} ${ARG_PACKAGE_NAME} ${PROTO_DESCRIPTORS}
COMMAND ${CMAKE_COMMAND} -E compare_files "${OUTPUT_PATH}/manifest.txt" "${OUTPUT_PATH}/manifest.orig.txt"
COMMENT "Generate Protobuf <-> ROS interop interfaces (must reconfigure if the cardinality of the output set changes)"
DEPENDS ${PROTO_DESCRIPTORS}
DEPENDS ${PROTO_DESCRIPTORS} ${ARG_DEPENDS}
VERBATIM
)
add_custom_target(${target} DEPENDS ${output_files})
Expand Down
9 changes: 8 additions & 1 deletion proto2ros/cmake/proto2ros_vendor_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
macro(proto2ros_vendor_package target)
set(options NO_LINT)
set(one_value_keywords PACKAGE_NAME)
set(multi_value_keywords PROTOS IMPORT_DIRS CONFIG_OVERLAYS ROS_DEPENDENCIES CPP_DEPENDENCIES CPP_INCLUDES CPP_SOURCES PYTHON_MODULES PYTHON_PACKAGES)
set(
multi_value_keywords
PROTOS IMPORT_DIRS CONFIG_OVERLAYS ROS_DEPENDENCIES CPP_DEPENDENCIES
CPP_INCLUDES CPP_SOURCES PYTHON_MODULES PYTHON_PACKAGES DEPENDS
)
cmake_parse_arguments(ARG "${options}" "${one_value_keywords}" "${multi_value_keywords}" ${ARGN})

if(NOT ARG_PACKAGE_NAME)
Expand Down Expand Up @@ -43,6 +47,9 @@ macro(proto2ros_vendor_package target)
if(ARG_NO_LINT)
list(APPEND proto2ros_generate_OPTIONS NO_LINT)
endif()
if(ARG_DEPENDS)
list(APPEND proto2ros_generate_OPTIONS DEPENDS ${ARG_DEPENDS})
endif()

proto2ros_generate(
${target}_messages_gen
Expand Down
4 changes: 1 addition & 3 deletions proto2ros_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ proto2ros_generate(
CPP_OUT_VAR cpp_sources
INCLUDE_OUT_VAR cpp_include_dir
APPEND_PYTHONPATH "${PROTO_OUT_DIR}"
)
add_dependencies(
${PROJECT_NAME}_messages_gen ${PROJECT_NAME}_proto_gen
DEPENDS ${PROJECT_NAME}_proto_gen
)

rosidl_generate_interfaces(
Expand Down

0 comments on commit 9d610c9

Please sign in to comment.