CMakeLists.txt 2.86 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)
Guilhem Saurel's avatar
Guilhem Saurel committed
18
SET(CMAKE_CXX_STANDARD 11)
19
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
Olivier Stasse's avatar
Olivier Stasse committed
20

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

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

30
31
# Project dependencies
FINDPYTHON()
32
add_required_dependency(bullet)
33
add_required_dependency(urdfdom)
34

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

49
find_package(catkin REQUIRED COMPONENTS ${CATKIN_REQUIRED_COMPONENTS})
50

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

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

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

Guilhem Saurel's avatar
Guilhem Saurel committed
70
add_library(rcsot_controller
71
72
  src/roscontrol-sot-controller.cpp
  src/log.cpp
Olivier Stasse's avatar
Olivier Stasse committed
73
  )
Guilhem Saurel's avatar
Guilhem Saurel committed
74
75
76
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}
77
78
  sot-core::sot-core dynamic_graph_bridge::sot_loader
  ${control_toolbox_LIBRARIES})
Olivier Stasse's avatar
Olivier Stasse committed
79

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

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

88
89
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
90
91

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

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