CMakeLists.txt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright 2017 Esteve Fernandez <esteve@apache.org>
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. find_package(Python3 REQUIRED COMPONENTS Interpreter)
  15. set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
  16. add_custom_command(
  17. OUTPUT
  18. ${_generated_common_rs_files}
  19. ${_generated_msg_rs_files}
  20. ${_generated_srv_rs_files}
  21. ${_generated_action_rs_files}
  22. COMMAND ${PYTHON_EXECUTABLE} ${rosidl_generator_rs_BIN}
  23. --generator-arguments-file "${generator_arguments_file}"
  24. --typesupport-impls "${_typesupport_impls}"
  25. DEPENDS ${target_dependencies}
  26. COMMENT "Generating Rust code for ROS interfaces"
  27. VERBATIM
  28. )
  29. if(TARGET ${rosidl_generate_interfaces_TARGET}${_target_suffix})
  30. message(WARNING "Custom target ${rosidl_generate_interfaces_TARGET}${_target_suffix} already exists")
  31. else()
  32. add_custom_target(
  33. ${rosidl_generate_interfaces_TARGET}${_target_suffix} ALL
  34. DEPENDS
  35. ${_generated_common_rs_files}
  36. ${_generated_msg_rs_files}
  37. ${_generated_srv_rs_files}
  38. ${_generated_action_rs_files}
  39. )
  40. endif()