-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
133 lines (109 loc) · 5.47 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
cmake_minimum_required(VERSION 3.1)
project(UnicyclePlanner
LANGUAGES CXX
VERSION 0.8.0)
# Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful macros
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs)
# ouptut paths
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(WIN32)
# MSVC standard library doesn't include things like M_PI_2 without this
add_definitions(-D_USE_MATH_DEFINES)
endif()
# Build shared libs
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" ON)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Enable C++14
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# include macros for warnings
include(AddWarningsConfigurationToTargets)
include(CMakePackageConfigHelpers)
option(ENABLE_RPATH "Enable RPATH for this library" ON)
mark_as_advanced(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 ENABLE_RPATH
USE_LINK_PATH)
# Encourage user to specify a build type (e.g. Release, Debug, etc.), otherwise set it to Release.
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
endif()
endif()
find_package(iDynTree 10.0.0 REQUIRED)
find_package(Eigen3 REQUIRED)
set(UCPLANNER_SOURCES src/ControlledUnicycle.cpp
src/UnicyclePlanner.cpp
src/UnicycleBaseController.cpp
src/PersonFollowingController.cpp
src/UnicycleDirectController.cpp
src/UnicycleOptimization.cpp
src/UnicycleFoot.cpp
src/FootPrint.cpp
src/FeetGenerator.cpp
src/FeetCubicSplineGenerator.cpp
src/UnicycleGenerator.cpp
src/ZMPTrajectoryGenerator.cpp
src/CoMHeightTrajectoryGenerator.cpp
src/DCMTrajectoryGenerator.cpp
src/DCMTrajectoryGeneratorHelper.cpp
src/FeetMinimumJerkGenerator.cpp
src/FreeSpaceEllipse.cpp
src/UnicycleNavigationController.cpp)
set(UCPLANNER_HEADERS include/ControlledUnicycle.h
include/UnicycleBaseController.h
include/PersonFollowingController.h
include/UnicycleDirectController.h
include/UnicycleOptimization.h
include/UnicycleFoot.h
include/FootPrint.h
include/UnicyclePlanner.h
include/FeetGenerator.h
include/FeetCubicSplineGenerator.h
include/UnicycleGenerator.h
include/ZMPTrajectoryGenerator.h
include/CoMHeightTrajectoryGenerator.h
include/StepPhase.h
include/DCMTrajectoryGenerator.h
include/DCMTrajectoryGeneratorHelper.h
include/FeetMinimumJerkGenerator.h
include/FreeSpaceEllipse.h
include/UnicycleState.h
include/UnicycleNavigationController.h)
add_library(UnicyclePlanner ${UCPLANNER_HEADERS} ${UCPLANNER_SOURCES})
target_include_directories(UnicyclePlanner PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_include_directories(UnicyclePlanner PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(UnicyclePlanner Eigen3::Eigen ${iDynTree_LIBRARIES})
set_property(TARGET UnicyclePlanner PROPERTY PUBLIC_HEADER ${UCPLANNER_HEADERS})
target_compile_features(UnicyclePlanner PUBLIC cxx_attribute_deprecated)
# install
install(TARGETS UnicyclePlanner
EXPORT unicycle_planner
COMPONENT runtime
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT unicycle_planner
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/UnicyclePlanner)
configure_package_config_file(${CMAKE_SOURCE_DIR}/cmake/unicyclePlannerConfig.cmake.in
${CMAKE_BINARY_DIR}/UnicyclePlannerConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/UnicyclePlanner)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/UnicyclePlannerConfigVersion.cmake VERSION ${UnicyclePlanner_VERSION} COMPATIBILITY SameMajorVersion )
install(FILES ${CMAKE_BINARY_DIR}/UnicyclePlannerConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/UnicyclePlannerConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/UnicyclePlanner)
include(AddUninstallTarget)
include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()