CMakeLists.txt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. cmake_minimum_required(VERSION 2.8.3)
  2. project(libwaypoint_follower)
  3. find_package(autoware_build_flags)
  4. find_package(catkin REQUIRED COMPONENTS
  5. amathutils_lib
  6. autoware_msgs
  7. geometry_msgs
  8. roscpp
  9. roslint
  10. rosunit
  11. std_msgs
  12. )
  13. find_package(Eigen3 QUIET)
  14. if (NOT EIGEN3_FOUND)
  15. # Fallback to cmake_modules
  16. find_package(cmake_modules REQUIRED)
  17. find_package(Eigen REQUIRED)
  18. set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
  19. set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES}) # Not strictly necessary as Eigen is head only
  20. # Possibly map additional variables to the EIGEN3_ prefix.
  21. else ()
  22. set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
  23. endif ()
  24. catkin_package(
  25. INCLUDE_DIRS include
  26. LIBRARIES libwaypoint_follower
  27. CATKIN_DEPENDS
  28. amathutils_lib
  29. autoware_msgs
  30. geometry_msgs
  31. std_msgs
  32. )
  33. SET(CMAKE_CXX_FLAGS "-O2 -g -Wall ${CMAKE_CXX_FLAGS}")
  34. include_directories(libwaypoint_follower
  35. include
  36. ${catkin_INCLUDE_DIRS}
  37. ${EIGEN3_INCLUDE_DIR}
  38. )
  39. add_library(libwaypoint_follower src/libwaypoint_follower.cpp
  40. src/pure_pursuit.cpp)
  41. add_dependencies(libwaypoint_follower ${catkin_EXPORTED_TARGETS})
  42. target_link_libraries(libwaypoint_follower ${catkin_LIBRARIES})
  43. ## Install executables and/or libraries
  44. install(TARGETS libwaypoint_follower
  45. ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  46. LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  47. RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  48. )
  49. ## Install project namespaced headers
  50. install(DIRECTORY include/${PROJECT_NAME}/
  51. DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  52. )
  53. file(GLOB_RECURSE ROSLINT_FILES
  54. LIST_DIRECTORIES false
  55. *.cpp *.h *.hpp
  56. )
  57. list(APPEND ROSLINT_CPP_OPTS "--extensions=cc,h,hpp,cpp,cu,cuh" "--filter=-build/c++11,-runtime/references")
  58. roslint_cpp(${ROSLINT_FILES})
  59. if (CATKIN_ENABLE_TESTING)
  60. find_package(rostest REQUIRED)
  61. add_rostest_gtest(test-libwaypoint_follower
  62. test/test_libwaypoint_follower.test
  63. test/src/test_libwaypoint_follower.cpp
  64. src/libwaypoint_follower.cpp
  65. )
  66. add_dependencies(test-libwaypoint_follower ${catkin_EXPORTED_TARGETS})
  67. target_link_libraries(test-libwaypoint_follower
  68. ${catkin_LIBRARIES}
  69. )
  70. add_rostest_gtest(test-pure_pursuit
  71. test/test_pure_pursuit.test
  72. test/src/test_pure_pursuit.cpp
  73. src/libwaypoint_follower.cpp
  74. src/pure_pursuit.cpp
  75. )
  76. add_dependencies(test-pure_pursuit ${catkin_EXPORTED_TARGETS})
  77. target_link_libraries(test-pure_pursuit
  78. ${catkin_LIBRARIES}
  79. )
  80. roslint_add_test()
  81. endif ()