CMakeLists.txt 2.92 KB
Newer Older
1
# Copyright (C) 2017-2020 LAAS-CNRS
2
3
#
# Author: Olivier Stasse
4
# Author: Guilhem Saurel
5
#
6
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
7

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

14
# Project options
Olivier Stasse's avatar
Olivier Stasse committed
15

16
17
# Project configuration
SET(CXX_DISABLE_WERROR True)
18
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
Olivier Stasse's avatar
Olivier Stasse committed
19

20
21
# JRL-cmakemodule setup
INCLUDE(cmake/base.cmake)
22
INCLUDE(cmake/boost.cmake)
23
INCLUDE(cmake/python.cmake)
24
INCLUDE(cmake/ros.cmake)
25

26
27
28
# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
29
CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
Olivier Stasse's avatar
Olivier Stasse committed
30

31
32
# Project dependencies
FINDPYTHON()
33
SEARCH_FOR_BOOST_PYTHON()
34
add_required_dependency(bullet)
35
add_required_dependency(urdfdom)
36

Olivier Stasse's avatar
Olivier Stasse committed
37
SET(CATKIN_REQUIRED_COMPONENTS
38
  temperature_sensor_controller
39
  pal_hardware_interfaces
Olivier Stasse's avatar
Olivier Stasse committed
40
41
42
  controller_interface
  controller_manager
  pal_common_msgs
Olivier Stasse's avatar
Olivier Stasse committed
43
44
45
46
  roscpp
  std_msgs
  control_msgs
  sensor_msgs
47
48
49
  realtime_tools
  rospy
  )
Olivier Stasse's avatar
Olivier Stasse committed
50

51
find_package(catkin REQUIRED COMPONENTS ${CATKIN_REQUIRED_COMPONENTS})
52

53
ADD_PROJECT_DEPENDENCY(dynamic-graph-python 4.0.0 REQUIRED)
54
55
56
ADD_PROJECT_DEPENDENCY(dynamic_graph_bridge REQUIRED)
ADD_PROJECT_DEPENDENCY(sot-core REQUIRED )
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED)
57
ADD_PROJECT_DEPENDENCY(control_toolbox REQUIRED)
Olivier Stasse's avatar
Olivier Stasse committed
58

59
# Detect the controller interface version to switch code
Olivier Stasse's avatar
Olivier Stasse committed
60
61
if(controller_interface_FOUND)
  if (${controller_interface_VERSION} VERSION_GREATER "0.2.5")
62
    add_definitions(-DCONTROLLER_INTERFACE_KINETIC)
Olivier Stasse's avatar
Olivier Stasse committed
63
64
  endif(${controller_interface_VERSION} VERSION_GREATER "0.2.5")
endif(controller_interface_FOUND)
65

66
# Detect if temperature sensor controller package is found
67
# if yes then it is a PAL Robotics Forked code.
Olivier Stasse's avatar
Olivier Stasse committed
68
if(temperature_sensor_controller_FOUND)
69
  add_definitions(-DTEMPERATURE_SENSOR_CONTROLLER)
Olivier Stasse's avatar
Olivier Stasse committed
70
endif(temperature_sensor_controller_FOUND)
71

Guilhem Saurel's avatar
Guilhem Saurel committed
72
add_library(rcsot_controller
73
74
  src/roscontrol-sot-controller.cpp
  src/log.cpp
Olivier Stasse's avatar
Olivier Stasse committed
75
  )
Guilhem Saurel's avatar
Guilhem Saurel committed
76
77
78
TARGET_INCLUDE_DIRECTORIES(rcsot_controller SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(rcsot_controller PUBLIC $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(rcsot_controller ${catkin_LIBRARIES} ${bullet_LIBRARIES}
79
80
  sot-core::sot-core dynamic_graph_bridge::sot_loader
  ${control_toolbox_LIBRARIES})
Olivier Stasse's avatar
Olivier Stasse committed
81

82
IF(SUFFIX_SO_VERSION)
Guilhem Saurel's avatar
Guilhem Saurel committed
83
  SET_TARGET_PROPERTIES(rcsot_controller PROPERTIES SOVERSION ${PROJECT_VERSION})
84
ENDIF(SUFFIX_SO_VERSION)
Olivier Stasse's avatar
Olivier Stasse committed
85

86
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Guilhem Saurel's avatar
Guilhem Saurel committed
87
  INSTALL(TARGETS rcsot_controller EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
88
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Olivier Stasse's avatar
Olivier Stasse committed
89

90
91
ADD_EXECUTABLE(roscontrol-sot-parse-log src/roscontrol-sot-parse-log.cc)
install(TARGETS roscontrol-sot-parse-log EXPORT ${TARGETS_EXPORT_NAME} DESTINATION bin)
Olivier Stasse's avatar
Olivier Stasse committed
92
93

foreach(dir config launch)
94
95
  install(DIRECTORY ${dir} DESTINATION share/${PROJECT_NAME})
endforeach(dir)
Olivier Stasse's avatar
Olivier Stasse committed
96

Olivier Stasse's avatar
Olivier Stasse committed
97
ADD_SUBDIRECTORY(tests)
98
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})