From 16f53ec18d9ae8ab721d7f61968ba996fce60dc0 Mon Sep 17 00:00:00 2001 From: TSC21 Date: Fri, 22 Nov 2019 12:48:09 +0000 Subject: [PATCH] msg: add a deprecated uORB msgs list to CMake --- msg/CMakeLists.txt | 29 +++++++++++++++++++++++++++- msg/tools/uorb_rtps_message_ids.yaml | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/msg/CMakeLists.txt b/msg/CMakeLists.txt index 7404cf5e71..43cff31fc5 100644 --- a/msg/CMakeLists.txt +++ b/msg/CMakeLists.txt @@ -31,6 +31,9 @@ # ############################################################################ +# Support IN_LIST if() operator +cmake_policy(SET CMP0057 NEW) + set(msg_files actuator_armed.msg actuator_controls.msg @@ -52,7 +55,7 @@ set(msg_files debug_vect.msg differential_pressure.msg distance_sensor.msg - ekf2_innovations.msg + ekf2_innovations.msg # TODO: remove as soon as https://github.com/PX4/Firmware/pull/13127 is rebased over this ekf2_timestamps.msg ekf_gps_drift.msg ekf_gps_position.msg @@ -151,6 +154,30 @@ set(msg_files wind_estimate.msg ) +set(deprecated_msgs + # TODO: uncomment as soon as https://github.com/PX4/Firmware/pull/13127 is rebased over this + # ekf2_innovations.msg # 2019-11-22, Updated estimator interface and logging; replaced by 'estimator_innovations'. + ) + +foreach(msg IN LISTS deprecated_msgs) + if(msg IN_LIST msg_files) + get_filename_component(msg_we ${msg} NAME_WE) + list(APPEND invalid_msgs ${msg_we}) + endif() +endforeach() +if(invalid_msgs) + list(LENGTH invalid_msgs invalid_msgs_size) + if(${invalid_msgs_size} GREATER 1) + foreach(msg IN LISTS invalid_msgs) + string(CONCAT invalid_msgs_cs ${invalid_msgs_cs} "'${msg}', ") + endforeach() + STRING(REGEX REPLACE ", +$" "" invalid_msgs_cs ${invalid_msgs_cs}) + message(FATAL_ERROR "${invalid_msgs_cs} are listed as deprecated. Please use different names for the messages.") + else() + message(FATAL_ERROR "'${invalid_msgs}' is listed as deprecated. Please use a different name for the message.") + endif() +endif() + if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "") # Check that the msg directory and the CMakeLists.txt file exists if(EXISTS ${EXTERNAL_MODULES_LOCATION}/msg/CMakeLists.txt) diff --git a/msg/tools/uorb_rtps_message_ids.yaml b/msg/tools/uorb_rtps_message_ids.yaml index dd5148e4fe..91164ca810 100644 --- a/msg/tools/uorb_rtps_message_ids.yaml +++ b/msg/tools/uorb_rtps_message_ids.yaml @@ -45,6 +45,7 @@ rtps: - msg: distance_sensor id: 17 send: true + # TODO: replace with 'estimator_innovations' as https://github.com/PX4/Firmware/pull/13127 is rebased over this - msg: ekf2_innovations id: 18 - msg: ekf2_timestamps