CMakeLists.txt 4.06 KB
Newer Older
1
# Copyright (C) 2017-2018 LAAS-CNRS
2
3
4
#
# Author: Olivier Stasse
#
Olivier Stasse's avatar
Olivier Stasse committed
5
cmake_minimum_required(VERSION 2.8.3)
6

Olivier Stasse's avatar
Olivier Stasse committed
7
8
9
SET(PROJECT_ORG stack-of-tasks)
set(PROJECT_DESCRIPTION "roscontrol_sot")
set(PROJECT_NAME roscontrol_sot)
10
set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
Olivier Stasse's avatar
Olivier Stasse committed
11
12


Olivier Stasse's avatar
Olivier Stasse committed
13
set(CXX_DISABLE_WERROR True)
Guilhem Saurel's avatar
Guilhem Saurel committed
14
SET(CMAKE_CXX_STANDARD 11)
15
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
Olivier Stasse's avatar
Olivier Stasse committed
16
17
set(CXX_DISABLE_WERROR False)

18
19
20
21
include(cmake/base.cmake)
include(cmake/ros.cmake)
include(cmake/python.cmake)

Guilhem Saurel's avatar
Guilhem Saurel committed
22
23
CMAKE_POLICY(SET CMP0048 OLD)
project(roscontrol_sot CXX)
Olivier Stasse's avatar
Olivier Stasse committed
24

25
add_required_dependency(bullet)
26
add_required_dependency("urdfdom")
27

Olivier Stasse's avatar
Olivier Stasse committed
28
SET(CATKIN_REQUIRED_COMPONENTS
29
  temperature_sensor_controller
30
  pal_hardware_interfaces
Olivier Stasse's avatar
Olivier Stasse committed
31
32
33
  controller_interface
  controller_manager
  pal_common_msgs
Olivier Stasse's avatar
Olivier Stasse committed
34
35
36
37
38
  roscpp
  std_msgs
  dynamic_graph_bridge
  control_msgs
  sensor_msgs
Olivier Stasse's avatar
Olivier Stasse committed
39
40
41
42
43
44
45
46
47
48
49
50
  realtime_tools  )

SET(CATKIN_DEPENDS_LIBRARIES ros_bridge sot_loader rcsot_controller)

SET(CATKIN_REQUIRED_COMPONENTS ${CATKIN_REQUIRED_COMPONENTS} rospy)
SET(CATKIN_DEPENDS_LIBRARIES ${CATKIN_DEPENDS_LIBRARIES} ros_interpreter)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  ${CATKIN_REQUIRED_COMPONENTS}
Olivier Stasse's avatar
Olivier Stasse committed
51
52
)

Olivier Stasse's avatar
Olivier Stasse committed
53
include_directories(include tests ${catkin_INCLUDE_DIRS} ${bullet_INCLUDE_DIRS})
Olivier Stasse's avatar
Olivier Stasse committed
54
55
56

link_directories(${bullet_LIBRARY_DIRS})

57
58
59

# Add dependency through jrl-cmakemodules to compile
# this code without catkin_make
Olivier Stasse's avatar
Olivier Stasse committed
60
#add_project_dependency(dynamic_graph_bridge REQUIRED)
Olivier Stasse's avatar
Olivier Stasse committed
61
62
63
64
add_project_dependency(dynamic-graph REQUIRED )
add_project_dependency(dynamic-graph-python REQUIRED )
add_project_dependency(sot-core REQUIRED )
add_required_dependency("pinocchio" REQUIRED)
Olivier Stasse's avatar
Olivier Stasse committed
65

Olivier Stasse's avatar
Olivier Stasse committed
66
67
# This is necessary so that the pc file generated by catking is similar
# to the on done directly by jrl-cmake-modules
68
catkin_package(CATKIN_DEPENDS
Olivier Stasse's avatar
Olivier Stasse committed
69
70
  temperature_sensor_controller
  pal_hardware_interfaces
71
  controller_interface controller_manager
Olivier Stasse's avatar
Olivier Stasse committed
72
73
74
75
  roscpp
  realtime_tools
  message_runtime
  dynamic_graph_bridge
Olivier Stasse's avatar
Olivier Stasse committed
76
LIBRARIES ${CATKIN_DEPENDS_LIBRARIES} )
Olivier Stasse's avatar
Olivier Stasse committed
77

