-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
executable file
·147 lines (117 loc) · 3.98 KB
/
CMakeLists.txt
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
cmake_minimum_required(VERSION 3.5)
project(universal_robot_ign)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# ros package
find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(trajectory_msgs REQUIRED)
# ignition package
message(WARNING "$ENV{IGNITION_VERSION}")
# Citadel
if("$ENV{IGNITION_VERSION}" STREQUAL "citadel")
find_package(ignition-gazebo3 REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo3_VERSION_MAJOR})
find_package(ignition-transport8 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport8_VERSION_MAJOR})
find_package(ignition-msgs5 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs5_VERSION_MAJOR})
message(STATUS "Compiling against Ignition Citadel")
# Dome
elseif("$ENV{IGNITION_VERSION}" STREQUAL "dome")
find_package(ignition-gazebo4 REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo4_VERSION_MAJOR})
find_package(ignition-transport9 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport9_VERSION_MAJOR})
find_package(ignition-msgs6 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs6_VERSION_MAJOR})
message(STATUS "Compiling against Ignition Dome")
# Fortress
elseif("$ENV{IGNITION_VERSION}" STREQUAL "fortress")
find_package(ignition-gazebo6 REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo6_VERSION_MAJOR})
find_package(ignition-transport11 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport11_VERSION_MAJOR})
find_package(ignition-msgs8 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs8_VERSION_MAJOR})
message(STATUS "Compiling against Ignition Fortress")
# Default to Edifice
else()
find_package(ignition-gazebo5 REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo5_VERSION_MAJOR})
find_package(ignition-transport10 REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport10_VERSION_MAJOR})
find_package(ignition-msgs7 REQUIRED)
set(IGN_MSGS_VER ${ignition-msgs7_VERSION_MAJOR})
message(STATUS "Compiling against Ignition Fortress")
endif()
# include
include_directories(include)
# generate universal_robot_ign lib
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR}/src DIR_SRCS)
add_library(${PROJECT_NAME} ${DIR_SRCS})
ament_target_dependencies(${PROJECT_NAME}
rclcpp
std_msgs
sensor_msgs
trajectory_msgs
)
target_link_libraries(${PROJECT_NAME}
ignition-msgs${IGN_MSGS_VER}::core
ignition-transport${IGN_TRANSPORT_VER}::core
)
#executable node
add_executable(joint_state_publisher src/joint_state_publisher_main.cpp)
target_link_libraries(joint_state_publisher ${PROJECT_NAME})
add_executable(joint_controller src/joint_controller_main.cpp)
target_link_libraries(joint_controller ${PROJECT_NAME})
# for ignition-gazebo plugin RobotiqController
add_library(RobotiqController SHARED plugins/robotiq_controller/RobotiqController.cpp)
target_link_libraries(RobotiqController
ignition-gazebo${IGN_GAZEBO_VER}::ignition-gazebo${IGN_GAZEBO_VER}
)
#install
install( DIRECTORY
ign launch resource
DESTINATION share/${PROJECT_NAME}
)
# Install include directories
install(DIRECTORY include/
DESTINATION include
)
# Install libraries
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
# Install executables
install(TARGETS joint_state_publisher joint_controller
DESTINATION lib/${PROJECT_NAME}
)
install(TARGETS RobotiqController
DESTINATION $ENV{HOME}/.ignition/gazebo/plugins
)
# Install executable scripts
install(PROGRAMS
scripts/moveit2.py
scripts/test_pose_goal.py
scripts/test_gripper.py
DESTINATION lib/${PROJECT_NAME})
#environment
ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/ignition.dsv.in")
#test
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()