CMakeLists.txt 4.28 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
set(CXX_DISABLE_WERROR True)

9
10
set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} -Werror=format-security")

11
12
13
14
15
include(cmake/base.cmake)
include(cmake/ros.cmake)
include(cmake/GNUInstallDirs.cmake)
include(cmake/python.cmake)

Olivier Stasse's avatar
Olivier Stasse committed
16
17
18
19
project(roscontrol_sot)

find_package(PkgConfig REQUIRED)

20
add_required_dependency(bullet)
21
add_required_dependency("urdfdom")
22

Olivier Stasse's avatar
Olivier Stasse committed
23
SET(CATKIN_REQUIRED_COMPONENTS
24
25
  pal_hardware_interfaces
  controller_interface  
Olivier Stasse's avatar
Olivier Stasse committed
26
27
28
29
30
  roscpp
  std_msgs
  dynamic_graph_bridge
  control_msgs
  sensor_msgs
Olivier Stasse's avatar
Olivier Stasse committed
31
32
33
34
35
36
37
38
39
40
41
42
  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
43
44
)

45
46
47
48
49
50
## LAAS cmake submodule part
set(PROJECT_DESCRIPTION "Integration of the Stack of Tasks in roscontrol")
set(PROJECT_NAME roscontrol_sot)
set(PROJECT_URL "https://github.com/stack-of-tasks/roscontrol_sot")


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

link_directories(${bullet_LIBRARY_DIRS})

55
56
SETUP_PROJECT()

57
58
59
60
61
62
63
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_INSTALL_RPATH "${LIBRARY_OUTPUT_PATH}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${LIBRARY_OUTPUT_PATH}")

# Add dependency through jrl-cmakemodules to compile
# this code without catkin_make
64
65
add_required_dependency("pal_hardware_interfaces")
add_optional_dependency("temperature_sensor_controller")
66
67
68
69
add_required_dependency(roscpp)
add_required_dependency("realtime_tools >= 1.8")
add_required_dependency("dynamic_graph_bridge")
add_required_dependency("controller_interface")
Olivier Stasse's avatar
Olivier Stasse committed
70
add_required_dependency("controller_manager")
71
72
add_required_dependency("pal_common_msgs")
add_required_dependency("dynamic-graph")
Olivier Stasse's avatar
Olivier Stasse committed
73
74
75
add_required_dependency("dynamic-graph-python")
add_required_dependency("sot-core")
add_required_dependency("pinocchio")
76

Olivier Stasse's avatar
Olivier Stasse committed
77
78
# This is necessary so that the pc file generated by catking is similar
# to the on done directly by jrl-cmake-modules
79
catkin_package(CATKIN_DEPENDS
Olivier Stasse's avatar
Olivier Stasse committed
80
81
82
  roscpp realtime_tools message_runtime dynamic_graph_bridge
  pal_hardware_interfaces controller_interface controller_manager
LIBRARIES ${CATKIN_DEPENDS_LIBRARIES} )
Olivier Stasse's avatar
Olivier Stasse committed
83

84
# Detect the controller interface version to switch code
85
86
87
88
89
90
if(CONTROLLER_INTERFACE_FOUND)
  if (${CONTROLLER_INTERFACE_VERSION} VERSION_GREATER "0.2.5")
    add_definitions(-DCONTROLLER_INTERFACE_KINETIC)
  endif(${CONTROLLER_INTERFACE_VERSION} VERSION_GREATER "0.2.5")
endif(CONTROLLER_INTERFACE_FOUND)

91
92
93
94
95
96
# Detect if temperature sensor controller package is found
# if yes then it is a PARL Robotics Forked code.
if(TEMPERATURE_SENSOR_CONTROLLER_FOUND)
  add_definitions(-DTEMPERATURE_SENSOR_CONTROLLER)
endif(TEMPERATURE_SENSOR_CONTROLLER_FOUND)

97

Olivier Stasse's avatar
Olivier Stasse committed
98
99
100
101
102
103
104
###########
## 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
105
include_directories(
Olivier Stasse's avatar
Olivier Stasse committed
106
107
108
109
  ${catkin_INCLUDE_DIRS}
  )

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

## 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
129
pkg_config_use_dependency(rcsot_controller urdfdom optional
  NO_INCLUDE_SYSTEM)
pkg_config_use_dependency(rcsot_controller dynamic-graph optional
  NO_INCLUDE_SYSTEM)
Olivier Stasse's avatar
Olivier Stasse committed
130
131

## Mark executables and/or libraries for installation
132
install(TARGETS rcsot_controller DESTINATION lib )
Olivier Stasse's avatar
Olivier Stasse committed
133

134
135
136
ADD_EXECUTABLE(roscontrol-sot-parse-log
  src/roscontrol-sot-parse-log.cc)
install(TARGETS roscontrol-sot-parse-log DESTINATION bin )
Olivier Stasse's avatar
Olivier Stasse committed
137
138
139
140
141
142
143

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

Olivier Stasse's avatar
Olivier Stasse committed
144

Olivier Stasse's avatar
Olivier Stasse committed
145
146
ADD_SUBDIRECTORY(tests)

147
SETUP_PROJECT_FINALIZE()