CMakeLists.txt 3.79 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
23
24

#set(bullet_FOUND 0)
#pkg_check_modules(bullet REQUIRED bullet)
Olivier Stasse's avatar
Olivier Stasse committed
25
26
27
28
29
30
31
32
33
34
35
36
37

## 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
  roscpp
  rospy
  std_msgs
  dynamic_graph_bridge
  control_msgs
  sensor_msgs
  realtime_tools
  controller_interface
38
  pal_hardware_interfaces
Olivier Stasse's avatar
Olivier Stasse committed
39
40
)

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

link_directories(${bullet_LIBRARY_DIRS})

51
52
SETUP_PROJECT()

53
54
55
56
57
58
59
60
61
62
63
64
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
add_required_dependency(roscpp)
add_required_dependency("realtime_tools >= 1.8")
add_required_dependency("dynamic_graph_bridge")
add_required_dependency("controller_interface")
add_required_dependency("pal_hardware_interfaces")
65
add_optional_dependency("temperature_sensor_controller")
66
67
add_required_dependency("pal_common_msgs")
add_required_dependency("dynamic-graph")
68

69
70
71
# 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
72
roscpp realtime_tools message_runtime dynamic_graph_bridge pal_hardware_interfaces controller_interface
73
LIBRARIES rcsot_controller)
Olivier Stasse's avatar
Olivier Stasse committed
74

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

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

88

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

## Declare a C++ library
Guilhem Saurel's avatar
Guilhem Saurel committed
101
add_library(rcsot_controller
Olivier Stasse's avatar
Olivier Stasse committed
102
103
104
105
106
107
108
109
110
111
112
113
114
115
src/roscontrol-sot-controller.cpp
src/log.cpp
)

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(roscontrol_sot_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
target_link_libraries(rcsot_controller
  ${catkin_LIBRARIES}
  ${bullet_LIBRARIES}
  )

116
pkg_config_use_dependency(rcsot_controller urdfdom)
117
pkg_config_use_dependency(rcsot_controller dynamic-graph)
Olivier Stasse's avatar
Olivier Stasse committed
118
119

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

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

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

132
SETUP_PROJECT_FINALIZE()