CMakeLists.txt 3.88 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
24
25
26
27

## 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
28
29
  pal_hardware_interfaces
  controller_interface  
Olivier Stasse's avatar
Olivier Stasse committed
30
31
32
33
34
35
36
37
38
  roscpp
  rospy
  std_msgs
  dynamic_graph_bridge
  control_msgs
  sensor_msgs
  realtime_tools
)

39
40
41
42
43
44
## 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
45
46
47
48
include_directories(include ${bullet_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})

link_directories(${bullet_LIBRARY_DIRS})

49
50
SETUP_PROJECT()

51
52
53
54
55
56
57
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
58
59
add_required_dependency("pal_hardware_interfaces")
add_optional_dependency("temperature_sensor_controller")
60
61
62
63
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
64
add_required_dependency("controller_manager")
65
66
add_required_dependency("pal_common_msgs")
add_required_dependency("dynamic-graph")
67

68
69
70
# This is necessary so that the pc file generated by catking is similar to the on
# done directly by jrl-cmake-modules
catkin_package(CATKIN_DEPENDS
Olivier Stasse's avatar
Olivier Stasse committed
71
roscpp realtime_tools message_runtime dynamic_graph_bridge pal_hardware_interfaces controller_interface controller_manager
72
LIBRARIES rcsot_controller)
Olivier Stasse's avatar
Olivier Stasse committed
73

74
# Detect the controller interface version to switch code
75
76
77
78
79
80
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)

81
82
83
84
85
86
# 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)

87

Olivier Stasse's avatar
Olivier Stasse committed
88
89
90
91
92
93
94
###########
## 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
95
include_directories(
Olivier Stasse's avatar
Olivier Stasse committed
96
97
98
99
  ${catkin_INCLUDE_DIRS}
  )

## Declare a C++ library
Guilhem Saurel's avatar
Guilhem Saurel committed
100
add_library(rcsot_controller
Olivier Stasse's avatar
Olivier Stasse committed
101
102
103
104
105
106
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
107
108
# add_dependencies(roscontrol_sot_node ${${PROJECT_NAME}_EXPORTED_TARGETS}
#     ${catkin_EXPORTED_TARGETS})
Olivier Stasse's avatar
Olivier Stasse committed
109
110
111
112
113
114
115

## 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
116
117
118
119
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
120
121

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

124
125
126
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
127
128
129
130
131
132
133

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

Olivier Stasse's avatar
Olivier Stasse committed
134
135
ADD_SUBDIRECTORY(tests)

136
SETUP_PROJECT_FINALIZE()