From f92cc213316d439f90da6a74b32ec667b7dc8043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Fri, 26 Jul 2024 14:10:26 +0200 Subject: [PATCH] Remove visibility macros (#539) * Remove visibility macros * Remove dead target_compile_definitions --- example_1/CMakeLists.txt | 8 +-- .../ros2_control_demo_example_1/rrbot.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_10/CMakeLists.txt | 8 +-- .../gpio_controller.hpp | 8 --- .../ros2_control_demo_example_10/rrbot.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_11/CMakeLists.txt | 8 +-- .../carlikebot_system.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_12/CMakeLists.txt | 11 +--- .../passthrough_controller.hpp | 10 ---- .../visibility_control.h | 49 ---------------- .../ros2_control_demo_example_12/rrbot.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_14/CMakeLists.txt | 8 +-- .../rrbot_actuator_without_feedback.hpp | 9 --- .../rrbot_sensor_for_position_feedback.hpp | 8 --- .../visibility_control.h | 56 ------------------- example_2/CMakeLists.txt | 8 +-- .../diffbot_system.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_3/CMakeLists.txt | 8 +-- .../rrbot_system_multi_interface.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_4/CMakeLists.txt | 8 +-- .../rrbot_system_with_sensor.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_5/CMakeLists.txt | 8 +-- .../external_rrbot_force_torque_sensor.hpp | 6 -- .../ros2_control_demo_example_5/rrbot.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_6/CMakeLists.txt | 8 +-- .../rrbot_actuator.hpp | 8 --- .../visibility_control.h | 56 ------------------- example_7/CMakeLists.txt | 8 +-- example_8/CMakeLists.txt | 8 +-- .../ros2_control_demo_example_8/rrbot.hpp | 9 --- ...bot_transmissions_system_position_only.hpp | 9 --- .../visibility_control.h | 56 ------------------- example_9/CMakeLists.txt | 8 +-- .../ros2_control_demo_example_9/rrbot.hpp | 9 --- .../visibility_control.h | 56 ------------------- 43 files changed, 39 insertions(+), 937 deletions(-) delete mode 100644 example_1/hardware/include/ros2_control_demo_example_1/visibility_control.h delete mode 100644 example_10/hardware/include/ros2_control_demo_example_10/visibility_control.h delete mode 100644 example_11/hardware/include/ros2_control_demo_example_11/visibility_control.h delete mode 100644 example_12/controllers/include/passthrough_controller/visibility_control.h delete mode 100644 example_12/hardware/include/ros2_control_demo_example_12/visibility_control.h delete mode 100644 example_14/hardware/include/ros2_control_demo_example_14/visibility_control.h delete mode 100644 example_2/hardware/include/ros2_control_demo_example_2/visibility_control.h delete mode 100644 example_3/hardware/include/ros2_control_demo_example_3/visibility_control.h delete mode 100644 example_4/hardware/include/ros2_control_demo_example_4/visibility_control.h delete mode 100644 example_5/hardware/include/ros2_control_demo_example_5/visibility_control.h delete mode 100644 example_6/hardware/include/ros2_control_demo_example_6/visibility_control.h delete mode 100644 example_8/hardware/include/ros2_control_demo_example_8/visibility_control.h delete mode 100644 example_9/hardware/include/ros2_control_demo_example_9/visibility_control.h diff --git a/example_1/CMakeLists.txt b/example_1/CMakeLists.txt index 12496b88c..c322e118d 100644 --- a/example_1/CMakeLists.txt +++ b/example_1/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_1 @@ -36,10 +38,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_1_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_1.xml) diff --git a/example_1/hardware/include/ros2_control_demo_example_1/rrbot.hpp b/example_1/hardware/include/ros2_control_demo_example_1/rrbot.hpp index 46881e85a..b55a821a6 100644 --- a/example_1/hardware/include/ros2_control_demo_example_1/rrbot.hpp +++ b/example_1/hardware/include/ros2_control_demo_example_1/rrbot.hpp @@ -26,7 +26,6 @@ #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_1/visibility_control.h" namespace ros2_control_demo_example_1 { @@ -35,33 +34,25 @@ class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterfa public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemPositionOnlyHardware); - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_1/hardware/include/ros2_control_demo_example_1/visibility_control.h b/example_1/hardware/include/ros2_control_demo_example_1/visibility_control.h deleted file mode 100644 index 91529ae90..000000000 --- a/example_1/hardware/include/ros2_control_demo_example_1/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_1__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_1__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_1_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_1_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_1_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_1_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_1_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_1_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_1_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_1_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_1_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_1_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_1_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_1_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_1__VISIBILITY_CONTROL_H_ diff --git a/example_10/CMakeLists.txt b/example_10/CMakeLists.txt index 1b9079345..35c1319a9 100644 --- a/example_10/CMakeLists.txt +++ b/example_10/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -22,7 +25,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_10 @@ -41,10 +43,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_10_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_10.xml) # Export controllers diff --git a/example_10/controllers/include/ros2_control_demo_example_10/gpio_controller.hpp b/example_10/controllers/include/ros2_control_demo_example_10/gpio_controller.hpp index cf582bc21..6a1db0249 100644 --- a/example_10/controllers/include/ros2_control_demo_example_10/gpio_controller.hpp +++ b/example_10/controllers/include/ros2_control_demo_example_10/gpio_controller.hpp @@ -20,7 +20,6 @@ #include #include "control_msgs/msg/interface_value.hpp" -#include "ros2_control_demo_example_10/visibility_control.h" #include "std_msgs/msg/float64_multi_array.hpp" #include "controller_interface/controller_interface.hpp" @@ -34,26 +33,19 @@ class GPIOController : public controller_interface::ControllerInterface public: RCLCPP_SHARED_PTR_DEFINITIONS(GPIOController); - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC controller_interface::InterfaceConfiguration command_interface_configuration() const override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC controller_interface::InterfaceConfiguration state_interface_configuration() const override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC controller_interface::return_type update( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC CallbackReturn on_configure(const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC CallbackReturn on_init() override; private: diff --git a/example_10/hardware/include/ros2_control_demo_example_10/rrbot.hpp b/example_10/hardware/include/ros2_control_demo_example_10/rrbot.hpp index 9f6b2c62f..11bc5e1eb 100644 --- a/example_10/hardware/include/ros2_control_demo_example_10/rrbot.hpp +++ b/example_10/hardware/include/ros2_control_demo_example_10/rrbot.hpp @@ -26,7 +26,6 @@ #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_10/visibility_control.h" namespace ros2_control_demo_example_10 { @@ -35,33 +34,25 @@ class RRBotSystemWithGPIOHardware : public hardware_interface::SystemInterface public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemWithGPIOHardware); - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_10/hardware/include/ros2_control_demo_example_10/visibility_control.h b/example_10/hardware/include/ros2_control_demo_example_10/visibility_control.h deleted file mode 100644 index 5fbd35996..000000000 --- a/example_10/hardware/include/ros2_control_demo_example_10/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_10__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_10__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_10_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_10_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_10_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_10_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_10_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_10_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_10_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_10_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_10_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_10_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_10_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_10_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_10__VISIBILITY_CONTROL_H_ diff --git a/example_11/CMakeLists.txt b/example_11/CMakeLists.txt index f21b01f6c..83fbf11be 100644 --- a/example_11/CMakeLists.txt +++ b/example_11/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_11 @@ -36,10 +38,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_11_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_11.xml) diff --git a/example_11/hardware/include/ros2_control_demo_example_11/carlikebot_system.hpp b/example_11/hardware/include/ros2_control_demo_example_11/carlikebot_system.hpp index 0043699bd..44ab8a1f5 100644 --- a/example_11/hardware/include/ros2_control_demo_example_11/carlikebot_system.hpp +++ b/example_11/hardware/include/ros2_control_demo_example_11/carlikebot_system.hpp @@ -32,8 +32,6 @@ #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_11/visibility_control.h" - namespace ros2_control_demo_example_11 { struct JointValue @@ -62,29 +60,22 @@ class CarlikeBotSystemHardware : public hardware_interface::SystemInterface public: RCLCPP_SHARED_PTR_DEFINITIONS(CarlikeBotSystemHardware); - ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_11/hardware/include/ros2_control_demo_example_11/visibility_control.h b/example_11/hardware/include/ros2_control_demo_example_11/visibility_control.h deleted file mode 100644 index dff3344de..000000000 --- a/example_11/hardware/include/ros2_control_demo_example_11/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_11__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_11__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_11_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_11_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_11_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_11_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_11_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_11_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_11_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_11_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_11_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_11_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_11_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_11_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_11__VISIBILITY_CONTROL_H_ diff --git a/example_12/CMakeLists.txt b/example_12/CMakeLists.txt index e0554a576..7652449a9 100644 --- a/example_12/CMakeLists.txt +++ b/example_12/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -41,10 +44,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_9_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_12.xml) @@ -63,10 +62,6 @@ $ target_link_libraries(passthrough_controller PUBLIC passthrough_controller_parameters) ament_target_dependencies(passthrough_controller PUBLIC ${THIS_PACKAGE_INCLUDE_DEPENDS}) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(passthrough_controller PRIVATE "passthrough_controller_BUILDING_DLL") - pluginlib_export_plugin_description_file(controller_interface passthrough_controller.xml) diff --git a/example_12/controllers/include/passthrough_controller/passthrough_controller.hpp b/example_12/controllers/include/passthrough_controller/passthrough_controller.hpp index 08ec81496..3fdb3ffa3 100644 --- a/example_12/controllers/include/passthrough_controller/passthrough_controller.hpp +++ b/example_12/controllers/include/passthrough_controller/passthrough_controller.hpp @@ -27,8 +27,6 @@ // auto-generated by generate_parameter_library #include "passthrough_controller_parameters.hpp" -#include "passthrough_controller/visibility_control.h" - /** * PassthroughController is a simple chainable controller that exposes reference interfaces equal to * the number of it's command interfaces. This controller simply forwards the information commanded @@ -40,31 +38,23 @@ using DataType = std_msgs::msg::Float64MultiArray; class PassthroughController : public controller_interface::ChainableControllerInterface { public: - PASSTHROUGH_CONTROLLER_PUBLIC controller_interface::CallbackReturn on_init() override; - PASSTHROUGH_CONTROLLER_PUBLIC controller_interface::InterfaceConfiguration command_interface_configuration() const override; - PASSTHROUGH_CONTROLLER_PUBLIC controller_interface::InterfaceConfiguration state_interface_configuration() const override; - PASSTHROUGH_CONTROLLER_PUBLIC controller_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - PASSTHROUGH_CONTROLLER_PUBLIC controller_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - PASSTHROUGH_CONTROLLER_PUBLIC controller_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - PASSTHROUGH_CONTROLLER_PUBLIC bool on_set_chained_mode(bool chained_mode) override; - PASSTHROUGH_CONTROLLER_PUBLIC controller_interface::return_type update_and_write_commands( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_12/controllers/include/passthrough_controller/visibility_control.h b/example_12/controllers/include/passthrough_controller/visibility_control.h deleted file mode 100644 index 84888056d..000000000 --- a/example_12/controllers/include/passthrough_controller/visibility_control.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2023, PAL Robotics -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef PASSTHROUGH_CONTROLLER__VISIBILITY_CONTROL_H_ -#define PASSTHROUGH_CONTROLLER__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define PASSTHROUGH_CONTROLLER_EXPORT __attribute__((dllexport)) -#define PASSTHROUGH_CONTROLLER_IMPORT __attribute__((dllimport)) -#else -#define PASSTHROUGH_CONTROLLER_EXPORT __declspec(dllexport) -#define PASSTHROUGH_CONTROLLER_IMPORT __declspec(dllimport) -#endif -#ifdef PASSTHROUGH_CONTROLLER_BUILDING_DLL -#define PASSTHROUGH_CONTROLLER_PUBLIC PASSTHROUGH_CONTROLLER_EXPORT -#else -#define PASSTHROUGH_CONTROLLER_PUBLIC PASSTHROUGH_CONTROLLER_IMPORT -#endif -#define PASSTHROUGH_CONTROLLER_PUBLIC_TYPE PASSTHROUGH_CONTROLLER_PUBLIC -#define PASSTHROUGH_CONTROLLER_LOCAL -#else -#define PASSTHROUGH_CONTROLLER_EXPORT __attribute__((visibility("default"))) -#define PASSTHROUGH_CONTROLLER_IMPORT -#if __GNUC__ >= 4 -#define PASSTHROUGH_CONTROLLER_PUBLIC __attribute__((visibility("default"))) -#define PASSTHROUGH_CONTROLLER_LOCAL __attribute__((visibility("hidden"))) -#else -#define PASSTHROUGH_CONTROLLER_PUBLIC -#define PASSTHROUGH_CONTROLLER_LOCAL -#endif -#define PASSTHROUGH_CONTROLLER_PUBLIC_TYPE -#endif - -#endif // PASSTHROUGH_CONTROLLER__VISIBILITY_CONTROL_H_ diff --git a/example_12/hardware/include/ros2_control_demo_example_12/rrbot.hpp b/example_12/hardware/include/ros2_control_demo_example_12/rrbot.hpp index 561368798..ac116044e 100644 --- a/example_12/hardware/include/ros2_control_demo_example_12/rrbot.hpp +++ b/example_12/hardware/include/ros2_control_demo_example_12/rrbot.hpp @@ -26,7 +26,6 @@ #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_12/visibility_control.h" namespace ros2_control_demo_example_12 { @@ -35,33 +34,25 @@ class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterfa public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemPositionOnlyHardware); - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_12/hardware/include/ros2_control_demo_example_12/visibility_control.h b/example_12/hardware/include/ros2_control_demo_example_12/visibility_control.h deleted file mode 100644 index e4ad914e0..000000000 --- a/example_12/hardware/include/ros2_control_demo_example_12/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_12__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_12__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_12_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_12_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_12_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_12_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_12_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_12_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_12_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_12_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_12_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_12_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_12_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_12_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_12_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_12__VISIBILITY_CONTROL_H_ diff --git a/example_14/CMakeLists.txt b/example_14/CMakeLists.txt index 3b7e7b153..eca9253e9 100644 --- a/example_14/CMakeLists.txt +++ b/example_14/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -20,7 +23,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_14 @@ -38,10 +40,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_14_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_14.xml) diff --git a/example_14/hardware/include/ros2_control_demo_example_14/rrbot_actuator_without_feedback.hpp b/example_14/hardware/include/ros2_control_demo_example_14/rrbot_actuator_without_feedback.hpp index 775d4d592..7a2f99609 100644 --- a/example_14/hardware/include/ros2_control_demo_example_14/rrbot_actuator_without_feedback.hpp +++ b/example_14/hardware/include/ros2_control_demo_example_14/rrbot_actuator_without_feedback.hpp @@ -31,7 +31,6 @@ #include "hardware_interface/system_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "rclcpp/macros.hpp" -#include "ros2_control_demo_example_14/visibility_control.h" namespace ros2_control_demo_example_14 { @@ -40,33 +39,25 @@ class RRBotActuatorWithoutFeedback : public hardware_interface::ActuatorInterfac public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotActuatorWithoutFeedback); - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_shutdown( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_14/hardware/include/ros2_control_demo_example_14/rrbot_sensor_for_position_feedback.hpp b/example_14/hardware/include/ros2_control_demo_example_14/rrbot_sensor_for_position_feedback.hpp index 20e9a51e9..8816f7a9b 100644 --- a/example_14/hardware/include/ros2_control_demo_example_14/rrbot_sensor_for_position_feedback.hpp +++ b/example_14/hardware/include/ros2_control_demo_example_14/rrbot_sensor_for_position_feedback.hpp @@ -35,7 +35,6 @@ #include "rclcpp/macros.hpp" #include "rclcpp/time.hpp" #include "realtime_tools/realtime_buffer.h" -#include "ros2_control_demo_example_14/visibility_control.h" namespace ros2_control_demo_example_14 { @@ -44,30 +43,23 @@ class RRBotSensorPositionFeedback : public hardware_interface::SensorInterface public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSensorPositionFeedback); - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::CallbackReturn on_shutdown( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_14/hardware/include/ros2_control_demo_example_14/visibility_control.h b/example_14/hardware/include/ros2_control_demo_example_14/visibility_control.h deleted file mode 100644 index d722ed528..000000000 --- a/example_14/hardware/include/ros2_control_demo_example_14/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_14__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_14__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_14_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_14_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_14_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_14_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_14_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_14_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_14_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_14_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_14_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_14_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_14_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_14_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_14_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_14__VISIBILITY_CONTROL_H_ diff --git a/example_2/CMakeLists.txt b/example_2/CMakeLists.txt index cd19457e6..01150f422 100644 --- a/example_2/CMakeLists.txt +++ b/example_2/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_2 @@ -36,10 +38,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_2_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_2.xml) diff --git a/example_2/hardware/include/ros2_control_demo_example_2/diffbot_system.hpp b/example_2/hardware/include/ros2_control_demo_example_2/diffbot_system.hpp index 13490e5e0..1e383abd9 100644 --- a/example_2/hardware/include/ros2_control_demo_example_2/diffbot_system.hpp +++ b/example_2/hardware/include/ros2_control_demo_example_2/diffbot_system.hpp @@ -30,8 +30,6 @@ #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_2/visibility_control.h" - namespace ros2_control_demo_example_2 { class DiffBotSystemHardware : public hardware_interface::SystemInterface @@ -39,29 +37,22 @@ class DiffBotSystemHardware : public hardware_interface::SystemInterface public: RCLCPP_SHARED_PTR_DEFINITIONS(DiffBotSystemHardware); - ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_2/hardware/include/ros2_control_demo_example_2/visibility_control.h b/example_2/hardware/include/ros2_control_demo_example_2/visibility_control.h deleted file mode 100644 index 568aa9017..000000000 --- a/example_2/hardware/include/ros2_control_demo_example_2/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_2__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_2__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_2_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_2_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_2_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_2_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_2_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_2_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_2_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_2_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_2_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_2_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_2_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_2_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_2_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_2__VISIBILITY_CONTROL_H_ diff --git a/example_3/CMakeLists.txt b/example_3/CMakeLists.txt index a48a3121f..cf5470c6e 100644 --- a/example_3/CMakeLists.txt +++ b/example_3/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_3 @@ -36,10 +38,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_3_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_3.xml) diff --git a/example_3/hardware/include/ros2_control_demo_example_3/rrbot_system_multi_interface.hpp b/example_3/hardware/include/ros2_control_demo_example_3/rrbot_system_multi_interface.hpp index 578b07eab..7469de7c0 100644 --- a/example_3/hardware/include/ros2_control_demo_example_3/rrbot_system_multi_interface.hpp +++ b/example_3/hardware/include/ros2_control_demo_example_3/rrbot_system_multi_interface.hpp @@ -31,7 +31,6 @@ #include "rclcpp/time.hpp" #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_3/visibility_control.h" namespace ros2_control_demo_example_3 { @@ -40,34 +39,26 @@ class RRBotSystemMultiInterfaceHardware : public hardware_interface::SystemInter public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemMultiInterfaceHardware); - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC hardware_interface::return_type prepare_command_mode_switch( const std::vector & start_interfaces, const std::vector & stop_interfaces) override; - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_3/hardware/include/ros2_control_demo_example_3/visibility_control.h b/example_3/hardware/include/ros2_control_demo_example_3/visibility_control.h deleted file mode 100644 index 5d0d20a8f..000000000 --- a/example_3/hardware/include/ros2_control_demo_example_3/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_3__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_3__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_3_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_3_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_3_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_3_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_3_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_3_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_3_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_3_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_3_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_3_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_3_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_3_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_3_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_3__VISIBILITY_CONTROL_H_ diff --git a/example_4/CMakeLists.txt b/example_4/CMakeLists.txt index b79f1e706..a56654e0e 100644 --- a/example_4/CMakeLists.txt +++ b/example_4/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_4 @@ -36,10 +38,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_4_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_4.xml) diff --git a/example_4/hardware/include/ros2_control_demo_example_4/rrbot_system_with_sensor.hpp b/example_4/hardware/include/ros2_control_demo_example_4/rrbot_system_with_sensor.hpp index de6b1f3d1..e166c9906 100644 --- a/example_4/hardware/include/ros2_control_demo_example_4/rrbot_system_with_sensor.hpp +++ b/example_4/hardware/include/ros2_control_demo_example_4/rrbot_system_with_sensor.hpp @@ -29,7 +29,6 @@ #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_4/visibility_control.h" namespace ros2_control_demo_example_4 { @@ -38,33 +37,25 @@ class RRBotSystemWithSensorHardware : public hardware_interface::SystemInterface public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemWithSensorHardware); - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_4/hardware/include/ros2_control_demo_example_4/visibility_control.h b/example_4/hardware/include/ros2_control_demo_example_4/visibility_control.h deleted file mode 100644 index 892873fa8..000000000 --- a/example_4/hardware/include/ros2_control_demo_example_4/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_4__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_4__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_4_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_4_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_4_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_4_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_4_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_4_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_4_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_4_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_4_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_4_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_4_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_4_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_4_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_4__VISIBILITY_CONTROL_H_ diff --git a/example_5/CMakeLists.txt b/example_5/CMakeLists.txt index 1eaa37ebd..c4ee34da2 100644 --- a/example_5/CMakeLists.txt +++ b/example_5/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_5 @@ -37,10 +39,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_5_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_5.xml) diff --git a/example_5/hardware/include/ros2_control_demo_example_5/external_rrbot_force_torque_sensor.hpp b/example_5/hardware/include/ros2_control_demo_example_5/external_rrbot_force_torque_sensor.hpp index 97dd8a4fb..3f0a3a941 100644 --- a/example_5/hardware/include/ros2_control_demo_example_5/external_rrbot_force_torque_sensor.hpp +++ b/example_5/hardware/include/ros2_control_demo_example_5/external_rrbot_force_torque_sensor.hpp @@ -28,7 +28,6 @@ #include "hardware_interface/sensor_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "rclcpp/macros.hpp" -#include "ros2_control_demo_example_5/visibility_control.h" namespace ros2_control_demo_example_5 { @@ -37,22 +36,17 @@ class ExternalRRBotForceTorqueSensorHardware : public hardware_interface::Sensor public: RCLCPP_SHARED_PTR_DEFINITIONS(ExternalRRBotForceTorqueSensorHardware); - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_5/hardware/include/ros2_control_demo_example_5/rrbot.hpp b/example_5/hardware/include/ros2_control_demo_example_5/rrbot.hpp index c3d053464..3fdac8de1 100644 --- a/example_5/hardware/include/ros2_control_demo_example_5/rrbot.hpp +++ b/example_5/hardware/include/ros2_control_demo_example_5/rrbot.hpp @@ -26,7 +26,6 @@ #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_5/visibility_control.h" namespace ros2_control_demo_example_5 { @@ -35,33 +34,25 @@ class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterfa public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemPositionOnlyHardware); - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_5/hardware/include/ros2_control_demo_example_5/visibility_control.h b/example_5/hardware/include/ros2_control_demo_example_5/visibility_control.h deleted file mode 100644 index 6be422ad1..000000000 --- a/example_5/hardware/include/ros2_control_demo_example_5/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_5__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_5__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_5_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_5_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_5_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_5_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_5_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_5_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_5_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_5_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_5_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_5_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_5_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_5_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_5_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_5__VISIBILITY_CONTROL_H_ diff --git a/example_6/CMakeLists.txt b/example_6/CMakeLists.txt index 3ac52862d..612a1c65c 100644 --- a/example_6/CMakeLists.txt +++ b/example_6/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_6 @@ -36,10 +38,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_6_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_6.xml) diff --git a/example_6/hardware/include/ros2_control_demo_example_6/rrbot_actuator.hpp b/example_6/hardware/include/ros2_control_demo_example_6/rrbot_actuator.hpp index 0ceaabaa1..4874bd47d 100644 --- a/example_6/hardware/include/ros2_control_demo_example_6/rrbot_actuator.hpp +++ b/example_6/hardware/include/ros2_control_demo_example_6/rrbot_actuator.hpp @@ -29,7 +29,6 @@ #include "hardware_interface/system_interface.hpp" #include "hardware_interface/types/hardware_interface_return_values.hpp" #include "rclcpp/macros.hpp" -#include "ros2_control_demo_example_6/visibility_control.h" namespace ros2_control_demo_example_6 { @@ -38,29 +37,22 @@ class RRBotModularJoint : public hardware_interface::ActuatorInterface public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotModularJoint); - ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_6/hardware/include/ros2_control_demo_example_6/visibility_control.h b/example_6/hardware/include/ros2_control_demo_example_6/visibility_control.h deleted file mode 100644 index c15cf90ee..000000000 --- a/example_6/hardware/include/ros2_control_demo_example_6/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_6__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_6__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_6_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_6_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_6_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_6_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_6_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_6_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_6_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_6_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_6_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_6_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_6_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_6_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_6_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_6__VISIBILITY_CONTROL_H_ diff --git a/example_7/CMakeLists.txt b/example_7/CMakeLists.txt index 16231d836..b3871b98a 100644 --- a/example_7/CMakeLists.txt +++ b/example_7/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(HW_IF_INCLUDE_DEPENDS pluginlib @@ -36,7 +39,6 @@ foreach(Dependency IN ITEMS ${CONTROLLER_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_executable(send_trajectory reference_generator/send_trajectory.cpp) @@ -64,10 +66,6 @@ ament_target_dependencies( ${CONTROLLER_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_7_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_7.xml) # Export controller plugins diff --git a/example_8/CMakeLists.txt b/example_8/CMakeLists.txt index 3b7688b9d..4f19d5492 100644 --- a/example_8/CMakeLists.txt +++ b/example_8/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -20,7 +23,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_8 @@ -37,10 +39,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_8_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_8.xml) diff --git a/example_8/hardware/include/ros2_control_demo_example_8/rrbot.hpp b/example_8/hardware/include/ros2_control_demo_example_8/rrbot.hpp index ac5eeb0c1..5c96b9bc7 100644 --- a/example_8/hardware/include/ros2_control_demo_example_8/rrbot.hpp +++ b/example_8/hardware/include/ros2_control_demo_example_8/rrbot.hpp @@ -26,7 +26,6 @@ #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_8/visibility_control.h" namespace ros2_control_demo_example_8 { @@ -35,33 +34,25 @@ class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterfa public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemPositionOnlyHardware); - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_8/hardware/include/ros2_control_demo_example_8/rrbot_transmissions_system_position_only.hpp b/example_8/hardware/include/ros2_control_demo_example_8/rrbot_transmissions_system_position_only.hpp index c873a2815..453e2a146 100644 --- a/example_8/hardware/include/ros2_control_demo_example_8/rrbot_transmissions_system_position_only.hpp +++ b/example_8/hardware/include/ros2_control_demo_example_8/rrbot_transmissions_system_position_only.hpp @@ -28,7 +28,6 @@ #include "rclcpp/logger.hpp" #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_8/visibility_control.h" #include "transmission_interface/transmission.hpp" namespace ros2_control_demo_example_8 @@ -36,33 +35,25 @@ namespace ros2_control_demo_example_8 class RRBotTransmissionsSystemPositionOnlyHardware : public hardware_interface::SystemInterface { public: - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_8/hardware/include/ros2_control_demo_example_8/visibility_control.h b/example_8/hardware/include/ros2_control_demo_example_8/visibility_control.h deleted file mode 100644 index 5c71380b4..000000000 --- a/example_8/hardware/include/ros2_control_demo_example_8/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_8__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_8__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_8_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_8_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_8_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_8_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_8_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_8_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_8_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_8_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_8_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_8_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_8_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_8_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_8_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_8__VISIBILITY_CONTROL_H_ diff --git a/example_9/CMakeLists.txt b/example_9/CMakeLists.txt index 1c6980484..5f84de236 100644 --- a/example_9/CMakeLists.txt +++ b/example_9/CMakeLists.txt @@ -5,6 +5,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)") add_compile_options(-Wall -Wextra) endif() +# set the same behavior for windows as it is on linux +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # find dependencies set(THIS_PACKAGE_INCLUDE_DEPENDS hardware_interface @@ -19,7 +22,6 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) find_package(${Dependency} REQUIRED) endforeach() - ## COMPILE add_library( ros2_control_demo_example_9 @@ -36,10 +38,6 @@ ament_target_dependencies( ${THIS_PACKAGE_INCLUDE_DEPENDS} ) -# Causes the visibility macros to use dllexport rather than dllimport, -# which is appropriate when building the dll but not consuming it. -target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_9_BUILDING_DLL") - # Export hardware plugins pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_9.xml) diff --git a/example_9/hardware/include/ros2_control_demo_example_9/rrbot.hpp b/example_9/hardware/include/ros2_control_demo_example_9/rrbot.hpp index 4262966e9..f9b3ea82d 100644 --- a/example_9/hardware/include/ros2_control_demo_example_9/rrbot.hpp +++ b/example_9/hardware/include/ros2_control_demo_example_9/rrbot.hpp @@ -26,7 +26,6 @@ #include "rclcpp/macros.hpp" #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" #include "rclcpp_lifecycle/state.hpp" -#include "ros2_control_demo_example_9/visibility_control.h" namespace ros2_control_demo_example_9 { @@ -35,33 +34,25 @@ class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterfa public: RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemPositionOnlyHardware); - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC hardware_interface::CallbackReturn on_init( const hardware_interface::HardwareInfo & info) override; - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC hardware_interface::CallbackReturn on_configure( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC std::vector export_state_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC std::vector export_command_interfaces() override; - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC hardware_interface::CallbackReturn on_activate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC hardware_interface::CallbackReturn on_deactivate( const rclcpp_lifecycle::State & previous_state) override; - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC hardware_interface::return_type read( const rclcpp::Time & time, const rclcpp::Duration & period) override; - ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC hardware_interface::return_type write( const rclcpp::Time & time, const rclcpp::Duration & period) override; diff --git a/example_9/hardware/include/ros2_control_demo_example_9/visibility_control.h b/example_9/hardware/include/ros2_control_demo_example_9/visibility_control.h deleted file mode 100644 index 897f95c6b..000000000 --- a/example_9/hardware/include/ros2_control_demo_example_9/visibility_control.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2021 ros2_control Development Team -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* This header must be included by all rclcpp headers which declare symbols - * which are defined in the rclcpp library. When not building the rclcpp - * library, i.e. when using the headers in other package's code, the contents - * of this header change the visibility of certain symbols which the rclcpp - * library cannot have, but the consuming code must have inorder to link. - */ - -#ifndef ROS2_CONTROL_DEMO_EXAMPLE_9__VISIBILITY_CONTROL_H_ -#define ROS2_CONTROL_DEMO_EXAMPLE_9__VISIBILITY_CONTROL_H_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ -#ifdef __GNUC__ -#define ROS2_CONTROL_DEMO_EXAMPLE_9_EXPORT __attribute__((dllexport)) -#define ROS2_CONTROL_DEMO_EXAMPLE_9_IMPORT __attribute__((dllimport)) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_9_EXPORT __declspec(dllexport) -#define ROS2_CONTROL_DEMO_EXAMPLE_9_IMPORT __declspec(dllimport) -#endif -#ifdef ROS2_CONTROL_DEMO_EXAMPLE_9_BUILDING_DLL -#define ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_9_EXPORT -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC ROS2_CONTROL_DEMO_EXAMPLE_9_IMPORT -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC_TYPE ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_9_LOCAL -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_9_EXPORT __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_9_IMPORT -#if __GNUC__ >= 4 -#define ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC __attribute__((visibility("default"))) -#define ROS2_CONTROL_DEMO_EXAMPLE_9_LOCAL __attribute__((visibility("hidden"))) -#else -#define ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC -#define ROS2_CONTROL_DEMO_EXAMPLE_9_LOCAL -#endif -#define ROS2_CONTROL_DEMO_EXAMPLE_9_PUBLIC_TYPE -#endif - -#endif // ROS2_CONTROL_DEMO_EXAMPLE_9__VISIBILITY_CONTROL_H_