ros-drivers / transport_drivers

A set of ROS2 drivers for transport-layer protocols.
Apache License 2.0
93 stars 56 forks source link

building shared lib on windows #53

Closed flynneva closed 2 years ago

flynneva commented 3 years ago

I ran into this issue while trying to write a similar package that uses a shared lib like io_context. In order to get the lib to build on Windows I needed to add the following to the beginning of the shared lib CMakelists.txt file.

## needed to build on windows
if(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(BUILD_SHARED_LIBS TRUE)
endif()

not sure if anyones tried to compile this on windows yet....but we might need to add this to the io_context/CMakelists.txt file to do so.

JWhitleyWork commented 3 years ago

@flynneva Rather than targeting the specific compiler, can you check for if(WIN32)? See https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/How-To-Write-Platform-Checks for details. If this works for you, it shouldn't interrupt anyone else's workflow so I'm fine with accepting a PR for the change.

flynneva commented 3 years ago

@JWhitleyWork wouldnt mind your input here. stuck on what I think is a problem with linking the io_context library when building serial_driver and udp_driver. the CI still doesnt work for windows or mac so ignore that, but if you could have a quick look at the changes ive made so far and share any advice it would be greatly appreciated.

https://github.com/flynneva/transport_drivers/pull/5