Add benchmarks for components (#1479)

Cherry-picked from 08963df92644a5de963d80bd206b4185de77d822

Signed-off-by: Scott K Logan <logans@cottsay.net>
This commit is contained in:
Scott K Logan 2020-11-25 16:07:50 -08:00 committed by GitHub
parent bea9c5a8f6
commit 965b4d2c24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 134 additions and 0 deletions

View file

@ -65,6 +65,10 @@ endif()
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_google_benchmark REQUIRED)
find_package(benchmark REQUIRED)
# Give cppcheck hints about macro definitions coming from outside this package
get_target_property(ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS benchmark::benchmark INTERFACE_INCLUDE_DIRECTORIES)
ament_lint_auto_find_test_dependencies()
set(components "")
@ -109,6 +113,14 @@ if(BUILD_TESTING)
if(TARGET test_component_manager_api)
target_link_libraries(test_component_manager_api component_manager)
endif()
ament_add_google_benchmark(benchmark_components
test/benchmark/benchmark_components.cpp
APPEND_ENV AMENT_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/test_ament_index/$<CONFIG>
APPEND_LIBRARY_DIRS "${append_library_dirs}")
if(TARGET benchmark_components)
target_link_libraries(benchmark_components component_manager)
endif()
endif()
install(