123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- cmake_minimum_required(VERSION 2.8.3)
- project(localizer)
- set(CMAKE_CXX_STANDARD 14)
- option(BUILD_VGICP_CUDA "Build GPU-powered VGICP" OFF)
- option(BUILD_apps "Build application programs" ON)
- option(BUILD_test "Build test programs" OFF)
- option(BUILD_PYTHON_BINDINGS "Build python bindings" OFF)
- find_package(catkin REQUIRED COMPONENTS
- roscpp
- tf2
- tf2_ros
- tf2_geometry_msgs
- std_msgs
- geometry_msgs
- sensor_msgs
- nav_msgs
- diagnostic_msgs
- pcl_conversions
- pcl_ros
- message_generation
- )
- generate_messages(
- DEPENDENCIES
- std_msgs
- )
- find_package(OpenCV REQUIRED)
- find_package(PCL REQUIRED QUIET)
- find_package(OpenMP REQUIRED)
- catkin_package(
- INCLUDE_DIRS include
- CATKIN_DEPENDS
- roscpp
- tf2
- tf2_ros
- tf2_geometry_msgs
- geometry_msgs
- sensor_msgs
- nav_msgs
- diagnostic_msgs
- pcl_conversions
- pcl_ros
- message_generation
- )
- find_package(OpenMP)
- if (OPENMP_FOUND)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
- endif()
- if(BUILD_VGICP_CUDA)
- find_package(CUDA REQUIRED)
- include_directories(${CUDA_INCLUDE_DIRS})
- link_directories(${CUDA_LIBRARY_DIRS})
- endif()
- find_package(RapidJSON)
- ###################################
- ## catkin specific configuration ##
- ###################################
- if(catkin_FOUND)
- catkin_package(
- INCLUDE_DIRS include
- LIBRARIES fast_gicp
- )
- endif()
- include_directories(include
- ${catkin_INCLUDE_DIRS}
- ${OpenCV_INCLUDE_DIRS}
- )
- add_library(localizer SHARED
- src/fast_gicp/gicp/lsq_registration.cpp
- src/fast_gicp/gicp/fast_gicp.cpp
- src/fast_gicp/gicp/fast_gicp_st.cpp
- src/fast_gicp/gicp/fast_vgicp.cpp
- )
- target_link_libraries(localizer
- ${PCL_LIBRARIES}
- )
- target_include_directories(localizer PUBLIC
- include
- ${PCL_INCLUDE_DIRS}
- ${EIGEN3_INCLUDE_DIR}
- )
- ### CUDA ###
- if(BUILD_VGICP_CUDA)
- set(CUDA_NVCC_FLAGS "--expt-relaxed-constexpr")
- add_definitions(-DUSE_VGICP_CUDA)
- cuda_add_library(localizer_cuda SHARED
- src/fast_gicp/cuda/fast_vgicp_cuda.cu
- src/fast_gicp/cuda/brute_force_knn.cu
- src/fast_gicp/cuda/covariance_estimation.cu
- src/fast_gicp/cuda/covariance_estimation_rbf.cu
- src/fast_gicp/cuda/covariance_regularization.cu
- src/fast_gicp/cuda/gaussian_voxelmap.cu
- src/fast_gicp/cuda/find_voxel_correspondences.cu
- src/fast_gicp/cuda/compute_derivatives.cu
- src/fast_gicp/cuda/compute_mahalanobis.cu
- src/fast_gicp/cuda/ndt_cuda.cu
- src/fast_gicp/cuda/ndt_compute_derivatives.cu
- )
- target_include_directories(localizer_cuda PRIVATE
- include
- thirdparty/Eigen
- thirdparty/nvbio
- ${catkin_INCLUDE_DIRS}
- )
- target_link_libraries(localizer_cuda
- ${catkin_LIBRARIES}
- )
- cuda_add_cublas_to_target(localizer_cuda)
- # add vgicp_cuda to libfast_gicp
- target_sources(localizer PRIVATE
- src/fast_gicp/gicp/fast_vgicp_cuda.cpp
- src/fast_gicp/ndt/ndt_cuda.cpp
- )
- target_link_libraries(localizer
- localizer_cuda
- )
- add_dependencies(localizer localizer_cuda)
- if(catkin_FOUND)
- install(TARGETS localizer_cuda
- LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
- endif()
- endif()
- ###########
- ## Build ##
- ###########
- include_directories(include ${catkin_INCLUDE_DIRS})
- SET(CMAKE_CXX_FLAGS "-O2 -g -Wall ${CMAKE_CXX_FLAGS}")
- add_executable(map_loader src/map_loader.cpp)
- target_link_libraries(map_loader ${catkin_LIBRARIES} ${PCL_LIBRARIES})
- add_executable(deskew_point_cloud src/deskew_point_cloud.cpp)
- target_link_libraries(deskew_point_cloud ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES})
- add_executable(localizer_node src/localizer.cpp src/localizer_node.cpp)
- target_link_libraries(localizer_node ${catkin_LIBRARIES} ${PCL_LIBRARIES} localizer )
- #############
- ## Install ##
- #############
- # all install targets should use catkin DESTINATION variables
- # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
- ## Mark executable scripts (Python etc.) for installation
- ## in contrast to setup.py, you can choose the destination
- # catkin_install_python(PROGRAMS
- # scripts/my_python_script
- # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
- # )
- # Mark executables for installation
- # See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
- install(TARGETS map_loader deskew_point_cloud localizer_node
- RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
- )
- ## Mark libraries for installation
- ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
- # install(TARGETS ${PROJECT_NAME}
- # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
- # RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
- # )
- # Mark cpp header files for installation
- install(DIRECTORY include/${PROJECT_NAME}/
- DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
- FILES_MATCHING PATTERN "*.h"
- PATTERN ".svn" EXCLUDE
- )
- # Mark other files for installation (e.g. launch and bag files, etc.)
- install(FILES
- # myfile1
- # myfile2
- launch/deskw_point_cloud.launch
- launch/localizer.launch
- launch/map_loader.launch
- launch/run.launch
- launch/lexus.launch
- launch/static_tf.launch
- DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
- )
- #############
- ## Testing ##
- #############
- ## Add gtest based cpp test target and link libraries
- # catkin_add_gtest(${PROJECT_NAME}-test test/test_math_tool.cpp)
- # if(TARGET ${PROJECT_NAME}-test)
- # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
- # endif()
- ## Add folders to be run by python nosetests
- # catkin_add_nosetests(test)
|