CMakeLists.txt 6.09 KB
Newer Older
1
2
# Copyright 2010, 2020, Olivier Stasse, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
# See LICENSE file.
Thomas Moulard's avatar
Thomas Moulard committed
3

4
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
Thomas Moulard's avatar
Thomas Moulard committed
5

6
# Project properties
Olivier Stasse's avatar
Olivier Stasse committed
7
SET(PROJECT_ORG stack-of-tasks)
Thomas Moulard's avatar
Thomas Moulard committed
8
9
SET(PROJECT_NAME jrl-walkgen)
SET(PROJECT_DESCRIPTION "Walking pattern generator for Humanoids")
10
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
Thomas Moulard's avatar
Thomas Moulard committed
11

12
13
14
15
# Project options
OPTION(USE_LSSOL "Do you want to use the solver lssol?" OFF)
OPTION(USE_QUADPROG "Do you want to use the solver eigen-quadprog?" ON)
OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
Olivier Stasse's avatar
Olivier Stasse committed
16

17
18
19
# Project configuration
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
SET(CXX_DISABLE_WERROR TRUE)
Guilhem Saurel's avatar
Guilhem Saurel committed
20
SET(DOXYGEN_USE_MATHJAX YES)
Thomas Moulard's avatar
Thomas Moulard committed
21

22
# JRL-cmakemodule setup
Olivier Stasse's avatar
Olivier Stasse committed
23
24
INCLUDE(cmake/base.cmake)

25
26
27
# Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX C)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
Olivier Stasse's avatar
Olivier Stasse committed
28

29
30
31
# Project dependencies
ADD_PROJECT_DEPENDENCY(LAPACK REQUIRED)
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED PKG_CONFIG_REQUIRES pinocchio)
Olivier Stasse's avatar
Olivier Stasse committed
32

33
IF(BUILD_TESTING)
34
  ADD_REQUIRED_DEPENDENCY("talos_data >= 1.2.1")
35
36
  #ADD_OPTIONAL_DEPENDENCY("hrp2_14_description >= 1.0.2")
ENDIF(BUILD_TESTING)
Thomas Moulard's avatar
Thomas Moulard committed
37

38
# Handle OS specificities
39
40
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE("sys/time.h" SYS_TIME_H)
Olivier Stasse's avatar
Olivier Stasse committed
41
#IF(SYS_TIME_H)
42
ADD_DEFINITIONS("-DHAVE_SYS_TIME_H")
Olivier Stasse's avatar
Olivier Stasse committed
43
#ENDIF(SYS_TIME_H)
Thomas Moulard's avatar
Thomas Moulard committed
44

45
# TODO kinda dirty patch to find lssol for now
46
#  using ADD_OPTIONAL_DEPENDENCY prevents the creation
47
48
49
#  of classic variables such as ${PKG}_FOUND
# hence we use ADD_REQUIRED_DEPENDENCY to get the data
IF(USE_LSSOL)
50
  ADD_REQUIRED_DEPENDENCY("lssol >= 0.1.0")
51
52
ENDIF(USE_LSSOL)

53
54
55
56
IF(USE_QUADPROG)
  ADD_REQUIRED_DEPENDENCY("eigen-quadprog >= 1.0.0")
ENDIF(USE_QUADPROG)

Thomas Moulard's avatar
Thomas Moulard committed
57
# Add aggressive optimization flags in release mode.
58
IF(CMAKE_COMPILER_IS_GNUCXX)
59
  SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG ")
60
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
Thomas Moulard's avatar
Thomas Moulard committed
61

62
63
# Main Library
CONFIGURE_FILE(src/configJRLWPG.hh.in src/configJRLWPG.hh)
Thomas Moulard's avatar
Thomas Moulard committed
64
65
66
SET(${PROJECT_NAME}_HEADERS
  include/jrl/walkgen/patterngeneratorinterface.hh
  include/jrl/walkgen/pgtypes.hh
mnaveau's avatar
mnaveau committed
67
  include/jrl/walkgen/pinocchiorobot.hh
68
  )
