Skip to content

Commit be71c26

Browse files
authored
Fix missing radar_msgs libraries for standalone build (#256)
* Fix missing radar_msgs libraries for standalone build * Remove duplicates for dlls before installing * Smuggling: improve external library test
1 parent e0d5aa6 commit be71c26

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

ros2_standalone/CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ macro(get_standalone_dependencies _library_name)
104104
endif()
105105
endif()
106106

107+
# If library is msgs, fetch all targets to get libraries for dynamic type support
108+
# Those libraries are not listed in <XX>_LIBRARIES (which stands for libraries to link against to use <XX>)
109+
if(${_library_name} MATCHES ".*\_msgs$")
110+
foreach(entry ${${_library_name}_TARGETS})
111+
fetch_target_lib(${entry})
112+
string(REGEX REPLACE "::" "_" entry_normalized ${entry})
113+
list(APPEND REQ_STANDALONE_LIBS
114+
${${entry_normalized}_LIB_PATH})
115+
endforeach()
116+
endif()
117+
107118
# Get spdlog and dependency
108119
if(UNIX AND "${_library_name}" STREQUAL "spdlog")
109120
include(${${_library_name}_CONFIG})
@@ -148,8 +159,9 @@ macro(install_standalone_dependencies)
148159
string(REGEX REPLACE "\.lib$" ".dll" dll_path ${bin_path})
149160
list(APPEND REQ_STANDALONE_DLLS ${dll_path})
150161
endforeach()
162+
list(REMOVE_DUPLICATES REQ_STANDALONE_DLLS)
151163
install(FILES ${REQ_STANDALONE_DLLS}
152-
DESTINATION ${INSTALL_DESTINATION_DIR}
164+
DESTINATION ${INSTALL_DESTINATION_DIR}
153165
)
154166
elseif(UNIX)
155167
set(_resolvedFiles "")
@@ -160,7 +172,7 @@ macro(install_standalone_dependencies)
160172
endforeach()
161173

162174
install(FILES ${_resolvedFiles}
163-
DESTINATION ${INSTALL_DESTINATION_DIR}
175+
DESTINATION ${INSTALL_DESTINATION_DIR}
164176
)
165177

166178
# Fix soversion files

test/src/externalLibraryTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ TEST_F(ExternalLibraryTest, RclcppInitializeAndShutDownProperly)
2626
ASSERT_EXIT(
2727
{
2828
rgl_node_t ros2pub = nullptr;
29-
rgl_node_points_ros2_publish(&ros2pub, "rglTopic", "rglFrame");
30-
rgl_cleanup();
29+
ASSERT_RGL_SUCCESS(rgl_node_points_ros2_publish(&ros2pub, "rglTopic", "rglFrame"));
30+
ASSERT_RGL_SUCCESS(rgl_cleanup());
3131
exit(0);
3232
},
3333
::testing::ExitedWithCode(0), "")
3434
<< "Test for rclcpp (de)initialization failed. "
35-
<< "It is probably caused by a mismatched version of the spdlog library for RGL and ROS2. "
36-
<< "Check its compatibility.";
35+
<< "It is probably caused by a mismatched version of the spdlog library for RGL and ROS2 "
36+
<< "or internal ROS2 error.";
3737
}
3838
#endif

0 commit comments

Comments
 (0)