Skip to content

Commit

Permalink
Remove visibility macros (#539) (#545)
Browse files Browse the repository at this point in the history
* Remove visibility macros

* Remove dead target_compile_definitions

(cherry picked from commit f92cc21)

Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
  • Loading branch information
mergify[bot] and christophfroehlich authored Jul 26, 2024
1 parent 7ac7949 commit d9ceb6f
Show file tree
Hide file tree
Showing 43 changed files with 39 additions and 937 deletions.
8 changes: 3 additions & 5 deletions example_1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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<hardware_interface::StateInterface> export_state_interfaces() override;

ROS2_CONTROL_DEMO_EXAMPLE_1_PUBLIC
std::vector<hardware_interface::CommandInterface> 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;

Expand Down

This file was deleted.

8 changes: 3 additions & 5 deletions example_10/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <vector>

#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"
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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<hardware_interface::StateInterface> export_state_interfaces() override;

ROS2_CONTROL_DEMO_EXAMPLE_10_PUBLIC
std::vector<hardware_interface::CommandInterface> 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;

Expand Down

This file was deleted.

8 changes: 3 additions & 5 deletions example_11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<hardware_interface::StateInterface> export_state_interfaces() override;

ROS2_CONTROL_DEMO_EXAMPLE_11_PUBLIC
std::vector<hardware_interface::CommandInterface> 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;

Expand Down
Loading

0 comments on commit d9ceb6f

Please sign in to comment.