mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 20:07:35 +08:00
Update cdrstream code generator including typehash
This commit is contained in:
committed by
Beat Küng
parent
a87456b38b
commit
e1a7fbce71
@@ -424,9 +424,11 @@ add_dependencies(uorb_msgs prebuild_targets uorb_headers)
|
||||
if(CONFIG_LIB_CDRSTREAM)
|
||||
set(uorb_cdr_idl)
|
||||
set(uorb_cdr_msg)
|
||||
set(uorb_cdr_hash)
|
||||
set(uorb_cdr_idl_uorb)
|
||||
set(idl_include_path ${PX4_BINARY_DIR}/uORB/idl)
|
||||
set(idl_out_path ${idl_include_path}/px4/msg)
|
||||
set(idl_rihs01_out_path ${idl_include_path}/px4)
|
||||
set(idl_uorb_path ${PX4_BINARY_DIR}/msg/px4/msg)
|
||||
|
||||
# Make sure that CycloneDDS has been checkout out
|
||||
@@ -457,6 +459,7 @@ if(CONFIG_LIB_CDRSTREAM)
|
||||
configure_file(${msg_file} ${idl_out_path}/${msg}.msg COPYONLY)
|
||||
list(APPEND uorb_cdr_idl ${idl_out_path}/${msg}.idl)
|
||||
list(APPEND uorb_cdr_msg ${idl_out_path}/${msg}.msg)
|
||||
list(APPEND uorb_cdr_hash ${idl_out_path}/${msg}.json)
|
||||
list(APPEND uorb_cdr_idl_uorb ${idl_uorb_path}/${msg}.h)
|
||||
endforeach()
|
||||
|
||||
@@ -476,6 +479,25 @@ if(CONFIG_LIB_CDRSTREAM)
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
file(CREATE_LINK ${idl_rihs01_out_path} ${idl_include_path}/px4_msgs SYMBOLIC)
|
||||
|
||||
# Generate IDL from .msg using rosidl_adapter
|
||||
# Note this a submodule inside PX4 hence no ROS2 installation required
|
||||
add_custom_command(
|
||||
OUTPUT ${uorb_cdr_hash}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-E env "PYTHONPATH=${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_adapter:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_cli:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_parser:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_generator_type_description"
|
||||
${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/cdrstream/idl2rihs01.py
|
||||
--output-dir ${idl_rihs01_out_path}
|
||||
${uorb_cdr_idl}
|
||||
DEPENDS
|
||||
${uorb_cdr_idl}
|
||||
git_cyclonedds
|
||||
COMMENT "Generating RIHS01 hashes from IDL"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# Generate C definitions from IDL
|
||||
set(CYCLONEDDS_DIR ${PX4_SOURCE_DIR}/src/lib/cdrstream/cyclonedds)
|
||||
include("${CYCLONEDDS_DIR}/cmake/Modules/Generate.cmake")
|
||||
@@ -505,6 +527,7 @@ if(CONFIG_LIB_CDRSTREAM)
|
||||
DEPENDS
|
||||
uorb_cdrstream
|
||||
${msg_files}
|
||||
${uorb_cdr_hash}
|
||||
${PX4_SOURCE_DIR}/Tools/msg/templates/cdrstream/uorb_idl_header.h.em
|
||||
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
|
||||
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
|
||||
@@ -534,8 +557,10 @@ if(CONFIG_MODULES_ZENOH)
|
||||
-f ${msg_files}
|
||||
-o ${PX4_BINARY_DIR}/src/modules/zenoh/
|
||||
-e ${PX4_SOURCE_DIR}/Tools/zenoh/templates/zenoh
|
||||
-rihs ${idl_rihs01_out_path}
|
||||
DEPENDS
|
||||
${msg_files}
|
||||
${uorb_cdr_hash}
|
||||
${PX4_SOURCE_DIR}/Tools/zenoh/templates/zenoh/uorb_pubsub_factory.hpp.em
|
||||
${PX4_SOURCE_DIR}/Tools/zenoh/px_generate_zenoh_topic_files.py
|
||||
COMMENT "Generating Zenoh Topic Code"
|
||||
|
||||
Reference in New Issue
Block a user