Эх сурвалжийг харах

Remove use of google_library and google_test. (#40)

Damon Kohler 8 жил өмнө
parent
commit
ad44668e64

+ 35 - 3
cartographer_turtlebot/CMakeLists.txt

@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-cmake_minimum_required(VERSION 2.8.3)
+cmake_minimum_required(VERSION 2.8.12)  # Ships with Ubuntu 14.04 (Trusty)
 
 project(cartographer_turtlebot)
 
@@ -28,12 +28,44 @@ include("${CARTOGRAPHER_CMAKE_DIR}/functions.cmake")
 google_initialize_cartographer_project()
 google_enable_testing()
 
+find_package(LuaGoogle REQUIRED)
+
 find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES})
-include_directories(${catkin_INCLUDE_DIRS})
+
+# Override Catkin's GTest configuration to use GMock.
+set(GTEST_FOUND TRUE)
+set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS})
+set(GTEST_LIBRARIES ${GMOCK_LIBRARIES})
 
 catkin_package(CATKIN_DEPENDS message_runtime ${PACKAGE_DEPENDENCIES})
 
-add_subdirectory("cartographer_turtlebot")
+if (CATKIN_ENABLE_TESTING)
+  catkin_add_gtest(configuration_files_test "cartographer_turtlebot/configuration_files_test.cc")
+  # catkin_add_gtest uses a plain (i.e. no PUBLIC/PRIVATE/INTERFACE) call to
+  # target_link_libraries. That forces us to do the same.
+  target_include_directories(configuration_files_test SYSTEM PUBLIC ${LUA_INCLUDE_DIR})
+  target_link_libraries(configuration_files_test ${LUA_LIBRARIES})
+  target_include_directories(configuration_files_test SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})
+  target_link_libraries(configuration_files_test ${catkin_LIBRARIES})
+  add_dependencies(configuration_files_test ${catkin_EXPORTED_TARGETS})
+  target_include_directories(configuration_files_test SYSTEM PUBLIC ${CARTOGRAPHER_INCLUDE_DIRS})
+  target_link_libraries(configuration_files_test ${CARTOGRAPHER_LIBRARIES})
+  set(TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${GOOG_CXX_FLAGS}")
+  set_target_properties(configuration_files_test PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})
+endif()
+
+add_executable(cartographer_flat_world_imu_node "cartographer_turtlebot/flat_world_imu_node_main.cc")
+target_include_directories(cartographer_flat_world_imu_node SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})
+target_link_libraries(cartographer_flat_world_imu_node ${catkin_LIBRARIES})
+add_dependencies(cartographer_flat_world_imu_node ${catkin_EXPORTED_TARGETS})
+set(TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${GOOG_CXX_FLAGS}")
+set_target_properties(cartographer_flat_world_imu_node PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})
+
+install(TARGETS cartographer_flat_world_imu_node
+  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+)
 
 install(DIRECTORY launch configuration_files
   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}

+ 0 - 16
cartographer_turtlebot/cartographer_turtlebot/CMakeLists.txt

@@ -1,16 +0,0 @@
-google_test(configuration_files_test
-  USES_CARTOGRAPHER
-  SRCS
-    configuration_files_test.cc
-)
-
-google_binary(cartographer_flat_world_imu_node
-  SRCS
-    flat_world_imu_node_main.cc
-)
-
-install(TARGETS cartographer_flat_world_imu_node
-  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-)

+ 2 - 0
cartographer_turtlebot/package.xml

@@ -43,4 +43,6 @@
   <depend>sensor_msgs</depend>
   <depend>turtlebot_bringup</depend>
   <depend>urg_node</depend>
+
+  <test_depend>rosunit</test_depend>
 </package>