diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 254ce50..fb3e1c9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -44,7 +44,8 @@ jobs: strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11'] + # active versions: https://devguide.python.org/versions/ + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 @@ -72,7 +73,8 @@ jobs: strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11'] + # active versions: https://devguide.python.org/versions/ + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 @@ -87,13 +89,11 @@ jobs: # Using older boost version to avoid compiler errors with io_service - name: Install dependencies run: | - brew install eigen boost@1.85 - pip install cmake ninja wheel + brew install eigen boost + pip install cmake ninja wheel setuptools - name: Build run: | - export LDFLAGS="-L/opt/homebrew/opt/boost@1.85/lib" - export CPPFLAGS="-I/opt/homebrew/opt/boost@1.85/include" python setup.py bdist_wheel - name: Upload Build Artifact @@ -108,7 +108,8 @@ jobs: strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11'] + # active versions: https://devguide.python.org/versions/ + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 @@ -122,15 +123,17 @@ jobs: - name: Install dependencies run: | - pip install wheel + pip install wheel setuptools vcpkg install eigen3:x64-windows - name: Install boost - uses: MarkusJx/install-boost@v1.0.1 + uses: MarkusJx/install-boost@v2 id: install-boost with: - boost_version: 1.73.0 - toolset: msvc14.2 + boost_version: 1.87.0 + platform_version: 2022 + toolset: msvc + link: static - name: Build run: python setup.py bdist_wheel diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f7cdbe..ab6f28b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,9 @@ set(my_include_directories ${Boost_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ) -set(my_link_directories) +set(my_link_directories + ${Boost_LIBRARY_DIRS} +) set(my_files src/motioncapture.cpp src/mock.cpp @@ -83,6 +85,10 @@ if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK) ${my_files} src/optitrack.cpp ) + set(my_libraries + ${my_libraries} + Boost::system + ) endif() if (LIBMOTIONCAPTURE_ENABLE_OPTITRACK_CLOSED_SOURCE) diff --git a/deps/vicon-datastream-sdk b/deps/vicon-datastream-sdk index a06c604..a21c9c8 160000 --- a/deps/vicon-datastream-sdk +++ b/deps/vicon-datastream-sdk @@ -1 +1 @@ -Subproject commit a06c60494f771bc23c2f9336947e4bd531a67db1 +Subproject commit a21c9c8e5fd797e4833e19b78ad310d857c2f6c1 diff --git a/include/libmotioncapture/fzmotion.h b/include/libmotioncapture/fzmotion.h index 88a3b84..e5951b2 100644 --- a/include/libmotioncapture/fzmotion.h +++ b/include/libmotioncapture/fzmotion.h @@ -160,7 +160,7 @@ namespace libmotioncapture { static MotionCaptureFZMotion* s_pInstance; static recursive_mutex s_mutex; - boost::asio::io_service m_IOService; + boost::asio::io_context m_IOContext; udp::socket m_TransmissionSocket; udp::socket m_ConnectionSocket; udp::resolver m_Resolver; diff --git a/src/fzmotion.cpp b/src/fzmotion.cpp index adca7bf..85f63b6 100644 --- a/src/fzmotion.cpp +++ b/src/fzmotion.cpp @@ -7,9 +7,9 @@ namespace libmotioncapture { const int iLocalPort, const string& strRemoteIP, const int iRemotePort - ) : m_ConnectionSocket(m_IOService), - m_TransmissionSocket(m_IOService), - m_Resolver(m_IOService){ + ) : m_ConnectionSocket(m_IOContext), + m_TransmissionSocket(m_IOContext), + m_Resolver(m_IOContext){ this->init(); this->setConnectionInfo(strLocalIP, iLocalPort, strRemoteIP, iRemotePort); this->connect(); @@ -54,11 +54,9 @@ namespace libmotioncapture { this->m_strRemoteIP = strRemoteIP; this->m_iRemoteCPort = iRemotePort; - this->m_localCEndpoint = udp::endpoint(address_v4::from_string(this->m_strLocalIP), this->m_iLocalCPort); - - udp::resolver::query query(udp::v4(), this->m_strRemoteIP, std::to_string(this->m_iRemoteCPort)); - this->m_remoteCEndpoint = *this->m_Resolver.resolve(query); - + this->m_localCEndpoint = udp::endpoint(make_address_v4(this->m_strLocalIP), this->m_iLocalCPort); + this->m_remoteCEndpoint = udp::endpoint(make_address(this->m_strRemoteIP), this->m_iRemoteCPort); + s_mutex.unlock(); } //connect with the server @@ -162,13 +160,13 @@ namespace libmotioncapture { ReleaseBuffer(pBuffer); //joint multicast group - this->m_localMEndpoint = udp::endpoint(address_v4::from_string(this->m_strMulticastGroup), this->m_iDataReceivePort); + this->m_localMEndpoint = udp::endpoint(make_address_v4(this->m_strMulticastGroup), this->m_iDataReceivePort); if (this->m_TransmissionSocket.is_open() == false) { this->m_TransmissionSocket.open(this->m_localMEndpoint.protocol()); this->m_TransmissionSocket.set_option(udp::socket::reuse_address(true)); this->m_TransmissionSocket.set_option(ip::multicast::hops(5)); this->m_TransmissionSocket.set_option(ip::multicast::enable_loopback(true)); - this->m_TransmissionSocket.set_option(ip::multicast::join_group(address_v4::from_string(this->m_strMulticastGroup), address_v4::from_string(this->m_strLocalIP))); + this->m_TransmissionSocket.set_option(ip::multicast::join_group(make_address_v4(this->m_strMulticastGroup), make_address_v4(this->m_strLocalIP))); this->m_TransmissionSocket.bind(this->m_localMEndpoint); } @@ -189,7 +187,7 @@ namespace libmotioncapture { } if (this->m_TransmissionSocket.is_open() == true) { - this->m_TransmissionSocket.set_option(ip::multicast::leave_group(address_v4::from_string(this->m_strMulticastGroup), address_v4::from_string(this->m_strLocalIP))); + this->m_TransmissionSocket.set_option(ip::multicast::leave_group(make_address_v4(this->m_strMulticastGroup), make_address_v4(this->m_strLocalIP))); this->m_TransmissionSocket.close(); } diff --git a/src/optitrack.cpp b/src/optitrack.cpp index 3c61a9c..bb7c27b 100644 --- a/src/optitrack.cpp +++ b/src/optitrack.cpp @@ -45,8 +45,8 @@ namespace libmotioncapture { : version() , versionMajor(0) , versionMinor(0) - , io_service() - , socket(io_service) + , io_context() + , socket(io_context) , sender_endpoint() , data(MAX_PACKETSIZE) { @@ -240,7 +240,7 @@ namespace libmotioncapture { int versionMinor; uint64_t clockFrequency; // ticks/second for timestamps - boost::asio::io_service io_service; + boost::asio::io_context io_context; boost::asio::ip::udp::socket socket; boost::asio::ip::udp::endpoint sender_endpoint; std::vector data; @@ -285,10 +285,10 @@ namespace libmotioncapture { pImpl = new MotionCaptureOptitrackImpl; // Connect to command port to query version - boost::asio::io_service io_service_cmd; - udp::socket socket_cmd(io_service_cmd, udp::endpoint(udp::v4(), 0)); - udp::resolver resolver_cmd(io_service_cmd); - udp::endpoint endpoint_cmd = *resolver_cmd.resolve({udp::v4(), hostname, std::to_string(port_command)}); + boost::asio::io_context io_context_cmd; + udp::socket socket_cmd(io_context_cmd, udp::endpoint(udp::v4(), 0)); + udp::resolver resolver_cmd(io_context_cmd); + udp::endpoint endpoint_cmd(boost::asio::ip::make_address(hostname), port_command); typedef struct { @@ -354,8 +354,8 @@ namespace libmotioncapture { pImpl->parseModelDef(modelDef.data()); // connect to data port to receive mocap data - auto listen_address_boost = boost::asio::ip::address_v4::from_string(interface_ip); - auto multicast_address_boost = boost::asio::ip::address_v4::from_string(multicast_address); + auto listen_address_boost = boost::asio::ip::make_address_v4(interface_ip); + auto multicast_address_boost = boost::asio::ip::make_address_v4(multicast_address); // Create the socket so that multiple may be bound to the same address. boost::asio::ip::udp::endpoint listen_endpoint( diff --git a/src/vrpn.cpp b/src/vrpn.cpp index 78d9b3f..bba2924 100644 --- a/src/vrpn.cpp +++ b/src/vrpn.cpp @@ -5,6 +5,7 @@ #include #include #include +#include // VRPN #include