Using ament_target_dependencies where possible (#400)

* Using ament_target_dependencies where possible

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>

* Modified rcl_add_custom_* to use AMENT_DEPENDENCIES where possible

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>

* Added again osrf_testing_tools_cpp::memory_tools library where needed.

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>

* Modified with PR comment, and replaced forgotten osrf_testing_tools_cpp including

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
This commit is contained in:
ivanpauno 2019-03-19 09:22:16 -03:00 committed by GitHub
parent 29b0838388
commit 99630cb66d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 55 deletions

View file

@ -35,11 +35,10 @@ function(test_target_function)
rcl_add_custom_gtest(test_client${target_suffix}
SRCS rcl/test_client.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_gtest(test_time${target_suffix}
@ -71,11 +70,10 @@ function(test_target_function)
rcl_add_custom_gtest(test_get_node_names${target_suffix}
SRCS rcl/test_get_node_names.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation}
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp"
)
rcl_add_custom_gtest(test_lexer${target_suffix}
@ -88,11 +86,10 @@ function(test_target_function)
rcl_add_custom_gtest(test_lexer_lookahead${target_suffix}
SRCS rcl/test_lexer_lookahead.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation}
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp"
)
set(AMENT_GTEST_ARGS "")
@ -107,21 +104,19 @@ function(test_target_function)
endif()
rcl_add_custom_gtest(test_graph${target_suffix}
SRCS rcl/test_graph.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
${AMENT_GTEST_ARGS}
)
rcl_add_custom_gtest(test_count_matched${target_suffix}
SRCS rcl/test_count_matched.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_gtest(test_init${target_suffix}
@ -134,11 +129,10 @@ function(test_target_function)
rcl_add_custom_gtest(test_node${target_suffix}
SRCS rcl/test_node.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var} ${memory_tools_ld_preload_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools
AMENT_DEPENDENCIES ${rmw_implementation}
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp"
)
rcl_add_custom_gtest(test_arguments${target_suffix}
@ -150,90 +144,81 @@ function(test_target_function)
rcl_add_custom_gtest(test_remap${target_suffix}
SRCS rcl/test_remap.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES "osrf_testing_tools_cpp"
)
rcl_add_custom_gtest(test_remap_integration${target_suffix}
SRCS rcl/test_remap_integration.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
TIMEOUT 200
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES "test_msgs"
AMENT_DEPENDENCIES "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_gtest(test_guard_condition${target_suffix}
SRCS rcl/test_guard_condition.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var} ${memory_tools_ld_preload_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME} osrf_testing_tools_cpp::memory_tools
AMENT_DEPENDENCIES ${rmw_implementation}
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp"
)
rcl_add_custom_gtest(test_publisher${target_suffix}
SRCS rcl/test_publisher.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_gtest(test_service${target_suffix}
SRCS rcl/test_service.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_gtest(test_subscription${target_suffix}
SRCS rcl/test_subscription.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_gtest(test_wait${target_suffix}
SRCS rcl/test_wait.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation}
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp"
)
rcl_add_custom_gtest(test_namespace${target_suffix}
SRCS test_namespace.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
ENV ${rmw_implementation_env_var}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
# Launch tests
rcl_add_custom_executable(service_fixture${target_suffix}
SRCS rcl/service_fixture.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_executable(client_fixture${target_suffix}
SRCS rcl/client_fixture.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES ${rmw_implementation} "test_msgs"
AMENT_DEPENDENCIES ${rmw_implementation} "osrf_testing_tools_cpp" "test_msgs"
)
rcl_add_custom_launch_test(test_services
@ -296,9 +281,9 @@ rcl_add_custom_gtest(test_expand_topic_name
rcl_add_custom_gtest(test_timer${target_suffix}
SRCS rcl/test_timer.cpp
INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
APPEND_LIBRARY_DIRS ${extra_lib_dirs}
LIBRARIES ${PROJECT_NAME}
AMENT_DEPENDENCIES "osrf_testing_tools_cpp"
)
rcl_add_custom_gtest(test_security_directory

View file

@ -87,12 +87,11 @@ if(BUILD_TESTING)
if(TARGET test_action_client)
target_include_directories(test_action_client PUBLIC
include
${osrf_testing_tools_cpp_INCLUDE_DIRS}
)
target_link_libraries(test_action_client
${PROJECT_NAME}
)
ament_target_dependencies(test_action_client "rcl" "test_msgs")
ament_target_dependencies(test_action_client "osrf_testing_tools_cpp" "rcl" "test_msgs")
endif()
# get the rmw implementations ahead of time
@ -118,13 +117,14 @@ if(BUILD_TESTING)
PUBLIC "RMW_IMPLEMENTATION=${rmw_implementation}")
target_include_directories(${target}${target_suffix} PUBLIC
include
${rcl_INCLUDE_DIRS}
)
target_link_libraries(${target}${target_suffix}
${PROJECT_NAME}
)
ament_target_dependencies(${target}${target_suffix}
"test_msgs")
"rcl"
"test_msgs"
)
endif()
endfunction()
@ -156,12 +156,14 @@ if(BUILD_TESTING)
if(TARGET test_action_server)
target_include_directories(test_action_server PUBLIC
include
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_action_server
${PROJECT_NAME}
)
ament_target_dependencies(test_action_server "test_msgs")
ament_target_dependencies(test_action_server
"rcl"
"test_msgs"
)
endif()
ament_add_gtest(test_goal_handle
test/rcl_action/test_goal_handle.cpp
@ -169,22 +171,20 @@ if(BUILD_TESTING)
if(TARGET test_goal_handle)
target_include_directories(test_goal_handle PUBLIC
include
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_goal_handle
${PROJECT_NAME}
)
ament_target_dependencies(test_action_server "rcl")
endif()
ament_add_gtest(test_goal_state_machine
test/rcl_action/test_goal_state_machine.cpp
)
if(TARGET test_goal_state_machine)
target_include_directories(test_goal_state_machine PUBLIC
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_goal_state_machine
${PROJECT_NAME}
)
ament_target_dependencies(test_action_server "rcl")
endif()
ament_add_gtest(test_types
test/rcl_action/test_types.cpp
@ -192,22 +192,20 @@ if(BUILD_TESTING)
if(TARGET test_types)
target_include_directories(test_types PUBLIC
include
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_types
${PROJECT_NAME}
)
ament_target_dependencies(test_action_server "rcl")
endif()
ament_add_gtest(test_names
test/rcl_action/test_names.cpp
)
if(TARGET test_names)
target_include_directories(test_names PUBLIC
${rcl_INCLUDE_DIRS}
)
target_link_libraries(test_names
${PROJECT_NAME}
)
ament_target_dependencies(test_action_server "rcl")
endif()
endif()

View file

@ -70,9 +70,9 @@ if(BUILD_TESTING)
test/test_default_state_machine.cpp
)
if(TARGET test_default_state_machine)
target_include_directories(test_default_state_machine PUBLIC
${rcl_INCLUDE_DIRS}
${osrf_testing_tools_cpp_INCLUDE_DIRS}
ament_target_dependencies(test_default_state_machine
"rcl"
"osrf_testing_tools_cpp"
)
target_link_libraries(test_default_state_machine ${PROJECT_NAME})
endif()
@ -80,9 +80,9 @@ if(BUILD_TESTING)
test/test_multiple_instances.cpp
)
if(TARGET test_multiple_instances)
target_include_directories(test_multiple_instances PUBLIC
${rcl_INCLUDE_DIRS}
${osrf_testing_tools_cpp_INCLUDE_DIRS}
ament_target_dependencies(test_multiple_instances
"rcl"
"osrf_testing_tools_cpp"
)
target_link_libraries(test_multiple_instances ${PROJECT_NAME})
endif()
@ -90,8 +90,8 @@ if(BUILD_TESTING)
test/test_transition_map.cpp
)
if(TARGET test_transition_map)
target_include_directories(test_transition_map PUBLIC
${rcl_INCLUDE_DIRS}
ament_target_dependencies(test_transition_map
"rcl"
)
target_link_libraries(test_transition_map ${PROJECT_NAME})
endif()