From 03fc5f65060576c343abc627a3f22a59c190418a Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 16:11:15 +0100 Subject: [PATCH 1/8] CI: add threads support --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f85edc..45be43a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +find_package(Threads REQUIRED) find_package(Boost 1.5 COMPONENTS system REQUIRED) # for optitrack add_definitions( -DBOOST_DATE_TIME_NO_LIB @@ -88,6 +89,7 @@ if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK) set(my_libraries ${my_libraries} Boost::system + Threads::Threads ) endif() From f13cc2c70c9a3043f210ce101101d6055778653b Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 21:05:37 +0100 Subject: [PATCH 2/8] add eigen to target_link_libraries --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45be43a..a6c6d96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -235,6 +235,8 @@ target_link_directories(libmotioncapture PUBLIC ) target_link_libraries(libmotioncapture ${my_libraries} + PRIVATE + Eigen3::Eigen ) set_property(TARGET libmotioncapture PROPERTY POSITION_INDEPENDENT_CODE ON) From 8a25bc4e578fcaf22984d659d3055d17c6da7c32 Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 21:30:42 +0100 Subject: [PATCH 3/8] fix cmake error --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6c6d96..8025812 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,9 +234,8 @@ target_link_directories(libmotioncapture PUBLIC ${my_link_directories} ) target_link_libraries(libmotioncapture + Eigen3::Eigen ${my_libraries} - PRIVATE - Eigen3::Eigen ) set_property(TARGET libmotioncapture PROPERTY POSITION_INDEPENDENT_CODE ON) From 82e4f96ce9d19463f6dcb7715cd61cac1d8d51b3 Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 21:40:13 +0100 Subject: [PATCH 4/8] optitrack: add generic PACK() macro --- src/optitrack.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/optitrack.cpp b/src/optitrack.cpp index cbef735..796bd91 100644 --- a/src/optitrack.cpp +++ b/src/optitrack.cpp @@ -5,6 +5,19 @@ using boost::asio::ip::udp; +// Source - https://stackoverflow.com/a/3312896 +// Posted by Steph, modified by community. See post 'Timeline' for change history +// Retrieved 2026-02-21, License - CC BY-SA 4.0 + +#ifdef __GNUC__ +#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__)) +#endif + +#ifdef _MSC_VER +#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop)) +#endif + + namespace libmotioncapture { constexpr int MAX_PACKETSIZE = 65503; // max size of packet (actual packet size is dynamic) @@ -355,10 +368,10 @@ if (!response.IsMulticast) { const uint16_t port_cmd = 1510; // Build a NatNet "Connect" command (message ID 0x0002) - struct NatNetCommand { + PACK(struct NatNetCommand { uint16_t messageId; uint16_t packetSize; - } __attribute__((packed)); + }); NatNetCommand connectCmd; connectCmd.messageId = 0x0002; // "Client Connect" message From f9407f95b944784ecfae7acb316edba5c4788c6d Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 21:46:50 +0100 Subject: [PATCH 5/8] fixed Boost::system include for Boost >= 1.89 Thanks @hshose --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8025812..e164c17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(Threads REQUIRED) -find_package(Boost 1.5 COMPONENTS system REQUIRED) # for optitrack +find_package(Boost 1.5 REQUIRED) # for optitrack add_definitions( -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB @@ -88,7 +88,7 @@ if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK) ) set(my_libraries ${my_libraries} - Boost::system + Boost::boost Threads::Threads ) endif() From b13be06e6d494603484baa9bf5aa6a7e64a58a2e Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 21:56:20 +0100 Subject: [PATCH 6/8] try re-adding the system component --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e164c17..e3491ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(Threads REQUIRED) -find_package(Boost 1.5 REQUIRED) # for optitrack +find_package(Boost 1.5 COMPONENTS system REQUIRED) # for optitrack add_definitions( -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB From 1d1efcffdc91385f6e918692c69e6d627bb435a1 Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 22:09:46 +0100 Subject: [PATCH 7/8] add boost::system conditionally --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3491ad..1151e35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(Threads REQUIRED) -find_package(Boost 1.5 COMPONENTS system REQUIRED) # for optitrack +find_package(Boost 1.5) # for optitrack add_definitions( -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB @@ -91,6 +91,11 @@ if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK) Boost::boost Threads::Threads ) + if (Boost_SYSTEM_FOUND) + set(my_libraries + Boost::system + ) + endif() endif() if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK_CLOSED_SOURCE) From 99503303c85762d2efda221bf2c3e2ba122c1842 Mon Sep 17 00:00:00 2001 From: Wolfgang Hoenig Date: Sat, 21 Feb 2026 22:21:00 +0100 Subject: [PATCH 8/8] more boost find_package adjustments --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1151e35..d9b5fe6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) find_package(Threads REQUIRED) -find_package(Boost 1.5) # for optitrack +find_package(Boost 1.5 OPTIONAL_COMPONENTS system) # for optitrack add_definitions( -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB @@ -93,6 +93,7 @@ if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK) ) if (Boost_SYSTEM_FOUND) set(my_libraries + ${my_libraries} Boost::system ) endif()