diff --git a/cmake/gencpp-extras.cmake.em b/cmake/gencpp-extras.cmake.em index 78025b9..cfe8191 100644 --- a/cmake/gencpp-extras.cmake.em +++ b/cmake/gencpp-extras.cmake.em @@ -10,7 +10,7 @@ set(GENCPP_TEMPLATE_DIR "${gencpp_DIR}/..") # Generate .msg->.h for cpp # The generated .h files should be added ALL_GEN_OUTPUT_FILES_cpp -macro(_generate_msg_cpp ARG_PKG ARG_MSG ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_DIR) +macro(_generate_msg_cpp ARG_PKG ARG_MSG ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_DIR ARG_IS_DEPRECATED) file(MAKE_DIRECTORY ${ARG_GEN_OUTPUT_DIR}) #Create input and output filenames @@ -35,6 +35,10 @@ macro(_generate_msg_cpp ARG_PKG ARG_MSG ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_D set(MSG_PLUGIN) endif() + if(${ARG_IS_DEPRECATED}) + set(COMMAND_DEPRECATED_FLAG "-d") + endif() + assert(CATKIN_ENV) add_custom_command(OUTPUT ${GEN_OUTPUT_FILE} DEPENDS ${GENCPP_BIN} ${ARG_MSG} ${ARG_MSG_DEPS} ${MSG_PLUGIN} "${GENCPP_TEMPLATE_DIR}/msg.h.template" ${ARGN} @@ -43,6 +47,7 @@ macro(_generate_msg_cpp ARG_PKG ARG_MSG ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_D -p ${ARG_PKG} -o ${ARG_GEN_OUTPUT_DIR} -e ${GENCPP_TEMPLATE_DIR} + ${COMMAND_DEPRECATED_FLAG} COMMENT "Generating C++ code from ${ARG_PKG}/${MSG_NAME}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) @@ -53,8 +58,8 @@ macro(_generate_msg_cpp ARG_PKG ARG_MSG ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_D endmacro() #gencpp uses the same program to generate srv and msg files, so call the same macro -macro(_generate_srv_cpp ARG_PKG ARG_SRV ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_DIR) - _generate_msg_cpp(${ARG_PKG} ${ARG_SRV} "${ARG_IFLAGS}" "${ARG_MSG_DEPS}" ${ARG_GEN_OUTPUT_DIR} "${GENCPP_TEMPLATE_DIR}/srv.h.template") +macro(_generate_srv_cpp ARG_PKG ARG_SRV ARG_IFLAGS ARG_MSG_DEPS ARG_GEN_OUTPUT_DIR ARG_IS_DEPRECATED) + _generate_msg_cpp(${ARG_PKG} ${ARG_SRV} "${ARG_IFLAGS}" "${ARG_MSG_DEPS}" ${ARG_GEN_OUTPUT_DIR} ${ARG_IS_DEPRECATED} "${GENCPP_TEMPLATE_DIR}/srv.h.template") endmacro() macro(_generate_module_cpp) diff --git a/scripts/msg.h.template b/scripts/msg.h.template index 7be03f2..9024918 100644 --- a/scripts/msg.h.template +++ b/scripts/msg.h.template @@ -11,6 +11,7 @@ @# - file_name_in (String) Source file @# - spec (msggen.MsgSpec) Parsed specification of the .msg file @# - md5sum (String) MD5Sum of the .msg specification +@# - is_deprecated (Boolean) Flag for deprecated message @############################################### // Generated by gencpp from file @(spec.package)/@(spec.short_name).msg // DO NOT EDIT! @@ -64,6 +65,13 @@ for field in spec.parsed_fields(): #include <@(spec.package)/plugin/@(spec.short_name).h> @[end if]@ +@############################## +@# Deprecation Warning +@############################## +@[if is_deprecated]@ +#warning "ROS message @(spec.package)/@(spec.short_name).msg is deprecated. Please stop using it." +@[end if]@ + namespace @(spec.package) { template diff --git a/scripts/srv.h.template b/scripts/srv.h.template index d79a1c5..3ea7abe 100644 --- a/scripts/srv.h.template +++ b/scripts/srv.h.template @@ -11,6 +11,7 @@ @# - file_name_in (String) Source .srv file @# - spec (msggen.SrvSpec) Parsed specification of the .srv file @# - md5sum (String) MD5Sum of the .srv specification +@# - is_deprecated (Boolean) Flag for deprecated service @############################################### // Generated by gencpp from file @(spec.package)/@(spec.short_name).msg // DO NOT EDIT! @@ -33,6 +34,13 @@ cpp_full_name = cpp_namespace+cpp_class #include <@(spec.package)/@(spec.short_name)Request.h> #include <@(spec.package)/@(spec.short_name)Response.h> +@############################## +@# Deprecation Warning +@############################## +@[if is_deprecated]@ +#warning "ROS service @(spec.package)/@(spec.short_name).srv is deprecated. Please stop using it." +@[end if]@ + @############################################### @# Service Struct @###############################################