-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
149 lines (115 loc) · 4.92 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
146
147
148
149
# SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(HumanDynamicsEstimation
LANGUAGES CXX
VERSION 4.1.0)
# =====================
# PROJECT CONFIGURATION
# =====================
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(BUILD_DOCS)
add_subdirectory(doc)
return()
endif()
include(GNUInstallDirs)
include(CTest)
option(HUMANSTATEPROVIDER_ENABLE_ROS1VISUALIZER "Enable the ROS 1-based RViz Human State Visualizer" OFF)
option(HUMANSTATEPROVIDER_ENABLE_VISUALIZER "Enable the iDyntree-irricht based Human State Visualizer" OFF)
find_package(robometry QUIET)
option(HUMANSTATEPROVIDER_ENABLE_LOGGER "Enable the robometry based Human Logger" ${robometry_FOUND})
option(BUILD_TESTING "Build tests" OFF)
# Find packages needed for this main CMakeLists.txt.
# Subfolders will find the dependencies they need.
find_package(YARP 3.2 REQUIRED)
find_package(YCM REQUIRED)
# Import cmake utilities
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(AddWarningsConfigurationToTarget)
# To build shared libraries in Windows, we set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to TRUE
# See https://cmake.org/cmake/help/v3.4/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.html
# See https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Shared/Dynamic or Static library?
option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Flag to enable python bindings
option(HDE_COMPILE_PYTHON_BINDINGS "Flag that enables building the bindings" OFF)
# Plugins are force to be Shared/Dynamic Library
set(YARP_FORCE_DYNAMIC_PLUGINS ON)
# Control where binaries and libraries are placed in the build folder.
# This simplifies tests running in Windows.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
if(NOT MSVC)
option(HDE_ENABLE_RPATH "Enable rpath" TRUE)
mark_as_advanced(HDE_ENABLE_RPATH)
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}"
LIB_DIRS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
DEPENDS HDE_ENABLE_RPATH
USE_LINK_PATH)
endif()
# Tweak linker flags in Linux
if(UNIX AND NOT APPLE)
get_filename_component(LINKER_BIN ${CMAKE_LINKER} NAME)
if(${LINKER_BIN} STREQUAL "ld")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--unresolved-symbols=report-all")
endif()
endif()
if(WIN32)
#Add compile definition to suppress warning related to header <experimental/filesystem>
add_compile_definitions(_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING)
endif()
# Flag to enable Paexo wearable device
option(WEARABLES_COMPILE_PYTHON_BINDINGS "Flag that enables building the bindings" OFF)
# Flag to enable XSensSuit wearable device
find_package(XsensXME QUIET)
option(ENABLE_XsensSuit "Flag that enables building XsensSuit wearable device" ${XsensXME_FOUND})
if(ENABLE_XsensSuit)
add_subdirectory(XSensMVN)
endif()
# Flag to enable Paexo wearable device
option(ENABLE_Paexo "Flag that enables building Paexo wearable device" OFF)
# Flag to enable SenseGlove wearable device
option(ENABLE_HapticGlove "Flag that enables building Haptic Sense Glove wearable device" OFF)
# Flag to enable IWearFrameVisualizer module
find_package(iDynTree QUIET)
option(ENABLE_FrameVisualizer "Flag that enables building IWearFrameVisualizer module" ${iDynTree_FOUND})
# Flag to enable IWearLogger device
find_package(robometry QUIET)
option(ENABLE_Logger "Flag that enables building Wearable Logger device" ${robometry_FOUND})
# Flag to enable ICub wearable device
option(ENABLE_ICub "Flag that enables building iCub wearable device" ${iDynTree_FOUND})
# Add the uninstall target
include(AddUninstallTarget)
# ===================
# PROJECT DIRECTORIES
# ===================
include(InstallBasicPackageFiles)
yarp_configure_plugins_installation(hde)
add_subdirectory(conf)
add_subdirectory(msgs)
add_subdirectory(interfaces)
add_subdirectory(impl)
add_subdirectory(devices)
add_subdirectory(wrappers)
add_subdirectory(app)
add_subdirectory(modules)
add_subdirectory(servers)
add_subdirectory(clients)
if(HUMANSTATEPROVIDER_ENABLE_ROS1VISUALIZER)
add_subdirectory(publishers)
endif()
add_subdirectory(bindings)
add_subdirectory(HumanDynamicsEstimationLibrary)
install_basic_package_files(${PROJECT_NAME}
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion
VARS_PREFIX ${PROJECT_NAME}
NO_CHECK_REQUIRED_COMPONENTS_MACRO
DEPENDENCIES YARP)
# Add the uninstall target
include(AddUninstallTarget)