Thomas Moulard's avatar
Thomas Moulard committed
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
SET(${PROJECT_NAME}_SOURCES
  src/RobotDynamics/pinocchiorobot.cpp
  src/FootTrajectoryGeneration/FootTrajectoryGenerationAbstract.cpp
  src/FootTrajectoryGeneration/FootTrajectoryGenerationStandard.cpp
  src/FootTrajectoryGeneration/FootTrajectoryGenerationMultiple.cpp
  src/FootTrajectoryGeneration/LeftAndRightFootTrajectoryGenerationMultiple.cpp
  src/FootTrajectoryGeneration/OnLineFootTrajectoryGeneration.cpp
  src/GlobalStrategyManagers/CoMAndFootOnlyStrategy.cpp
  src/GlobalStrategyManagers/GlobalStrategyManager.cpp
  src/GlobalStrategyManagers/DoubleStagePreviewControlStrategy.cpp
  src/Mathematics/AnalyticalZMPCOGTrajectory.cpp
  src/Mathematics/ConvexHull.cpp
  src/Mathematics/FootConstraintsAsLinearSystem.cpp
  #src/Mathematics/FootConstraintsAsLinearSystemForVelRef.cpp
  src/Mathematics/FootHalfSize.cpp
  src/Mathematics/OptCholesky.cpp
  src/Mathematics/Bsplines.cpp
  src/Mathematics/Polynome.cpp
  src/Mathematics/PolynomeFoot.cpp
  src/Mathematics/PLDPSolver.cpp
  src/Mathematics/qld.cpp
  src/Mathematics/StepOverPolynome.cpp
  src/Mathematics/relative-feet-inequalities.cpp
  src/Mathematics/intermediate-qp-matrices.cpp
  src/PreviewControl/PreviewControl.cpp
  src/PreviewControl/OptimalControllerSolver.cpp
  src/PreviewControl/ZMPPreviewControlWithMultiBodyZMP.cpp
  src/PreviewControl/LinearizedInvertedPendulum2D.cpp
  src/PreviewControl/rigid-body.cpp
  src/PreviewControl/rigid-body-system.cpp
  src/PreviewControl/SupportFSM.cpp
  src/ZMPRefTrajectoryGeneration/ZMPRefTrajectoryGeneration.cpp
  src/ZMPRefTrajectoryGeneration/ZMPDiscretization.cpp
  src/ZMPRefTrajectoryGeneration/ZMPQPWithConstraint.cpp
  src/ZMPRefTrajectoryGeneration/ZMPConstrainedQPFastFormulation.cpp
  src/ZMPRefTrajectoryGeneration/ZMPVelocityReferencedQP.cpp
  src/ZMPRefTrajectoryGeneration/OrientationsPreview.cpp
  src/ZMPRefTrajectoryGeneration/AnalyticalMorisawaAbstract.cpp
  src/ZMPRefTrajectoryGeneration/AnalyticalMorisawaCompact.cpp
  src/ZMPRefTrajectoryGeneration/FilteringAnalyticalTrajectoryByPreviewControl.cpp
  src/ZMPRefTrajectoryGeneration/problem-vel-ref.cpp
  src/ZMPRefTrajectoryGeneration/qp-problem.cpp
  src/ZMPRefTrajectoryGeneration/generator-vel-ref.cpp
  src/ZMPRefTrajectoryGeneration/mpc-trajectory-generation.cpp
  src/ZMPRefTrajectoryGeneration/DynamicFilter.cpp
  #src/MultiContactRefTrajectoryGeneration/MultiContactHirukawa.cc
  src/MotionGeneration/StepOverPlanner.cpp
  src/MotionGeneration/CollisionDetector.cpp
  src/MotionGeneration/WaistHeightVariation.cpp
  src/MotionGeneration/UpperBodyMotion.cpp
  src/MotionGeneration/GenerateMotionFromKineoWorks.cpp
  src/MotionGeneration/ComAndFootRealizationByGeometry.cpp
  src/StepStackHandler.cpp
  src/PatternGeneratorInterfacePrivate.cpp
  src/SimplePlugin.cpp
  src/SimplePluginManager.cpp
  src/pgtypes.cpp
  src/Clock.cpp
  src/portability/gettimeofday.cc
  src/privatepgtypes.cpp
  )

IF(USE_QUADPROG)
  SET(${PROJECT_NAME}_SOURCES
    ${${PROJECT_NAME}_SOURCES}
    src/ZMPRefTrajectoryGeneration/ZMPVelocityReferencedSQP.cpp
    src/ZMPRefTrajectoryGeneration/nmpc_generator.cpp
    )
ENDIF(USE_QUADPROG)

ADD_LIBRARY(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE
  $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
  $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/FootTrajectoryGeneration>
  PUBLIC $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LAPACK_LIBRARIES} pinocchio::pinocchio)

IF(SUFFIX_SO_VERSION)
  SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
Thomas Moulard's avatar
Thomas Moulard committed
151

152
153
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
  COMPILE_FLAGS "-msse -msse2 -msse3 -march=core2 -mfpmath=sse -fivopts -ftree-loop-im -fipa-pta ")
154

155
156
157
158
159
160
161
IF(USE_LSSOL)
  PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} lssol)
ENDIF(USE_LSSOL)

IF(USE_QUADPROG)
  PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen-quadprog)
ENDIF(USE_QUADPROG)
Olivier Stasse's avatar
Olivier Stasse committed
162

163
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
Olivier Stasse's avatar
Olivier Stasse committed
164

165
ADD_SUBDIRECTORY(tests)
Olivier Stasse's avatar
Olivier Stasse committed
166

167
168
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})