This repository has been archived by the owner on Apr 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
146 lines (114 loc) · 5.87 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright: (C) 2013 CoDyCo Consortium
# Authors: Andrea Del Prete
# CopyPolicy: Released under the terms of the GNU GPL v2.0 (or any later version).
cmake_minimum_required(VERSION 2.8.11)
project(yarpWholeBodyInterface CXX)
set(LIBRARY_NAME yarpwholebodyinterface)
set(VARS_PREFIX ${PROJECT_NAME})
set(INCLUDE_DIRS yarpWholeBodyInterface)
set(${VARS_PREFIX}_MAJOR_VERSION 0)
set(${VARS_PREFIX}_MINOR_VERSION 3)
set(${VARS_PREFIX}_PATCH_VERSION 6)
set(${VARS_PREFIX}_VERSION ${${VARS_PREFIX}_MAJOR_VERSION}.${${VARS_PREFIX}_MINOR_VERSION}.${${VARS_PREFIX}_PATCH_VERSION})
find_package(YCM REQUIRED)
include(YCMDefaultDirs)
ycm_default_dirs(${VARS_PREFIX})
option(BUILD_SHARED_LIBS "Compile the library as a shared library" TRUE)
mark_as_advanced(BUILD_SHARED_LIBS)
option(YARPWBI_USES_KDL "Compile the parts of yarp-wholebodyinterface that depend on KDL" TRUE)
option(YARPWBI_ENABLE_TESTS "Enable unit testing" FALSE)
find_package(YARP REQUIRED)
set(YARP_REQUIRED_VERSION 2.3.63.7)
if(${YARP_VERSION} VERSION_LESS ${YARP_REQUIRED_VERSION})
message(FATAL_ERROR "YARP version ${YARP_VERSION} not sufficient, at least version ${YARP_REQUIRED_VERSION} is required.")
endif()
if (${YARP_VERSION} VERSION_LESS 2.3.69.8)
add_definitions(-DYARPWBI_YARP_HAS_LEGACY_IOPENLOOP)
endif ()
find_package(iDynTree 0.3.14 REQUIRED)
find_package(ICUB REQUIRED)
find_package(wholeBodyInterface 0.2.6 REQUIRED)
find_package(Eigen3 REQUIRED)
set(folder_source src/yarpWbiUtil.cpp
src/yarpWholeBodyInterface.cpp
src/yarpWholeBodyModelV2.cpp
src/yarpWholeBodyStates.cpp
src/floatingBaseEstimators.cpp
src/yarpWholeBodyActuators.cpp
src/yarpWholeBodySensors.cpp
src/PIDList.cpp)
if (YARPWBI_USES_KDL)
list(APPEND folder_source src/yarpWholeBodyModelV1.cpp)
endif ()
set(folder_header include/yarpWholeBodyInterface/yarpWholeBodyInterface.h
include/yarpWholeBodyInterface/yarpWholeBodyModelV2.h
include/yarpWholeBodyInterface/yarpWholeBodyModel.h
include/yarpWholeBodyInterface/yarpWholeBodyStates.h
include/yarpWholeBodyInterface/yarpWholeBodyActuators.h
include/yarpWholeBodyInterface/yarpWholeBodySensors.h
include/yarpWholeBodyInterface/floatingBaseEstimators.h
include/yarpWholeBodyInterface/yarpWbiUtil.h
include/yarpWholeBodyInterface/PIDList.h)
if (YARPWBI_USES_KDL)
list(APPEND folder_header include/yarpWholeBodyInterface/yarpWholeBodyModelV1.h)
endif ()
source_group("Source Files" FILES ${folder_source})
source_group("Header Files" FILES ${folder_header})
if (NOT ${MSVC})
add_definitions(-Wall)
endif ()
# import math symbols from standard cmath
add_definitions(-D_USE_MATH_DEFINES)
option(YARPWBI_ENABLE_RPATH "Enable RPATH for the library" TRUE)
mark_as_advanced(YARPWBI_ENABLE_RPATH)
if(MSVC)
message(STATUS "Building ${PROJECT_NAME} as a shared library is not currently supported on Windows")
set(BUILD_SHARED_LIBS FALSE)
endif()
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_PREFIX}/bin"
LIB_DIRS "${CMAKE_INSTALL_PREFIX}/lib"
DEPENDS YARPWBI_ENABLE_RPATH
USE_LINK_PATH)
add_library(${LIBRARY_NAME} ${folder_source} ${folder_header})
set_target_properties(${LIBRARY_NAME} PROPERTIES VERSION ${${VARS_PREFIX}_VERSION}
SOVERSION ${${VARS_PREFIX}_VERSION}
PUBLIC_HEADER "${folder_header}")
target_include_directories(${LIBRARY_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>")
target_include_directories(${LIBRARY_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/yarpWholeBodyInterface>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/${${VARS_PREFIX}_INSTALL_INCLUDEDIR}>")
target_include_directories(${LIBRARY_NAME} PUBLIC
${YARP_INCLUDE_DIRS}
${iDynTree_INCLUDE_DIRS}
${wholeBodyInterface_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${skinDynLib_INCLUDE_DIRS}
${ctrlLib_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} LINK_PUBLIC ${YARP_LIBRARIES}
${wholeBodyInterface_LIBRARIES}
LINK_PRIVATE ${iDynTree_LIBRARIES}
${paramHelp_LIBRARIES})
install(TARGETS ${LIBRARY_NAME}
EXPORT ${PROJECT_NAME}
RUNTIME DESTINATION "${${VARS_PREFIX}_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${${VARS_PREFIX}_INSTALL_LIBDIR}" COMPONENT shlib
ARCHIVE DESTINATION "${${VARS_PREFIX}_INSTALL_LIBDIR}" COMPONENT lib
PUBLIC_HEADER DESTINATION "${${VARS_PREFIX}_INSTALL_INCLUDEDIR}/${INCLUDE_DIRS}" COMPONENT dev)
set_property(GLOBAL APPEND PROPERTY ${VARS_PREFIX}_TARGETS ${LIBRARY_NAME})
include(InstallBasicPackageFiles)
install_basic_package_files(${PROJECT_NAME} VARS_PREFIX ${VARS_PREFIX}
VERSION ${${VARS_PREFIX}_VERSION}
COMPATIBILITY SameMajorVersion
TARGETS_PROPERTY ${VARS_PREFIX}_TARGETS
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
if(YARPWBI_ENABLE_TESTS)
#enable testing
#include(CTest)
enable_testing()
add_subdirectory(tests)
endif()
include(AddUninstallTarget)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${YARP_MODULE_PATH})
include(YarpInstallationHelpers)
yarp_configure_external_installation(codyco)
add_subdirectory(app)