Skip to content

Conversation

@acmorrow
Copy link
Member

@acmorrow acmorrow commented Apr 7, 2025

  • Ensure __cplusplus is set right on Windows builds.
  • Don't download or link to viam_rust_utils on Windows.
  • Redirect the viam_rust_utils entry points to abort on Windows.
  • Adjust viamapi library name on Windows and apply /WHOLEARCHIVE
  • Use std::invoke_result_t instead of result_of in C++17, where the latter is deprecated
  • Add windows headers where needed.

@acmorrow acmorrow requested review from lia-viam and stuqdog April 7, 2025 14:42
@acmorrow acmorrow requested a review from a team as a code owner April 7, 2025 14:42
@@ -1,3 +1,9 @@
#ifdef _WIN32
#define NOMINMAX
#include <winsock2.h>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love this. I'm surprised the gRPC headers don't handle this for themselves, but without this this file doesn't compile.

The right way to do this would be with a global config precompiled header that got pulled into every .cpp we have, but I don't want to spend time on that right now, so I will file a follow-up ticket.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rpc/dial.cpp
rpc/server.cpp
rpc/private/viam_grpc_channel.cpp
rpc/private/viam_rust_utils_stubs.cpp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of doing an #if WIN32 in the cpp file, what if we did this at the CMake level:

if (NOT WIN32)
  target_link_libraries(viamsdk
    PRIVATE viam_rust_utils
  )
else()
    target_sources(viamsdk PRIVATE rust_utils_stubs.cpp)
endif()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll give that a try, and as long as it works (which I expect it will) I'll merge with that.

Copy link
Collaborator

@lia-viam lia-viam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks fine assuming the main tests pass. Conan is failing but it's only as broken as it already was on main (which seems to have gotten worse recently) so not a blocker for merging.

Probably want to look into github CI for the conan package at some point however

@acmorrow acmorrow merged commit ac5bd71 into viamrobotics:main Apr 7, 2025
6 of 13 checks passed
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