microRTPS: split the microRTPS client and agent dest directories for better visbility and handling

This commit is contained in:
TSC21 2020-08-18 15:45:51 +02:00 committed by Nuno Marques
parent cc4cc05dd7
commit a091a70470
3 changed files with 21 additions and 20 deletions

View File

@ -50,6 +50,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR
endif()
endif()
file(GLOB MICRORTPS_AGENT_SOURCES *.cpp *.h)
file(GLOB MICRORTPS_AGENT_SOURCES src/*.cpp src/*.h)
add_executable(micrortps_agent ${MICRORTPS_AGENT_SOURCES})
target_link_libraries(micrortps_agent fastrtps fastcdr)

View File

@ -264,10 +264,10 @@ else:
# get ROS 2 version, if exists
ros2_distro = ''
ros_version = os.environ.get('ROS_VERSION')
if ros_version == '2' :
if ros_version == '2':
if args.ros2_distro != '':
ros2_distro = args.ros2_distro
else :
else:
ros2_distro = os.environ.get('ROS_DISTRO')
# get FastRTPS version
@ -414,7 +414,7 @@ def generate_agent(out_dir):
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_TOPICS_SRC_TEMPL_FILE)
if cmakelists:
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, out_dir,
px_generate_uorb_topic_files.generate_uRTPS_general(classifier.msgs_to_send, classifier.alias_msgs_to_send, classifier.msgs_to_receive, classifier.alias_msgs_to_receive, msg_dir, os.path.dirname(out_dir),
urtps_templates_dir, package, px_generate_uorb_topic_files.INCL_DEFAULT, classifier.msg_id_map, fastrtps_version, ros2_distro, uRTPS_AGENT_CMAKELISTS_TEMPL_FILE)
# Final steps to install agent
@ -450,10 +450,10 @@ def generate_agent(out_dir):
cp_wildcard(os.path.join(urtps_templates_dir,
"microRTPS_transport.*"), agent_out_dir)
if cmakelists:
os.rename(os.path.join(out_dir, "microRTPS_agent_CMakeLists.txt"),
os.path.join(out_dir, "CMakeLists.txt"))
os.rename(os.path.join(os.path.dirname(out_dir), "microRTPS_agent_CMakeLists.txt"),
os.path.join(os.path.dirname(out_dir), "CMakeLists.txt"))
if (mkdir_build):
mkdir_p(os.path.join(out_dir, "build"))
mkdir_p(os.path.join(os.path.dirname(out_dir), "build"))
os.chdir(prev_cwd_path)
return 0

View File

@ -32,6 +32,7 @@
############################################################################
set(msg_out_path ${CMAKE_CURRENT_BINARY_DIR})
get_filename_component(micrortps_bridge_path ${msg_out_path} PATH)
if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_topics}" STREQUAL "")
@ -54,19 +55,19 @@ if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_t
endif()
foreach(topic ${config_rtps_send_topics})
list(APPEND topic_bridge_files_out ${msg_out_path}/micrortps_agent/${topic}_Publisher.cpp)
list(APPEND topic_bridge_files_out ${msg_out_path}/micrortps_agent/${topic}_Publisher.h)
list(APPEND topic_bridge_files_out ${micrortps_bridge_path}/micrortps_agent/${topic}_Publisher.cpp)
list(APPEND topic_bridge_files_out ${micrortps_bridge_path}/micrortps_agent/${topic}_Publisher.h)
endforeach()
foreach(topic ${config_rtps_receive_topics})
list(APPEND topic_bridge_files_out ${msg_out_path}/micrortps_agent/${topic}_Subscriber.cpp)
list(APPEND topic_bridge_files_out ${msg_out_path}/micrortps_agent/${topic}_Subscriber.h)
list(APPEND topic_bridge_files_out ${micrortps_bridge_path}/micrortps_agent/${topic}_Subscriber.cpp)
list(APPEND topic_bridge_files_out ${micrortps_bridge_path}/micrortps_agent/${topic}_Subscriber.h)
endforeach()
list(APPEND topic_bridge_files_out
${msg_out_path}/micrortps_client/microRTPS_client.cpp
${msg_out_path}/micrortps_client/microRTPS_transport.cpp
${msg_out_path}/micrortps_client/microRTPS_transport.h
${micrortps_bridge_path}/micrortps_client/microRTPS_client.cpp
${micrortps_bridge_path}/micrortps_client/microRTPS_transport.cpp
${micrortps_bridge_path}/micrortps_client/microRTPS_transport.h
)
add_custom_command(OUTPUT ${topic_bridge_files_out}
@ -78,9 +79,9 @@ if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_t
--topic-msg-dir ${PX4_SOURCE_DIR}/msg
--uorb-templates-dir templates/uorb_microcdr
--urtps-templates-dir templates/urtps
--agent-outdir ${CMAKE_CURRENT_BINARY_DIR}/micrortps_agent
--client-outdir ${CMAKE_CURRENT_BINARY_DIR}/micrortps_client
--idl-dir ${CMAKE_CURRENT_BINARY_DIR}/micrortps_agent/idl
--agent-outdir ${micrortps_bridge_path}/micrortps_agent/src
--client-outdir ${micrortps_bridge_path}/micrortps_client
--idl-dir ../micrortps_agent/idl
>micrortps_bridge.log >/dev/null
DEPENDS ${send_topic_files} ${receive_topic_files}
COMMENT "Generating RTPS topic bridge"
@ -93,11 +94,11 @@ if (NOT "${config_rtps_send_topics}" STREQUAL "" OR NOT "${config_rtps_receive_t
STACK_MAIN 4096
INCLUDES
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/micrortps_client
${micrortps_bridge_path}/micrortps_client
SRCS
microRTPS_client_main.cpp
${msg_out_path}/micrortps_client/microRTPS_client.cpp
${msg_out_path}/micrortps_client/microRTPS_transport.cpp
${micrortps_bridge_path}/micrortps_client/microRTPS_client.cpp
${micrortps_bridge_path}/micrortps_client/microRTPS_transport.cpp
MODULE_CONFIG
module.yaml
DEPENDS