From 01abf6dace7d1ed68301bda3dd5f8b393c86aa5f Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 27 Jan 2011 10:06:43 +0100 Subject: [PATCH 2/3] typekit: compile with default visibility=hidden This drastically reduces code size and symbol size and causes much faster loads in a running application. Signed-off-by: Peter Soetens --- rtt_ros_integration/cmake/GenerateRTTtypekit.cmake | 2 ++ rtt_ros_integration/src/msg_Types.hpp.in | 4 +++- .../src/ros_msg_typekit_plugin.cpp.in | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletions(-) diff --git a/rtt_ros_integration/cmake/GenerateRTTtypekit.cmake b/rtt_ros_integration/cmake/GenerateRTTtypekit.cmake index 3491f07..d3ec5c7 100644 --- a/rtt_ros_integration/cmake/GenerateRTTtypekit.cmake +++ b/rtt_ros_integration/cmake/GenerateRTTtypekit.cmake @@ -94,6 +94,8 @@ macro(ros_generate_rtt_typekit package) orocos_typekit( rtt-ros-${package}-typekit ${CMAKE_CURRENT_SOURCE_DIR}/src/orocos/types/ros_${package}_typekit.cpp ${ROSMSG_TYPEKIT_PLUGINS}) orocos_typekit( rtt-ros-${package}-transport ${CMAKE_CURRENT_SOURCE_DIR}/src/orocos/types/ros_${package}_transport.cpp ) target_link_libraries(rtt-ros-${package}-transport rtt_ros_integration-${OROCOS_TARGET}) + set_target_properties( rtt-ros-${package}-typekit PROPERTIES COMPILE_FLAGS "-fvisibility=hidden" ) + set_target_properties( rtt-ros-${package}-transport PROPERTIES COMPILE_FLAGS "-fvisibility=hidden" ) endmacro(ros_generate_rtt_typekit) diff --git a/rtt_ros_integration/src/msg_Types.hpp.in b/rtt_ros_integration/src/msg_Types.hpp.in index 3b22016..700e69c 100644 --- a/rtt_ros_integration/src/msg_Types.hpp.in +++ b/rtt_ros_integration/src/msg_Types.hpp.in @@ -8,8 +8,10 @@ // All these classes were generated in the typekit library: #ifdef CORELIB_DATASOURCE_HPP + extern template class RTT::internal::DataSourceTypeInfo< @ROSMSGTYPE@ >; extern template class RTT::internal::DataSource< @ROSMSGTYPE@ >; extern template class RTT::internal::AssignableDataSource< @ROSMSGTYPE@ >; + extern template class RTT::internal::AssignCommand< @ROSMSGTYPE@ >; #endif #ifdef ORO_CORELIB_DATASOURCES_HPP extern template class RTT::internal::ValueDataSource< @ROSMSGTYPE@ >; @@ -27,7 +29,7 @@ #endif #ifdef ORO_CORELIB_ATTRIBUTE_HPP extern template class RTT::Attribute< @ROSMSGTYPE@ >; - extern template class RTT::Constant< @ROSMSGTYPE@ >; + // Todo: add Constant once RTT 2.3 is released. #endif diff --git a/rtt_ros_integration/src/ros_msg_typekit_plugin.cpp.in b/rtt_ros_integration/src/ros_msg_typekit_plugin.cpp.in index e85d140..15dca7f 100644 --- a/rtt_ros_integration/src/ros_msg_typekit_plugin.cpp.in +++ b/rtt_ros_integration/src/ros_msg_typekit_plugin.cpp.in @@ -4,6 +4,21 @@ #include #include +// Note: we need to put these up-front or we get gcc compiler warnings: +// <> +template class RTT_EXPORT RTT::internal::DataSourceTypeInfo< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::internal::DataSource< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::internal::AssignableDataSource< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::internal::AssignCommand< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::internal::ValueDataSource< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::internal::ConstantDataSource< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::internal::ReferenceDataSource< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::OutputPort< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::InputPort< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::Property< @ROSMSGTYPE@ >; +template class RTT_EXPORT RTT::Attribute< @ROSMSGTYPE@ >; +// Todo: add Constant once RTT 2.3 is released. + namespace ros_integration { using namespace RTT; // Factory function -- 1.7.0.4