Skip to content

Add Windows support for shared libraries #1043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

traversaro
Copy link

@traversaro traversaro commented Jan 6, 2025

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
Copy link
Author

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 RoboStack/ros-jazzy#61), thanks!

@GyuH13
Copy link
Member

GyuH13 commented Jun 12, 2025

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?

@traversaro
Copy link
Author

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!

@GyuH13
Copy link
Member

GyuH13 commented Jun 13, 2025

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

@traversaro
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants