CMakeLists.txt 4.39 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
  pal_hardware_interfaces
Olivier Stasse's avatar
Olivier Stasse committed
25
26
27
28
  temperature_sensor_controller
  controller_interface
  controller_manager
  pal_common_msgs
Olivier Stasse's avatar
Olivier Stasse committed
29
30
31
32
33
  roscpp
  std_msgs
  dynamic_graph_bridge
  control_msgs
  sensor_msgs
Olivier Stasse's avatar
Olivier Stasse committed
34
35
36
37
38
39
40
41
42
43
44
45
  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
46
47
)

48
49
50
51
52
53
## 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
54
include_directories(include tests ${bullet_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
Olivier Stasse's avatar
Olivier Stasse committed
55
56
57

link_directories(${bullet_LIBRARY_DIRS})

Olivier Stasse's avatar
Olivier Stasse committed
58
59
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

60
61
SETUP_PROJECT()

62
63
64
65
66
67
68
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
Olivier Stasse's avatar
Olivier Stasse committed
69
70
71
72
#add_project_dependency(dynamic_graph_bridge REQUIRED)
add_project_dependency(dynamic-graph REQUIRED)
add_project_dependency(dynamic-graph-python REQUIRED)
add_project_dependency(sot-core REQUIRED)
Olivier Stasse's avatar
Olivier Stasse committed
73
add_required_dependency("pinocchio")
74

Olivier Stasse's avatar
Olivier Stasse committed
75
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
83
84
85
  roscpp
  realtime_tools
  message_runtime
  dynamic_graph_bridge
  pal_hardware_interfaces
  controller_interface controller_manager
Olivier Stasse's avatar
Olivier Stasse committed
86
LIBRARIES ${CATKIN_DEPENDS_LIBRARIES} )
Olivier Stasse's avatar
Olivier Stasse committed
87

88
# Detect the controller interface version to switch code
Olivier Stasse's avatar
Olivier Stasse committed
89
90
if(controller_interface_FOUND)
  if (${controller_interface_VERSION} VERSION_GREATER "0.2.5")
91
    add_definitions(-DCONTROLLER_INTERFACE_KINETIC)
Olivier Stasse's avatar
Olivier Stasse committed
92
93
  endif(${controller_interface_VERSION} VERSION_GREATER "0.2.5")
endif(controller_interface_FOUND)
94

Olivier Stasse's avatar
Olivier Stasse committed
95
96
97
98
LIST(APPEND LOGGING_WATCHED_VARIABLES
  CONTROLLER_INTERFACE_FOUND
  CONTROLLER_INTERFACE_VERSION )
  
99
100
101
102
103
104
# 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)

105

Olivier Stasse's avatar
Olivier Stasse committed
106
107
108
109
110
111
112
###########
## 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
113
include_directories(
Olivier Stasse's avatar
Olivier Stasse committed
114
115
116
117
  ${catkin_INCLUDE_DIRS}
  )

## Declare a C++ library
Guilhem Saurel's avatar
Guilhem Saurel committed
118
add_library(rcsot_controller
Olivier Stasse's avatar
Olivier Stasse committed
119
120
121
122
123
124
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
125
126
# add_dependencies(roscontrol_sot_node ${${PROJECT_NAME}_EXPORTED_TARGETS}
#     ${catkin_EXPORTED_TARGETS})
Olivier Stasse's avatar
Olivier Stasse committed
127
128
129
130
131
132
133

## 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
134
135
136
#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
137
138

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

141
142
143
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
144
145
146
147
148
149
150

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

Olivier Stasse's avatar
Olivier Stasse committed
151

Olivier Stasse's avatar
Olivier Stasse committed
152
153
ADD_SUBDIRECTORY(tests)

Olivier Stasse's avatar
Olivier Stasse committed
154
155
156
157
158
159
160
161
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
  LIST(APPEND LOGGING_WATCHED_VARIABLES
    ${_variableName}
    )
endforeach()

162
SETUP_PROJECT_FINALIZE()
Olivier Stasse's avatar
Olivier Stasse committed
163