CMakeLists.txt 3.16 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

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

51
ADD_PROJECT_DEPENDENCY(dynamic-graph-python 4.0.0 REQUIRED)
52
53
54
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
if(controller_interface_FOUND)
Guilhem Saurel's avatar
Guilhem Saurel committed
59
  if(${controller_interface_VERSION} VERSION_GREATER "0.2.5")
60
    add_definitions(-DCONTROLLER_INTERFACE_KINETIC)
Guilhem Saurel's avatar
Guilhem Saurel committed
61
62
63
64
65
    if(${controller_interface_VERSION} VERSION_GREATER "0.19.0")
      add_definitions(-DCONTROLLER_INTERFACE_NOETIC)
    endif()
  endif()
endif()
66

67
# Detect if temperature sensor controller package is found
68
# if yes then it is a PAL Robotics Forked code.
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
  )
74
75
76
77
78
79
80
81
target_include_directories(rcsot_controller SYSTEM PUBLIC
  ${catkin_INCLUDE_DIRS}
  $<INSTALL_INTERFACE:include>)
target_link_libraries(rcsot_controller
  ${catkin_LIBRARIES}
  ${bullet_LIBRARIES}
  sot-core::sot-core
  dynamic_graph_bridge::sot_loader
82
  ${control_toolbox_LIBRARIES})
Guilhem Saurel's avatar
Guilhem Saurel committed
83
if(temperature_sensor_controller_FOUND)
84
85
86
87
88
  target_compile_definitions(rcsot_controller PUBLIC TEMPERATURE_SENSOR_CONTROLLER)
  message("temperature_sensor_controller_LIBRARIES: ${temperature_sensor_controller_LIBRARIES}")
  target_include_directories(rcsot_controller SYSTEM PUBLIC ${temperature_sensor_controller_INCLUDE_DIRS})
  target_link_libraries(rcsot_controller ${temperature_sensor_controller_LIBRARIES})
endif()
Olivier Stasse's avatar
Olivier Stasse committed
89

90
IF(SUFFIX_SO_VERSION)
Guilhem Saurel's avatar
Guilhem Saurel committed
91
  SET_TARGET_PROPERTIES(rcsot_controller PROPERTIES SOVERSION ${PROJECT_VERSION})
92
ENDIF(SUFFIX_SO_VERSION)
Olivier Stasse's avatar
Olivier Stasse committed
93

94
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Guilhem Saurel's avatar
Guilhem Saurel committed
95
  INSTALL(TARGETS rcsot_controller EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
96
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Olivier Stasse's avatar
Olivier Stasse committed
97

98
99
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
100
101

foreach(dir config launch)
102
103
  install(DIRECTORY ${dir} DESTINATION share/${PROJECT_NAME})
endforeach(dir)
Olivier Stasse's avatar
Olivier Stasse committed
104

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