@@ -54,10 +54,20 @@ target_link_libraries(controller_manager PUBLIC
54
54
${std_msgs_TARGETS}
55
55
${controller_manager_msgs_TARGETS} )
56
56
57
+ function (add_atomic_link_options target )
58
+ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "loongarch64" )
59
+ target_link_options (${target} PRIVATE
60
+ "LINKER:--no-as-needed"
61
+ "LINKER:-latomic"
62
+ "LINKER:--as-needed"
63
+ )
64
+ endif ()
65
+ endfunction ()
57
66
add_executable (ros2_control_node src/ros2_control_node.cpp)
58
67
target_link_libraries (ros2_control_node PRIVATE
59
68
controller_manager
60
69
)
70
+ add_atomic_link_options(ros2_control_node)
61
71
62
72
if (BUILD_TESTING)
63
73
find_package (ament_cmake_gmock REQUIRED)
@@ -109,6 +119,7 @@ if(BUILD_TESTING)
109
119
test_chainable_controller
110
120
ros2_control_test_assets::ros2_control_test_assets
111
121
)
122
+ add_atomic_link_options(test_controller_manager)
112
123
113
124
ament_add_gmock(test_controller_manager_with_namespace
114
125
test /test_controller_manager_with_namespace.cpp
@@ -118,6 +129,7 @@ if(BUILD_TESTING)
118
129
test_controller
119
130
ros2_control_test_assets::ros2_control_test_assets
120
131
)
132
+ add_atomic_link_options(test_controller_manager_with_namespace)
121
133
122
134
ament_add_gmock(test_controller_manager_hardware_error_handling
123
135
test /test_controller_manager_hardware_error_handling.cpp
@@ -127,6 +139,7 @@ if(BUILD_TESTING)
127
139
test_controller
128
140
ros2_control_test_assets::ros2_control_test_assets
129
141
)
142
+ add_atomic_link_options(test_controller_manager_hardware_error_handling)
130
143
131
144
ament_add_gmock(test_load_controller
132
145
test /test_load_controller.cpp
@@ -138,6 +151,7 @@ if(BUILD_TESTING)
138
151
test_controller_failed_init
139
152
ros2_control_test_assets::ros2_control_test_assets
140
153
)
154
+ add_atomic_link_options(test_load_controller)
141
155
142
156
ament_add_gmock(test_controllers_chaining_with_controller_manager
143
157
test /test_controllers_chaining_with_controller_manager.cpp
@@ -148,6 +162,7 @@ if(BUILD_TESTING)
148
162
test_controller
149
163
ros2_control_test_assets::ros2_control_test_assets
150
164
)
165
+ add_atomic_link_options(test_controllers_chaining_with_controller_manager)
151
166
152
167
ament_add_gmock(test_controller_manager_srvs
153
168
test /test_controller_manager_srvs.cpp
@@ -160,6 +175,7 @@ if(BUILD_TESTING)
160
175
ros2_control_test_assets::ros2_control_test_assets
161
176
${controller_manager_msgs_TARGETS}
162
177
)
178
+ add_atomic_link_options(test_controller_manager_srvs)
163
179
set_tests_properties (test_controller_manager_srvs PROPERTIES TIMEOUT 120)
164
180
ament_add_gmock(test_controller_manager_urdf_passing
165
181
test /test_controller_manager_urdf_passing.cpp
@@ -170,6 +186,7 @@ if(BUILD_TESTING)
170
186
ros2_control_test_assets::ros2_control_test_assets
171
187
${controller_manager_msgs_TARGETS}
172
188
)
189
+ add_atomic_link_options(test_controller_manager_urdf_passing)
173
190
174
191
add_library (test_controller_with_interfaces SHARED
175
192
test /test_controller_with_interfaces/test_controller_with_interfaces.cpp
@@ -194,6 +211,7 @@ if(BUILD_TESTING)
194
211
test_controller_with_interfaces
195
212
ros2_control_test_assets::ros2_control_test_assets
196
213
)
214
+ add_atomic_link_options(test_release_interfaces)
197
215
198
216
ament_add_gmock(test_spawner_unspawner
199
217
test /test_spawner_unspawner.cpp
@@ -204,6 +222,7 @@ if(BUILD_TESTING)
204
222
test_controller
205
223
ros2_control_test_assets::ros2_control_test_assets
206
224
)
225
+ add_atomic_link_options(test_spawner_unspawner)
207
226
target_compile_definitions (
208
227
test_spawner_unspawner
209
228
PRIVATE PARAMETERS_FILE_PATH="${CMAKE_CURRENT_LIST_DIR} /test/" )
@@ -217,6 +236,7 @@ if(BUILD_TESTING)
217
236
test_controller
218
237
ros2_control_test_assets::ros2_control_test_assets
219
238
)
239
+ add_atomic_link_options(test_hardware_spawner)
220
240
221
241
ament_add_gmock(test_hardware_management_srvs
222
242
test /test_hardware_management_srvs.cpp
@@ -227,6 +247,7 @@ if(BUILD_TESTING)
227
247
ros2_control_test_assets::ros2_control_test_assets
228
248
${controller_manager_msgs_TARGETS}
229
249
)
250
+ add_atomic_link_options(test_hardware_management_srvs)
230
251
231
252
find_package (ament_cmake_pytest REQUIRED)
232
253
install (FILES test /test_ros2_control_node.yaml
0 commit comments