-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add support for compilation and test on Windows #116
Conversation
83fa6c4
to
fe267b8
Compare
What’s stopping the static string tests from compiling on windows? |
Sorry, I did not look into that originally, I checked it now. It seems that the line Line 25 in cebc67c
To be honest, I do not know if that test wanted to test implicit conversions from a iterator to a pointer, so I am not sure how it should be fixed. |
I recognize this problem. I think it can be fixed by replacing auto* with something like std::array::iterator. I’m away from my computer so I can’t test it out at the moment but we can eventually fix that. |
I think if there is no need/intention to test implicit conversion to pointer in the test, just changing |
Changing the line to |
fe267b8
to
c9331a2
Compare
I updated and rebase the PR in c9331a2, and updated the original description. |
I didn’t propose that because I believe it will cause clang-tidy to fail |
Ah, I had no idea. I will try, if clang-tidy complains I will just use the explicit iterator. |
clang-tidy error confirmed:
|
Tested on Visual Studio 2022
eb88b58
to
125f80e
Compare
Sorry, I forgot to reply. In the end I got rid of the auto and directly used the iterator. |
Can you submit a PR that makes this change in isolation? This PR is currently doing a few things at once and I'd rather tackle one problem at a time. |
Done in #120 . |
#119 fixes the issue with our tests using a GCC extension. I'm slowly chipping away at 1st class Windows support! |
See #122 |
Thanks for the PR! I've addressed everything except your |
Ok, I totally understand! Just to comment on a possible compromise, to make tests work out of the box while leaving the users the possibility to override |
Can I ask why you want to use DLLs which are notoriosly annoying to work with as opposed to the comparably much simpler static libraries? I'm also curious why you want to run RSL's test suite in the first place. |
Sorry, I forgot to answer. Just to clarify, I do not have any specific interest in having RSL testsuite on Windows with BUILD_SHARED_LIBS working out of the box, I just commented on how one could have a default value for
In this specific case the point was bringing RSL on https://robostack.github.io/index.html, a channel providing ROS software for the conda package manager on the top of the conda-forge community mantained channel.
Note that if a user is using a different workflow (for example you build all your dependencies from source, and they all have CMake structure that works fine with static linking, or you use bazel bypassing CMake at all) I totally agree that static linking may be more convenient, even if I can also add that in my experience not all existing CMake packages are well written to handle being built as static libraries (both on Windows or *nix). For example, a common bug is that when you are linking statically, all Sorry for the wall of text! I just wanted to explain why while in theory in theory shared linking on Windows may be "notoriosly annoying", sometimes it is the only way of working, unless you want to fix huge parts of the dependency stack, but explaining that in detail is a bit tricky.
When I opened the PR for the Windows fixes, I wanted to also provide a way to test if the fixes were working, nothing else beside that. |
I tested this on Visual Studio 2022.
The modifications are mainly three:
WINDOWS_EXPORT_ALL_SYMBOLS
to export automatically all defined functions. This ensures thatrsl.lib
is actually created, before this change only thersl.dll
library was created resulting in downstream errors such as the one reported in Windows Failure February 2024 RoboStack/ros-humble#136 (comment)CMAKE_RUNTIME_OUTPUT_DIRECTORY
so all the compiled .dll and .exe are placed in the same folder, ensuring that thetest-rsl.exe
can findCatch2.dll
,Catch2Main.dll
andrsl.dll
try.cpp
files from the tests on Windows as they were not compiling on Windowsstatic_string.cpp
to avoid requiring an implicit conversion from an iterator to a pointer