Add Windows support for shared libraries
The package compiles a library, but does not expose any symbol on Windows, so if the CMake project is compiled with -DBUILD_SHARED_LIBS:BOOL=ON on Windows, no library is actually generated.
On Linux and macOS, everything compiles fine with -DBUILD_SHARED_LIBS:BOOL=ON as by default all the symbols are visible. We can achieve exactly the same behavior in Windows by setting to ON the CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS CMake variable, so this PR sets the CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS variable to ON, to ensure that the compilation with -DBUILD_SHARED_LIBS:BOOL=ON works fine on Windows.
Hello @GyuH13 @robotpilot, is there anything that we can help with to get this change merged? The change is a nop for non-Windows platforms, and it would be convenient to avoid to carry a downstream patch in robostack (see https://github.com/RoboStack/ros-jazzy/issues/61), thanks!
Hello @traversaro
This PR is intended to support ROS 2 users on Windows, correct?
As I understand it, previously the package could not be built on Windows unless the line set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) was manually added to the CMake configuration.
With this change, will the build now work correctly on Windows when using ROS 2?
Hello @traversaro This PR is intended to support ROS 2 users on Windows, correct? As I understand it, previously the package could not be built on Windows unless the line
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)was manually added to the CMake configuration. With this change, will the build now work correctly on Windows when using ROS 2?
Exactly!
We do not officially support Windows at the moment, but we will consider adding it in the next update. Thank you!
We do not officially support Windows at the moment, but we will consider adding it in the next update. Thank you!
Thanks! Just to clarify, you could even add this change without officially supporting Windows, as it does nothing ok non-Windows platforms.
Hello, the contents of this PR have been merged and included in version 2.3.2. Thank you for your interest and contribution! https://github.com/ROBOTIS-GIT/turtlebot3/pull/1113
Hello, the contents of this PR have been merged and included in version 2.3.2. Thank you for your interest and contribution! https://github.com/ROBOTIS-GIT/turtlebot3/pull/1113
Thanks!