forked from jrl-umi3218/mc_rtc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
172 lines (138 loc) · 5.52 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#
# Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
#
cmake_minimum_required(VERSION 3.1)
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
set(PROJECT_NAME mc_rtc)
set(PROJECT_DESCRIPTION mc_rtc)
set(PROJECT_VERSION 1.5.1)
set(PROJECT_URL https://gite.lirmm.fr/multi-contact/mc_rtc)
set(PROJECT_DEBUG_POSTFIX "_d")
set(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)
set(PROJECT_USE_CMAKE_EXPORT TRUE)
set(DOXYGEN_USE_MATHJAX "YES")
set(CXX_DISABLE_WERROR 1)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
include(cmake/base.cmake)
include(cmake/cython/cython.cmake)
include(cmake/msvc-specific.cmake)
include(cmake/version-script.cmake)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
project(${PROJECT_NAME} C CXX)
option(GENERATE_COVERAGE "Generate coverage data" FALSE)
if("${CMAKE_CXX_FLAGS}" MATCHES "--coverage")
set(GENERATE_COVERAGE TRUE CACHE BOOL "Generate coverage data" FORCE)
string(REPLACE "--coverage" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "--coverage" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
string(REPLACE "--coverage" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
endif()
option(TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
option(BUILD_CONTROLLER_SAMPLES "Build sample controllers in the project" ON)
option(DISABLE_CONTROLLER_TESTS "Disable controller unit tests" OFF)
option(DISABLE_ROBOT_TESTS "Disable RobotModule unit tests" OFF)
option(ENABLE_FAST_TESTS "Run controllers tests for a few iterations" OFF)
option(BUILD_BENCHMARKS "Build benchmarks" OFF)
option(DISABLE_ROS "Do not build with ROS support (even if ROS was found)" OFF)
add_project_dependency(Boost REQUIRED COMPONENTS filesystem timer)
add_project_dependency(Tasks REQUIRED)
add_project_dependency(mc_rbdyn_urdf REQUIRED)
if(NOT TARGET RBDyn::Parsers)
message(FATAL_ERROR "RBDyn must be built with parsers support")
endif()
add_project_dependency(eigen-quadprog REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
# hpp-spline (defines target: mc_rtc_3rd_party::hpp-spline)
find_package(mc_rtc_3rd_party_hpp-spline REQUIRED)
# LTDL (defines target: mc_rtc_3rd_party::ltdl)
add_subdirectory(3rd-party/ltdl)
# GEOS (defines/imports target: GEOS::geos)
find_package(mc_rtc_3rd_party_geos REQUIRED)
# nanomsg (defines/imports target: nanomsg)
find_package(mc_rtc_3rd_party_nanomsg REQUIRED)
# qhull (build re-entrant static version)
add_subdirectory(3rd-party/qhull)
# mpack (build static version)
add_subdirectory(3rd-party/mpack)
# yaml-cpp
add_project_dependency(yaml-cpp 0.5.0 REQUIRED)
# RapidJSON
# The code was copied from the 1.1.0 release tarball for RapidJSON
# https://github.com/miloyip/rapidjson
add_library(mc_rtc_3rd_party::RapidJSON INTERFACE IMPORTED)
set_target_properties(mc_rtc_3rd_party::RapidJSON PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/3rd-party/RapidJSON
)
# spdlog
add_project_dependency(spdlog 1.6.1 REQUIRED)
macro(find_description_package PACKAGE)
set(PACKAGE_PATH_VAR "${PACKAGE}_PATH")
string(TOUPPER "${PACKAGE_PATH_VAR}" PACKAGE_PATH_VAR)
find_package(${PACKAGE} REQUIRED)
if("${${PACKAGE}_INSTALL_PREFIX}" STREQUAL "")
if("${${PACKAGE}_SOURCE_PREFIX}" STREQUAL "")
message(FATAL_ERROR "Your ${PACKAGE} does not define where to find the data, please update.")
else()
set(${PACKAGE_PATH_VAR} "${${PACKAGE}_SOURCE_PREFIX}")
endif()
else()
set(${PACKAGE_PATH_VAR} "${${PACKAGE}_INSTALL_PREFIX}")
endif()
# Cleanup the path provided by CMake
get_filename_component(${PACKAGE_PATH_VAR} "${${PACKAGE_PATH_VAR}}" REALPATH)
message("-- Found ${PACKAGE}: ${${PACKAGE_PATH_VAR}}")
endmacro()
find_description_package(mc_env_description)
find_description_package(mc_int_obj_description)
set(MC_PLUGINS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib/mc_plugins)
set(MC_ROBOTS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib/mc_robots)
set(MC_OBSERVERS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib/mc_observers)
set(MC_CONTROLLER_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib/mc_controller)
configure_file(${PROJECT_SOURCE_DIR}/include/mc_rtc/config.h.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/include/mc_rtc/config.h)
# For MSVC, set local environment variable to enable finding the built dll
# of the main library when launching ctest with RUN_TESTS
if(MSVC)
set(CMAKE_MSVCIDE_RUN_PATH "\$(SolutionDir)/3rd-party/ltdl/\$(Configuration);\$(SolutionDir)/src/\$(Configuration);\$(SolutionDir)/src/mc_control/fsm/\$(Configuration)")
endif(MSVC)
include(CMakeModules/ListAllFiles.cmake)
add_subdirectory(CMakeModules)
add_subdirectory(doc)
add_subdirectory(src)
add_subdirectory(plugins)
if(${BUILD_TESTING})
add_subdirectory(tests)
endif()
if(${BUILD_BENCHMARKS})
add_subdirectory(benchmarks)
endif()
add_subdirectory(utils)
if(${PYTHON_BINDING})
add_subdirectory(binding/python)
endif()
install(DIRECTORY include ${CMAKE_BINARY_DIR}/include
DESTINATION ${CMAKE_INSTALL_PREFIX}
FILES_MATCHING REGEX "h(pp)?$")
file(GLOB data_files "data/*.json")
install(
FILES
${data_files}
DESTINATION share/mc_rtc
)
install(
FILES
etc/mc_rtc.yaml
DESTINATION etc
)
# Extra macros for mc_rtc
install(FILES "src/mc_rtcMacros.cmake"
DESTINATION "${CONFIG_INSTALL_DIR}")
set(PACKAGE_EXTRA_MACROS "${PACKAGE_EXTRA_MACROS}
include(\"\${CMAKE_CURRENT_LIST_DIR}/mc_rtcMacros.cmake\")
include(\"\${CMAKE_CURRENT_LIST_DIR}/mc_rtc_fsm_states.cmake\")
include(\"\${CMAKE_CURRENT_LIST_DIR}/mc_rtc_observers.cmake\")")