1- diff --git a/CMakeLists.txt b/CMakeLists.txt
2- index 71deedd3..15821a4e 100644
3- --- a/CMakeLists.txt
4- +++ b/CMakeLists.txt
5- @@ -86,9 +86,15 @@ target_include_directories(foxglove_cpp_shared SYSTEM
6- target_sources(foxglove_cpp_shared PRIVATE ${FOXGLOVE_SDK_SOURCES})
7- # Import the prebuilt C shared library from the fetched SDK
8- add_library(foxglove-shared SHARED IMPORTED)
9- - set_target_properties(foxglove-shared PROPERTIES
10- - IMPORTED_LOCATION ${foxglove_sdk_SOURCE_DIR}/lib/libfoxglove.so
11- - )
12- + if(APPLE)
13- + set_target_properties(foxglove-shared PROPERTIES
14- + IMPORTED_LOCATION ${foxglove_sdk_SOURCE_DIR}/lib/libfoxglove.dylib
15- + )
16- + else()
17- + set_target_properties(foxglove-shared PROPERTIES
18- + IMPORTED_LOCATION ${foxglove_sdk_SOURCE_DIR}/lib/libfoxglove.so
19- + )
20- + endif()
21- target_link_libraries(foxglove_cpp_shared PRIVATE foxglove-shared)
22- set_target_properties(foxglove_cpp_shared PROPERTIES
23- INSTALL_RPATH "$ORIGIN"
241diff --git a/src/ros2_foxglove_bridge.cpp b/src/ros2_foxglove_bridge.cpp
25- index 2229aadc..9431dbdd 100644
2+ index 601db6c..fc18e1c 100644
263--- a/src/ros2_foxglove_bridge.cpp
274+++ b/src/ros2_foxglove_bridge.cpp
28- @@ -479 ,7 +479 ,7 @@ void FoxgloveBridge::updateAdvertisedTopics(
5+ @@ -492 ,7 +492 ,7 @@ void FoxgloveBridge::updateAdvertisedTopics(
296 const TopicAndDatatype topicAndSchemaName = {topic, schemaName};
307 if (latestTopics.find(topicAndSchemaName) == latestTopics.end()) {
318 const auto channelId = channel.id();
@@ -34,7 +11,7 @@ index 2229aadc..9431dbdd 100644
3411 topic.c_str(), schemaName.c_str());
3512 // Remove any active subscriptions for this channel
3613 _subscriptions.erase(channelId);
37- @@ -549 ,7 +549 ,7 @@ void FoxgloveBridge::updateAdvertisedTopics(
14+ @@ -562 ,7 +562 ,7 @@ void FoxgloveBridge::updateAdvertisedTopics(
3815 }
3916
4017 const ChannelId channelId = channelResult.value().id();
@@ -43,7 +20,7 @@ index 2229aadc..9431dbdd 100644
4320 topic.c_str());
4421 _channels.insert({channelId, std::move(channelResult.value())});
4522 }
46- @@ -814 ,7 +814 ,7 @@ void FoxgloveBridge::subscribeConnectionGraph(bool subscribe) {
23+ @@ -827 ,7 +827 ,7 @@ void FoxgloveBridge::subscribeConnectionGraph(bool subscribe) {
4724 }
4825
4926 void FoxgloveBridge::subscribe(ChannelId channelId, const foxglove::ClientMetadata& client) {
@@ -52,7 +29,7 @@ index 2229aadc..9431dbdd 100644
5229 channelId, client.id);
5330 createOrIncrementSubscription(channelId, client.id, false, client.sink_id);
5431 }
55- @@ -867 ,7 +867 ,7 @@ void FoxgloveBridge::createOrIncrementSubscriptionLocked(ChannelId channelId, Cl
32+ @@ -880 ,7 +880 ,7 @@ void FoxgloveBridge::createOrIncrementSubscriptionLocked(ChannelId channelId, Cl
5633 std::optional<SinkId> sinkId) {
5734 auto channelIt = _channels.find(channelId);
5835 if (channelIt == _channels.end()) {
@@ -61,7 +38,7 @@ index 2229aadc..9431dbdd 100644
6138 channelId);
6239 return;
6340 }
64- @@ -898 ,7 +898 ,7 @@ void FoxgloveBridge::createOrIncrementSubscriptionLocked(ChannelId channelId, Cl
41+ @@ -911 ,7 +911 ,7 @@ void FoxgloveBridge::createOrIncrementSubscriptionLocked(ChannelId channelId, Cl
6542 auto [it, inserted] = _subscriptions.emplace(channelId, std::move(channelSub));
6643 subIt = it;
6744
@@ -70,7 +47,7 @@ index 2229aadc..9431dbdd 100644
7047 topic.c_str(), datatype.c_str(), channelId);
7148 }
7249
73- @@ -922 ,7 +922 ,7 @@ void FoxgloveBridge::createOrIncrementSubscriptionLocked(ChannelId channelId, Cl
50+ @@ -935 ,7 +935 ,7 @@ void FoxgloveBridge::createOrIncrementSubscriptionLocked(ChannelId channelId, Cl
7451 }
7552
7653 void FoxgloveBridge::unsubscribe(ChannelId channelId, const foxglove::ClientMetadata& client) {
@@ -79,7 +56,7 @@ index 2229aadc..9431dbdd 100644
7956 channelId, client.id);
8057 removeOrDecrementSubscription(channelId, client.id, false);
8158 }
82- @@ -938 ,7 +938 ,7 @@ void FoxgloveBridge::removeOrDecrementSubscriptionLocked(ChannelId channelId, Cl
59+ @@ -951 ,7 +951 ,7 @@ void FoxgloveBridge::removeOrDecrementSubscriptionLocked(ChannelId channelId, Cl
8360 auto subIt = _subscriptions.find(channelId);
8461 if (subIt == _subscriptions.end()) {
8562 RCLCPP_ERROR(this->get_logger(),
@@ -88,7 +65,7 @@ index 2229aadc..9431dbdd 100644
8865 clientId, channelId);
8966 return;
9067 }
91- @@ -953 ,7 +953 ,7 @@ void FoxgloveBridge::removeOrDecrementSubscriptionLocked(ChannelId channelId, Cl
68+ @@ -966 ,7 +966 ,7 @@ void FoxgloveBridge::removeOrDecrementSubscriptionLocked(ChannelId channelId, Cl
9269 // If no more subscribers, destroy the ROS subscription
9370 if (subIt->second.wsClientIds.empty() && subIt->second.gatewayClientIds.empty()) {
9471 RCLCPP_INFO(this->get_logger(),
@@ -97,7 +74,7 @@ index 2229aadc..9431dbdd 100644
9774 _subscriptions.erase(subIt);
9875 }
9976 }
100- @@ -1092 ,7 +1092 ,7 @@ void FoxgloveBridge::clientUnadvertise(ClientId clientId, ChannelId clientChanne
77+ @@ -1105 ,7 +1105 ,7 @@ void FoxgloveBridge::clientUnadvertise(ClientId clientId, ChannelId clientChanne
10178
10279 const auto& publisher = it->second.publisher;
10380 RCLCPP_INFO(this->get_logger(),
@@ -106,7 +83,7 @@ index 2229aadc..9431dbdd 100644
10683 publisher->get_topic_name(), publisher->get_subscription_count(), clientChannelId);
10784
10885 _clientAdvertisedTopics.erase(it);
109- @@ -1460 ,13 +1460 ,13 @@ void FoxgloveBridge::gatewaySubscribe(uint32_t clientId,
86+ @@ -1585 ,13 +1585 ,13 @@ void FoxgloveBridge::gatewaySubscribe(uint32_t clientId,
11087 auto sinkId = _gateway->sinkId();
11188 if (!sinkId.has_value()) {
11289 RCLCPP_WARN(this->get_logger(),
@@ -122,7 +99,7 @@ index 2229aadc..9431dbdd 100644
12299 channel.id(), std::string(channel.topic()).c_str(), clientId);
123100 createOrIncrementSubscription(channel.id(), clientId, true, sinkId);
124101 }
125- @@ -1474 ,7 +1474 ,7 @@ void FoxgloveBridge::gatewaySubscribe(uint32_t clientId,
102+ @@ -1599 ,7 +1599 ,7 @@ void FoxgloveBridge::gatewaySubscribe(uint32_t clientId,
126103 void FoxgloveBridge::gatewayUnsubscribe(uint32_t clientId,
127104 const foxglove::ChannelDescriptor& channel) {
128105 RCLCPP_INFO(this->get_logger(),
@@ -131,7 +108,7 @@ index 2229aadc..9431dbdd 100644
131108 channel.id(), std::string(channel.topic()).c_str(), clientId);
132109 removeOrDecrementSubscription(channel.id(), clientId, true);
133110 }
134- @@ -1489 ,7 +1489 ,7 @@ void FoxgloveBridge::gatewayClientAdvertise(uint32_t clientId,
111+ @@ -1614 ,7 +1614 ,7 @@ void FoxgloveBridge::gatewayClientAdvertise(uint32_t clientId,
135112
136113 ChannelAndClientId key = {channelId, clientId};
137114 if (_gatewayClientAdvertisedTopics.find(key) != _gatewayClientAdvertisedTopics.end()) {
@@ -140,7 +117,7 @@ index 2229aadc..9431dbdd 100644
140117 clientId, channelId, topicName.c_str());
141118 return;
142119 }
143- @@ -1506 ,7 +1506 ,7 @@ void FoxgloveBridge::gatewayClientAdvertise(uint32_t clientId,
120+ @@ -1631 ,7 +1631 ,7 @@ void FoxgloveBridge::gatewayClientAdvertise(uint32_t clientId,
144121
145122 if (topicType.empty()) {
146123 RCLCPP_ERROR(this->get_logger(),
@@ -149,7 +126,7 @@ index 2229aadc..9431dbdd 100644
149126 clientId, channelId, topicName.c_str());
150127 return;
151128 }
152- @@ -1514 ,12 +1514 ,12 @@ void FoxgloveBridge::gatewayClientAdvertise(uint32_t clientId,
129+ @@ -1639 ,12 +1639 ,12 @@ void FoxgloveBridge::gatewayClientAdvertise(uint32_t clientId,
153130 try {
154131 auto ad = createClientPublisher(topicName, topicType, encoding, schemaData, schemaLen);
155132 RCLCPP_INFO(this->get_logger(),
@@ -164,7 +141,7 @@ index 2229aadc..9431dbdd 100644
164141 clientId, channelId, topicName.c_str(), ex.what());
165142 }
166143 }
167- @@ -1533 ,13 +1533 ,13 @@ void FoxgloveBridge::gatewayClientUnadvertise(uint32_t clientId,
144+ @@ -1658 ,13 +1658 ,13 @@ void FoxgloveBridge::gatewayClientUnadvertise(uint32_t clientId,
168145
169146 auto it = _gatewayClientAdvertisedTopics.find(key);
170147 if (it == _gatewayClientAdvertisedTopics.end()) {
@@ -180,7 +157,7 @@ index 2229aadc..9431dbdd 100644
180157 channelId, it->second.topicName.c_str());
181158 _gatewayClientAdvertisedTopics.erase(it);
182159
183- @@ -1563 ,7 +1563 ,7 @@ void FoxgloveBridge::gatewayClientMessage(uint32_t clientId,
160+ @@ -1688 ,7 +1688 ,7 @@ void FoxgloveBridge::gatewayClientMessage(uint32_t clientId,
184161 auto it = _gatewayClientAdvertisedTopics.find(key);
185162 if (it == _gatewayClientAdvertisedTopics.end()) {
186163 RCLCPP_ERROR(this->get_logger(),
@@ -189,7 +166,7 @@ index 2229aadc..9431dbdd 100644
189166 channelId);
190167 return;
191168 }
192- @@ -1574 ,7 +1574 ,7 @@ void FoxgloveBridge::gatewayClientMessage(uint32_t clientId,
169+ @@ -1699 ,7 +1699 ,7 @@ void FoxgloveBridge::gatewayClientMessage(uint32_t clientId,
193170 try {
194171 publishClientData(ad, data, dataLen);
195172 } catch (const std::exception& ex) {
0 commit comments