turtlebot3 icon indicating copy to clipboard operation
turtlebot3 copied to clipboard

Add Windows support for shared libraries

Open traversaro opened this issue 11 months ago • 5 comments

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.

traversaro avatar Jan 06 '25 21:01 traversaro

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!

traversaro avatar Jun 12 '25 12:06 traversaro

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?

GyuH13 avatar Jun 12 '25 23:06 GyuH13

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!

traversaro avatar Jun 13 '25 05:06 traversaro

We do not officially support Windows at the moment, but we will consider adding it in the next update. Thank you!

GyuH13 avatar Jun 13 '25 05:06 GyuH13

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.

traversaro avatar Jun 13 '25 06:06 traversaro

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

GyuH13 avatar Jul 08 '25 01:07 GyuH13

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!

traversaro avatar Jul 08 '25 05:07 traversaro