78
# Detect the controller interface version to switch code
Olivier Stasse's avatar
Olivier Stasse committed
79
80
if(controller_interface_FOUND)
  if (${controller_interface_VERSION} VERSION_GREATER "0.2.5")
81
    add_definitions(-DCONTROLLER_INTERFACE_KINETIC)
Olivier Stasse's avatar
Olivier Stasse committed
82
83
  endif(${controller_interface_VERSION} VERSION_GREATER "0.2.5")
endif(controller_interface_FOUND)
84

85
86
# Detect if temperature sensor controller package is found
# if yes then it is a PARL Robotics Forked code.
Olivier Stasse's avatar
Olivier Stasse committed
87
if(temperature_sensor_controller_FOUND)
88
  add_definitions(-DTEMPERATURE_SENSOR_CONTROLLER)
Olivier Stasse's avatar
Olivier Stasse committed
89
endif(temperature_sensor_controller_FOUND)
90

Olivier Stasse's avatar
Olivier Stasse committed
91
92
93
94
LIST(APPEND LOGGING_WATCHED_VARIABLES
  TEMPERATURE_SENSOR_CONTROLLER_FOUND
  CONTROLLER_INTERFACE_FOUND
  CONTROLLER_INTERFACE_VERSION )
95

96

Olivier Stasse's avatar
Olivier Stasse committed
97
98
99
100
101
102
103
###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
Guilhem Saurel's avatar
Guilhem Saurel committed
104
include_directories(
Olivier Stasse's avatar
Olivier Stasse committed
105
106
107
108
  ${catkin_INCLUDE_DIRS}
  )

## Declare a C++ library
Guilhem Saurel's avatar
Guilhem Saurel committed
109
add_library(rcsot_controller
Olivier Stasse's avatar
Olivier Stasse committed
110
111
112
113
src/roscontrol-sot-controller.cpp
src/log.cpp
)

Olivier Stasse's avatar
Olivier Stasse committed
114
pkg_config_use_dependency(rcsot_controller pinocchio NO_INCLUDE_SYSTEM)
Olivier Stasse's avatar
Olivier Stasse committed
115
116
## Add cmake target dependencies of the executable
## same as for the library above
Olivier Stasse's avatar
Olivier Stasse committed
117
118
# add_dependencies(roscontrol_sot_node ${${PROJECT_NAME}_EXPORTED_TARGETS}
#     ${catkin_EXPORTED_TARGETS})
Olivier Stasse's avatar
Olivier Stasse committed
119
120
121
122
123
124
125

## Specify libraries to link a library or executable target against
target_link_libraries(rcsot_controller
  ${catkin_LIBRARIES}
  ${bullet_LIBRARIES}
  )

Olivier Stasse's avatar
Olivier Stasse committed
126
127
128
#target_link_libraries(rcsot_controller urdfdom optional
#  NO_INCLUDE_SYSTEM)
target_link_libraries(rcsot_controller dynamic-graph::dynamic-graph)
Olivier Stasse's avatar
Olivier Stasse committed
129
130

## Mark executables and/or libraries for installation
Olivier Stasse's avatar
Olivier Stasse committed
131
install(TARGETS rcsot_controller
132
  EXPORT ${TARGETS_EXPORT_NAME}
Olivier Stasse's avatar
Olivier Stasse committed
133
  DESTINATION lib )
Olivier Stasse's avatar
Olivier Stasse committed
134

135
136
ADD_EXECUTABLE(roscontrol-sot-parse-log
  src/roscontrol-sot-parse-log.cc)
Olivier Stasse's avatar
Olivier Stasse committed
137
install(TARGETS roscontrol-sot-parse-log
138
  EXPORT ${TARGETS_EXPORT_NAME}
Olivier Stasse's avatar
Olivier Stasse committed
139
  DESTINATION bin )
Olivier Stasse's avatar
Olivier Stasse committed
140
141
142
143
144
145
146

foreach(dir config launch)
  install(DIRECTORY ${dir}
    DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
  )
endforeach()

Olivier Stasse's avatar
Olivier Stasse committed
147

Olivier Stasse's avatar
Olivier Stasse committed
148
ADD_SUBDIRECTORY(tests)