Skip to content

Added macos support#15

Merged
serges147 merged 160 commits intomainfrom
sshirokov/macos
Mar 4, 2025
Merged

Added macos support#15
serges147 merged 160 commits intomainfrom
sshirokov/macos

Conversation

@serges147
Copy link
Contributor

@serges147 serges147 commented Mar 3, 2025

  • CAN transport now under Linux only.
  • Merged kqueue fixes (from the demos repo).
  • Fixed warning in logs (due to expected EINTR "error" from ::kevent & epoll_wait).

@serges147 serges147 self-assigned this Mar 3, 2025
@serges147 serges147 marked this pull request as ready for review March 3, 2025 12:46
@serges147 serges147 changed the title Sshirokov/macos Added macos support Mar 3, 2025
# Supported formats:
# - 'udp://<ip4>'
# - 'socketcan:<can_device>'
# - 'socketcan:<can_device>' (linux only)
Copy link
Member

Choose a reason for hiding this comment

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

Technically, SocketCAN is available not only on Linux -- it's also available in at least Zephyr and NuttX

Comment on lines +39 to +46
if (${PLATFORM_OS_TYPE} STREQUAL "linux")
add_library(canard
${submodules_dir}/libcanard/libcanard/canard.c
)
target_include_directories(canard
INTERFACE SYSTEM ${submodules_dir}/libcanard/libcanard
)
endif ()
Copy link
Member

Choose a reason for hiding this comment

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

This seems to imply that we cannot use CAN in macOS at all, but that's only true because we only support SocketCAN. One could easily add a driver for SLCAN or gs-usb and use CAN on any OS in this manner, so this exclusion is misleading here.

Comment on lines +69 to +71
target_link_libraries(ocvsmd_engine
PUBLIC canard
)
Copy link
Member

Choose a reason for hiding this comment

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

I suggest moving this block outside of the conditional to avoid the false implication that CAN requires Linux


#ifdef __linux__
# include <libcyphal/transport/can/can_transport.hpp>
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Same goes here and below

@serges147 serges147 requested a review from pavel-kirienko March 4, 2025 09:28
Copy link
Member

@pavel-kirienko pavel-kirienko 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 these conditionals on __linux__ are misleading. How about we add a config macro like OCVSMD_USE_CAN, and populate it from CMake, such that it is enabled by default only on Linux, and we add a comment explaining that one day we may add gs-usb or something to make it work on other platforms?

@serges147
Copy link
Contributor Author

serges147 commented Mar 4, 2025

I think these conditionals on __linux__ are misleading. How about we add a config macro like OCVSMD_USE_CAN, and populate it from CMake, such that it is enabled by default only on Linux, and we add a comment explaining that one day we may add gs-usb or something to make it work on other platforms?

In the next occasion I'll get rid of __linux__, and add such OCVSMD_USE_SOCKETCAN (note, I inserted "socket" word) definition - to both ocvsmd and demos repos.

@serges147 serges147 merged commit f0b330d into main Mar 4, 2025
38 checks passed
@serges147 serges147 deleted the sshirokov/macos branch March 4, 2025 20:59
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.

4 participants