|
1 | | -option(BUILD_JSK_PKGS "Enable building of required components of jsk_recognition_msgs and jsk_rviz_plugins" ON) |
2 | | - |
3 | | -if(BUILD_JSK_PKGS) |
4 | | - add_subdirectory(include/jsk_recognition_msgs) |
5 | | -# add_subdirectory(include/jsk_rviz_plugins) #TODO: allow building of rviz plugins as well |
6 | | -endif() |
7 | | - |
8 | | -cmake_minimum_required(VERSION 3.0.2) |
| 1 | +cmake_minimum_required(VERSION 3.5) |
9 | 2 | project(patchworkpp) |
10 | | - |
11 | 3 | add_compile_options(-std=c++17) |
12 | 4 | set(CMAKE_BUILD_TYPE "Release") |
13 | 5 |
|
14 | 6 | set(CMAKE_CXX_STANDARD 14) |
15 | 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
16 | 8 | set(CMAKE_CXX_EXTENSIONS OFF) |
17 | 9 |
|
18 | | -find_package(catkin REQUIRED COMPONENTS |
19 | | - roscpp |
20 | | - rospy |
21 | | - std_msgs |
22 | | - roslaunch |
23 | | - cv_bridge |
24 | | - pcl_conversions |
25 | | - pcl_ros |
26 | | - geometry_msgs |
27 | | - laser_geometry |
28 | | - sensor_msgs |
29 | | - message_generation |
30 | | - jsk_recognition_msgs |
31 | | -) |
32 | | - |
33 | | -find_package(OpenCV REQUIRED) |
34 | | - |
35 | | -generate_messages( |
36 | | - DEPENDENCIES |
37 | | - std_msgs |
38 | | - geometry_msgs |
39 | | - sensor_msgs |
40 | | -) |
41 | | - |
42 | | -find_package(PCL 1.7 REQUIRED) |
| 10 | +add_definitions(-DTARGET_ROS2) |
| 11 | +find_package(ament_cmake REQUIRED) |
| 12 | +find_package(rclcpp REQUIRED) |
| 13 | +find_package(pcl_ros REQUIRED) |
| 14 | +find_package(pcl_conversions REQUIRED) |
| 15 | +find_package(std_msgs REQUIRED) |
| 16 | +find_package(sensor_msgs REQUIRED) |
| 17 | +find_package(rclcpp_components REQUIRED) |
43 | 18 | find_package(Boost 1.54 REQUIRED) |
44 | | -find_package(OpenMP) |
45 | | -if (OPENMP_FOUND) |
46 | | - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") |
47 | | - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") |
48 | | - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") |
49 | | -endif() |
50 | 19 |
|
51 | | -catkin_package( |
52 | | - INCLUDE_DIRS |
53 | | - LIBRARIES |
54 | | - CATKIN_DEPENDS roscpp rospy std_msgs |
55 | | -) |
56 | | - |
57 | | -include_directories( |
58 | | - ${catkin_INCLUDE_DIRS} |
59 | | - ${PCL_INCLUDE_DIRS} |
60 | | - ${OpenCV_INCLUDE_DIRS} |
61 | | - include |
62 | | -) |
| 20 | +set(INCLUDE_DIRS include |
| 21 | +${ament_cmake_INCLUDE_DIRS} |
| 22 | +${rclcpp_INCLUDE_DIRS} |
| 23 | +${pcl_ros_INCLUDE_DIRS} |
| 24 | +${pcl_conversions_INCLUDE_DIRS} |
| 25 | +${std_msgs_INCLUDE_DIRS} |
| 26 | +${sensor_msgs_INCLUDE_DIRS} |
| 27 | +${rclcpp_components_INCLUDE_DIRS}) |
| 28 | +# Include |
| 29 | +include_directories(${INCLUDE_DIRS}) |
| 30 | + |
| 31 | +set(LIBRARY_DIRS |
| 32 | +${ament_cmake_LIBRARY_DIRS} |
| 33 | +${rclcpp_LIBRARY_DIRS} |
| 34 | +${pcl_ros_LIBRARY_DIRS} |
| 35 | +${pcl_conversions_LIBRARY_DIRS} |
| 36 | +${std_msgs_LIBRARY_DIRS} |
| 37 | +${sensor_msgs_LIBRARY_DIRS} |
| 38 | +${rclcpp_components_LIBRARY_DIRS}) |
| 39 | +# Linking |
| 40 | +link_directories(${LIBRARY_DIRS}) |
| 41 | + |
| 42 | +set(LIBS |
| 43 | +${ament_cmake_LIBRARIES} |
| 44 | +${rclcpp_LIBRARIES} |
| 45 | +${pcl_ros_LIBRARIES} |
| 46 | +${pcl_conversions_LIBRARIES} |
| 47 | +${std_msgs_LIBRARIES} |
| 48 | +${sensor_msgs_LIBRARIES} |
| 49 | +${rclcpp_components_LIBRARIES}) |
63 | 50 |
|
64 | | -add_executable(offline_kitti src/offline_kitti.cpp) |
65 | | -target_link_libraries(offline_kitti ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES}) |
66 | | -add_dependencies(offline_kitti patchworkpp_generate_messages_cpp) |
67 | 51 |
|
68 | 52 | add_executable(demo src/demo.cpp) |
69 | | -target_link_libraries(demo ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES}) |
70 | | -add_dependencies(demo patchworkpp_generate_messages_cpp) |
| 53 | +target_link_libraries(demo ${LIBS} ${PCL_LIBRARIES} ) |
71 | 54 |
|
72 | | -add_executable(video src/video.cpp) |
73 | | -target_link_libraries(video ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES}) |
74 | | -add_dependencies(video patchworkpp_generate_messages_cpp) |
| 55 | +add_library(patchworkpp SHARED src/patchworkpp.cpp) |
| 56 | +target_compile_definitions(patchworkpp PUBLIC "PATCHWORKPP_COMPOSITION_BUILDING_DLL") |
| 57 | +target_link_libraries(patchworkpp ${LIBS}) |
75 | 58 |
|
| 59 | +install(TARGETS |
| 60 | +patchworkpp |
| 61 | +ARCHIVE DESTINATION lib |
| 62 | +LIBRARY DESTINATION lib |
| 63 | +RUNTIME DESTINATION bin |
| 64 | +) |
76 | 65 |
|
77 | 66 | # ==== Install ==== |
78 | 67 | install(TARGETS demo |
79 | | - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
80 | | - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
81 | | - RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
82 | | -) |
| 68 | +ARCHIVE |
| 69 | +LIBRARY |
| 70 | +RUNTIME |
| 71 | +DESTINATION lib/${PROJECT_NAME}) |
83 | 72 |
|
84 | 73 | install(DIRECTORY include/${PROJECT_NAME}/ |
85 | | - DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) |
86 | | - |
87 | | -install(DIRECTORY launch config |
88 | | - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} |
89 | | -) |
| 74 | +DESTINATION include/${PROJECT_NAME}) |
| 75 | + |
| 76 | +install(DIRECTORY launch config rviz DESTINATION share/${PROJECT_NAME}) |
| 77 | + |
| 78 | +ament_export_dependencies(ament_cmake) |
| 79 | +ament_export_dependencies(rclcpp) |
| 80 | +ament_export_dependencies(pcl_ros) |
| 81 | +ament_export_dependencies(pcl_conversions) |
| 82 | +ament_export_dependencies(std_msgs) |
| 83 | +ament_export_dependencies(sensor_msgs) |
| 84 | +ament_export_include_directories(${INCLUDE_DIRS}) |
| 85 | +ament_package() |
0 commit comments