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 ros2_rust to be built within a distro's colcon workspace #370

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion rclrs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<build_depend>libclang-dev</build_depend>
<build_depend>rosidl_runtime_rs</build_depend>
<build_depend>rcl</build_depend>
<depend>rcl</depend>
<depend>builtin_interfaces</depend>
<depend>rcl_interfaces</depend>
<depend>rosgraph_msgs</depend>
Expand Down
1 change: 1 addition & 0 deletions rclrs_tests/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<depend>test_msgs</depend>
<depend>rclrs</depend>
<depend>rosidl_runtime_rs</depend>
<depend>rcl</depend>

<export>
<build_type>ament_cargo</build_type>
Expand Down
4 changes: 2 additions & 2 deletions rosidl_generator_rs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ament_index_register_resource("rosidl_runtime_packages")
ament_python_install_package(${PROJECT_NAME})

ament_package(
CONFIG_EXTRAS "rosidl_generator_rs-extras.cmake.in"
"cmake/rosidl_generator_rs_get_typesupports.cmake"
CONFIG_EXTRAS
"rosidl_generator_rs-extras.cmake.in"
"cmake/register_rs.cmake"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

find_package(rmw_implementation_cmake REQUIRED)
find_package(rmw REQUIRED)

if(NOT WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
Expand All @@ -23,17 +20,8 @@ if(NOT WIN32)
endif()
endif()

# Get a list of typesupport implementations from valid rmw implementations.
rosidl_generator_rs_get_typesupports(_typesupport_impls)

if(_typesupport_impls STREQUAL "")
message(WARNING "No valid typesupport for Rust generator. Rust messages will not be generated.")
return()
endif()

set(_output_path
"${CMAKE_CURRENT_BINARY_DIR}/rosidl_generator_rs/${PROJECT_NAME}")
set(_generated_extension_files "")
set(_generated_common_rs_files "")

set(_generated_msg_rs_files "")
Expand All @@ -42,10 +30,6 @@ set(_generated_srv_rs_files "")
set(_has_msg FALSE)
set(_has_srv FALSE)

foreach(_typesupport_impl ${_typesupport_impls})
set(_generated_extension_${_typesupport_impl}_files "")
endforeach()

foreach(_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES})
get_filename_component(_parent_folder "${_idl_file}" DIRECTORY)
get_filename_component(_parent_folder "${_parent_folder}" NAME)
Expand Down Expand Up @@ -75,22 +59,12 @@ if(${_has_msg})
list(APPEND _generated_msg_rs_files
"${_output_path}/rust/src/msg.rs"
)

foreach(_typesupport_impl ${_typesupport_impls})
list_append_unique(_generated_extension_${_typesupport_impl}_files "${_output_path}/msg_rs.ep.${_typesupport_impl}.c")
list_append_unique(_generated_extension_files "${_generated_extension_${_typesupport_impl}_files}")
endforeach()
endif()

if(${_has_srv})
list(APPEND _generated_srv_rs_files
"${_output_path}/rust/src/srv.rs"
)

foreach(_typesupport_impl ${_typesupport_impls})
list_append_unique(_generated_extension_${_typesupport_impl}_files "${_output_path}/srv_rs.ep.${_typesupport_impl}.c")
list_append_unique(_generated_extension_files "${_generated_extension_${_typesupport_impl}_files}")
endforeach()
endif()

set(_dependency_files "")
Expand Down Expand Up @@ -156,23 +130,18 @@ add_dependencies(${rosidl_generate_interfaces_TARGET} ${rosidl_generate_interfac

set_property(
SOURCE
${_generated_extension_files}
${_generated_common_rs_files}
${_generated_msg_rs_files}
${_generated_srv_rs_files}
PROPERTY GENERATED 1)

set(_rsext_suffix "__rsext")
foreach(_typesupport_impl ${_typesupport_impls})
find_package(${_typesupport_impl} REQUIRED)

if(NOT rosidl_generate_interfaces_SKIP_INSTALL)
install(
DIRECTORY "${_output_path}/rust"
DESTINATION "share/${PROJECT_NAME}"
)
endif()
endforeach()
if(NOT rosidl_generate_interfaces_SKIP_INSTALL)
install(
DIRECTORY "${_output_path}/rust"
DESTINATION "share/${PROJECT_NAME}"
)
endif()

if(BUILD_TESTING AND rosidl_generate_interfaces_ADD_LINTER_TESTS)
if(
Expand Down

This file was deleted.

Loading