Only run fastrtpsgen if needed

If no RTPS import or export messages defined, then don't call fastrtpsgen

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2017-08-01 22:32:43 +02:00
committed by Lorenz Meier
parent fc3d49240e
commit b313bfdaa9
@@ -48,7 +48,6 @@ if(NOT GENERATE_RTPS_BRIDGE MATCHES "off")
list(APPEND receive_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg) list(APPEND receive_topic_files ${PX4_SOURCE_DIR}/msg/${topic}.msg)
endforeach() endforeach()
set(topic_bridge_files_out microRTPS_client.cpp microRTPS_transport.cxx microRTPS_transport.h)
foreach(topic ${config_rtps_send_topics}) foreach(topic ${config_rtps_send_topics})
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.cxx) list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.cxx)
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.h) list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Publisher.h)
@@ -59,18 +58,34 @@ if(NOT GENERATE_RTPS_BRIDGE MATCHES "off")
list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Subscriber.h) list(APPEND topic_bridge_files_out ${msg_out_path}/${topic}_Subscriber.h)
endforeach() endforeach()
add_custom_command(OUTPUT ${topic_bridge_files_out} if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_topics}" STREQUAL "")
COMMAND ${PYTHON_EXECUTABLE} set(topic_bridge_files_out microRTPS_client.cpp microRTPS_transport.cxx microRTPS_transport.h)
${PX4_SOURCE_DIR}/Tools/generate_microRTPS_bridge.py
-f $ENV{FASTRTPSGEN_DIR} set(send_topic_files_opt)
-s ${send_topic_files} if (NOT "${send_topic_files}" STREQUAL "")
-r ${receive_topic_files} set(send_topic_opt "-s")
-t ${topic_msg_path} endif()
-u ${msg_out_path}
DEPENDS ${DEPENDS} ${send_topic_files} ${receive_topic_files} set(receive_topic_files_opt)
COMMENT "Generating RTPS topic bridge" if (NOT "${receive_topic_files}" STREQUAL "")
VERBATIM set(receive_topic_opt "-r")
) endif()
message("SEND ${send_topic_files_opt}")
message("RECV ${receive_topic_files_opt}")
add_custom_command(OUTPUT ${topic_bridge_files_out}
COMMAND ${PYTHON_EXECUTABLE}
${PX4_SOURCE_DIR}/Tools/generate_microRTPS_bridge.py
-f $ENV{FASTRTPSGEN_DIR}
${send_topic_opt} ${send_topic_files}
${receive_topic_opt} ${receive_topic_files}
-t ${topic_msg_path}
-u ${msg_out_path}
DEPENDS ${DEPENDS} ${send_topic_files} ${receive_topic_files}
COMMENT "Generating RTPS topic bridge"
VERBATIM
)
endif()
endif() endif()
px4_add_module( px4_add_module(