-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
74 lines (63 loc) · 2.41 KB
/
CMakeLists.txt
File metadata and controls
74 lines (63 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
cmake_minimum_required(VERSION 3.5)
project(map_simulator)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(urdf REQUIRED)
find_package(tinyxml2_vendor REQUIRED)
find_package(TinyXML2 REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(OpenCV REQUIRED)
find_package(yaml-cpp REQUIRED)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if("$ENV{ROS_DISTRO}" STRLESS_EQUAL "humble")
add_definitions(-DWITH_BUILTIN_RANGE)
rosidl_generate_interfaces(${PROJECT_NAME} "srv/Spawn.srv" "srv/AddAnchor.srv" "msg/Range.msg"
DEPENDENCIES std_msgs)
else()
rosidl_generate_interfaces(${PROJECT_NAME} "srv/Spawn.srv" "srv/AddAnchor.srv")
endif()
if("$ENV{ROS_DISTRO}" STRLESS_EQUAL "galactic")
set(LEGACY_IDL TRUE)
else()
set(LEGACY_IDL FALSE)
rosidl_get_typesupport_target(cpp_typesupport_target "${PROJECT_NAME}" "rosidl_typesupport_cpp")
endif()
add_executable(simulator src/simulator.cpp src/robot.cpp src/occupancy_grid.cpp)
target_include_directories(simulator PRIVATE include
${OpenCV_INCLUDE_DIRS}
${YamlCpp_INCLUDE_DIRS})
target_link_libraries(simulator ${OpenCV_LIBRARIES} yaml-cpp stdc++fs tinyxml2)
ament_target_dependencies(simulator rclcpp sensor_msgs geometry_msgs nav_msgs tf2_ros urdf ament_index_cpp)
if(${LEGACY_IDL})
rosidl_target_interfaces(simulator ${PROJECT_NAME} "rosidl_typesupport_cpp")
else()
target_link_libraries(simulator "${cpp_typesupport_target}")
endif()
add_executable(spawn src/spawn.cpp)
ament_target_dependencies(spawn rclcpp)
if(${LEGACY_IDL})
rosidl_target_interfaces(spawn ${PROJECT_NAME} "rosidl_typesupport_cpp")
else()
target_link_libraries(spawn "${cpp_typesupport_target}")
endif()
install(TARGETS simulator spawn
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY launch example
DESTINATION share/${PROJECT_NAME})
install(PROGRAMS src/kinematics.py
DESTINATION lib/${PROJECT_NAME})
ament_package()