CMakeLists.txt 3.69 KB
Newer Older
1
# Copyright (C) 2017-2018 LAAS-CNRS
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#
# Author: Olivier Stasse
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Olivier Stasse's avatar
Olivier Stasse committed
17
cmake_minimum_required(VERSION 2.8.3)
18
19
20
21
22
23

include(cmake/base.cmake)
include(cmake/ros.cmake)
include(cmake/GNUInstallDirs.cmake)
include(cmake/python.cmake)

Olivier Stasse's avatar
Olivier Stasse committed
24
25
26
27
project(roscontrol_sot)

find_package(PkgConfig REQUIRED)

28
29
30
31
add_required_dependency(bullet)

#set(bullet_FOUND 0)
#pkg_check_modules(bullet REQUIRED bullet)
Olivier Stasse's avatar
Olivier Stasse committed
32
33
34
35
36
37
38
39
40
41
42
43
44

## 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
45
  pal_hardware_interfaces
Olivier Stasse's avatar
Olivier Stasse committed
46
47
)

48
49
50
51
52
53
54
## 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")

set(CXX_DISABLE_WERROR False)

Olivier Stasse's avatar
Olivier Stasse committed
55
56
57
58
include_directories(include ${bullet_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})

link_directories(${bullet_LIBRARY_DIRS})

59
60
SETUP_PROJECT()

61
62
63
64
65
66
67
68
69
70
71
72
73
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")

74
75
76
# 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
77
roscpp realtime_tools message_runtime dynamic_graph_bridge pal_hardware_interfaces controller_interface
78
LIBRARIES rcsot_controller)
Olivier Stasse's avatar
Olivier Stasse committed
79

80
81
82
83
84
85
86
87
# Detect the prf-ros-control version to switch code
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)


Olivier Stasse's avatar
Olivier Stasse committed
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories( 
  ${catkin_INCLUDE_DIRS}
  )

## Declare a C++ library
add_library(rcsot_controller 
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}
  )


## Mark executables and/or libraries for installation
117
install(TARGETS rcsot_controller DESTINATION lib )
Olivier Stasse's avatar
Olivier Stasse committed
118
119
120
121
122
123
124
125


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

126
SETUP_PROJECT_FINALIZE()
Olivier Stasse's avatar
Olivier Stasse committed
127
128