Skip to content

Commit

Permalink
Merge branch 'fix/grid_map_cmake_unit_tests' into 'master'
Browse files Browse the repository at this point in the history
[grid_map*] Executables are also counted for coverage, updated cmake

GitOrigin-RevId: a2df6f2718b885c52de7fd267d757f108c7eb019
  • Loading branch information
YoshuaNavaANYbotics authored and anybotics-sync-runner committed Sep 7, 2020
1 parent e3e00ff commit b41708e
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 174 deletions.
13 changes: 6 additions & 7 deletions grid_map_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ install(

if(CATKIN_ENABLE_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
find_package(catkin REQUIRED)

## Add gtest based cpp test target and link libraries
catkin_add_gtest(${PROJECT_NAME}-test
Expand All @@ -126,12 +125,12 @@ if(CATKIN_ENABLE_TESTING)
test/SpiralIteratorTest.cpp
test/SlidingWindowIteratorTest.cpp
)
target_include_directories(${PROJECT_NAME}-test
PRIVATE
include
PUBLIC SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
Expand Down
19 changes: 6 additions & 13 deletions grid_map_costmap_2d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,18 @@ install(
if(CATKIN_ENABLE_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

find_package(catkin REQUIRED
COMPONENTS
grid_map_core
costmap_2d
tf
)

## Add gtest based cpp test target and link libraries
catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_costmap_2d.cpp
test/Costmap2DConverterTest.cpp
)
add_subdirectory(rostest)
target_include_directories(${PROJECT_NAME}-test
PRIVATE
include
PUBLIC SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}-test
${catkin_LIBRARIES}
Expand Down
19 changes: 6 additions & 13 deletions grid_map_cv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,18 @@ install(
if(CATKIN_ENABLE_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

find_package(catkin REQUIRED
COMPONENTS
grid_map_core
cv_bridge
filters
)

## Add gtest based cpp test target and link libraries
catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_cv.cpp
test/GridMapCvTest.cpp
test/GridMapCvProcessingTest.cpp
)
target_include_directories(${PROJECT_NAME}-test
PRIVATE
include
PUBLIC SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
Expand Down
87 changes: 35 additions & 52 deletions grid_map_demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,67 +60,55 @@ include_directories(
)

## Declare a cpp executable
add_executable(
simple_demo
add_executable(simple_demo
src/simple_demo_node.cpp
)

add_executable(
tutorial_demo
add_executable(tutorial_demo
src/tutorial_demo_node.cpp
)

add_executable(
iterators_demo
add_executable(iterators_demo
src/iterators_demo_node.cpp
src/IteratorsDemo.cpp
)

add_executable(
image_to_gridmap_demo
add_executable(image_to_gridmap_demo
src/image_to_gridmap_demo_node.cpp
src/ImageToGridmapDemo.cpp
)

add_executable(
octomap_to_gridmap_demo
add_executable(octomap_to_gridmap_demo
src/octomap_to_gridmap_demo_node.cpp
src/OctomapToGridmapDemo.cpp
)

add_executable(
move_demo
add_executable(move_demo
src/move_demo_node.cpp
)

add_executable(
iterator_benchmark
add_executable(iterator_benchmark
src/iterator_benchmark.cpp
)

add_executable(
opencv_demo
add_executable(opencv_demo
src/opencv_demo_node.cpp
)

add_executable(
resolution_change_demo
add_executable(resolution_change_demo
src/resolution_change_demo_node.cpp
)

add_executable(
filters_demo
add_executable(filters_demo
src/filters_demo_node.cpp
src/FiltersDemo.cpp
)

add_executable(
normal_filter_comparison_demo
add_executable(normal_filter_comparison_demo
src/normal_filter_comparison_node.cpp
)

add_executable(
interpolation_demo
add_executable(interpolation_demo
src/interpolation_demo_node.cpp
src/InterpolationDemo.cpp
)
Expand Down Expand Up @@ -227,37 +215,32 @@ install(
## Test ##
##############
if(CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED
COMPONENTS
roscpp
grid_map_core
grid_map_ros
grid_map_cv
grid_map_filters
grid_map_loader
grid_map_msgs
grid_map_octomap
grid_map_rviz_plugin
grid_map_visualization
geometry_msgs
sensor_msgs
cv_bridge
octomap_msgs
filters
)

catkin_add_gtest(test_${PROJECT_NAME}
catkin_add_gtest(${PROJECT_NAME}-test
test/empty_test.cpp
)
target_include_directories(test_${PROJECT_NAME}
PRIVATE
include
SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
add_dependencies(${PROJECT_NAME}-test
filters_demo
image_to_gridmap_demo
interpolation_demo
iterator_benchmark
iterators_demo
move_demo
normal_filter_comparison_demo
octomap_to_gridmap_demo
opencv_demo
resolution_change_demo
simple_demo
tutorial_demo
)
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_link_libraries(test_${PROJECT_NAME}
${catkin_LIBRARIES}
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}-test
gtest_main
${catkin_LIBRARIES}
)

###################
Expand All @@ -267,7 +250,7 @@ if(CATKIN_ENABLE_TESTING)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(
TEST_BUILD_TARGETS
test_${PROJECT_NAME}
${PROJECT_NAME}-test
)
endif()
endif()
14 changes: 6 additions & 8 deletions grid_map_filters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,15 @@ install(
#############

if (CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED)

catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_filters.cpp
)
target_include_directories(${PROJECT_NAME}-test
PRIVATE
include
PUBLIC SYSTEM
${catkin_INCLUDE_DIRS}
${TBB_INCLUDE_DIRS}
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${TBB_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
Expand Down
20 changes: 10 additions & 10 deletions grid_map_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ include_directories(
)

## Declare a cpp executable
add_executable(
${PROJECT_NAME}
add_executable(${PROJECT_NAME}
src/grid_map_loader_node.cpp
src/GridMapLoader.cpp
)
Expand Down Expand Up @@ -72,17 +71,18 @@ install(
#############

if (CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED)

catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_loader.cpp
)
target_include_directories(${PROJECT_NAME}-test
PRIVATE
include
PUBLIC SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
add_dependencies(${PROJECT_NAME}-test
${PROJECT_NAME}
)
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)

###################
Expand Down
16 changes: 6 additions & 10 deletions grid_map_octomap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,18 @@ install(

if(CATKIN_ENABLE_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
find_package(catkin REQUIRED
COMPONENTS
grid_map_core
)

# Add gtest based cpp test target and link libraries
catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_octomap.cpp
test/OctomapConverterTest.cpp
)
target_include_directories(${PROJECT_NAME}-test
PRIVATE
include
PUBLIC SYSTEM
${catkin_INCLUDE_DIRS}
${OCTOMAP_INCLUDE_DIRS}
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${OCTOMAP_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
Expand Down
19 changes: 7 additions & 12 deletions grid_map_pcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ install(
if(CATKIN_ENABLE_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

find_package(catkin REQUIRED
COMPONENTS
${CATKIN_PACKAGE_DEPENDENCIES}
)

## Add gtest based cpp test target and link libraries
catkin_add_gtest(${PROJECT_NAME}-test
test/test_grid_map_pcl.cpp
Expand All @@ -133,13 +128,13 @@ if(CATKIN_ENABLE_TESTING)
test/test_helpers.cpp
test/PointcloudCreator.cpp
)
target_include_directories(${PROJECT_NAME}-test
PRIVATE
include
PUBLIC SYSTEM
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${OpenMP_CXX_INCLUDE_DIRS}
target_include_directories(${PROJECT_NAME}-test PRIVATE
include
)
target_include_directories(${PROJECT_NAME}-test SYSTEM PUBLIC
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${OpenMP_CXX_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME}-test
${PROJECT_NAME}
Expand Down
Loading

0 comments on commit b41708e

Please sign in to comment.