Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow proto2ros_generate() to depend on protobuf_generate() #124

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds the dependency to the custom target that is downstream of the actual proto2ros generate command, so it doesn't really work.

DEPENDS ${PROJECT_NAME}_proto_gen
)

rosidl_generate_interfaces(
Expand Down
Loading