CMakeLists.txt 3.87 KB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Copyright 2010, Olivier Stasse, JRL, CNRS/AIST
#
# This file is part of jrl-walkgen.
# jrl-walkgen is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# jrl-walkgen is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
# jrl-walkgen. If not, see <http://www.gnu.org/licenses/>.

Thomas Moulard's avatar
Thomas Moulard committed
16
17
# Requires at least CMake 2.6 to configure the package.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
Thomas Moulard's avatar
Thomas Moulard committed
18

19
20
21
22
23
24
25
26
27

INCLUDE(cmake/cmake_metapod_configure.cmake)
##############################################################################
SET(WITH_METAPODFROMURDF TRUE)
SET(model_name "simple_humanoid")
# Define the simple humanoid model for the metapod algorithm
ADD_SAMPLEURDFMODEL(${model_name})
##############################################################################

28
# Includes from jrl-cmaketools
Thomas Moulard's avatar
Thomas Moulard committed
29
INCLUDE(cmake/base.cmake)
30
INCLUDE(cmake/lapack.cmake)
31
INCLUDE(cmake/cpack.cmake)
32
INCLUDE(CMakeDependentOption)
Thomas Moulard's avatar
Thomas Moulard committed
33

34
# Define properties of the project
Thomas Moulard's avatar
Thomas Moulard committed
35
36
37
SET(PROJECT_NAME jrl-walkgen)
SET(PROJECT_DESCRIPTION "Walking pattern generator for Humanoids")
SET(PROJECT_URL "")
Thomas Moulard's avatar
Thomas Moulard committed
38

Thomas Moulard's avatar
Thomas Moulard committed
39
SET(CXX_DISABLE_WERROR True)
Thomas Moulard's avatar
Thomas Moulard committed
40

41
# Initialize generic properties of the project
Thomas Moulard's avatar
Thomas Moulard committed
42
SETUP_PROJECT()
Thomas Moulard's avatar
Thomas Moulard committed
43

44
# Handle OS specificities
Thomas Moulard's avatar
Thomas Moulard committed
45
46
INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES("sys/time.h" SYS_TIME_H)
47
48
49
IF(SYS_TIME_H)
ADD_DEFINITIONS("-DHAVE_SYS_TIME_H")
ENDIF(SYS_TIME_H)
Thomas Moulard's avatar
Thomas Moulard committed
50

51
52
53
# Define dependencies

# Required dependencies
Thomas Moulard's avatar
Thomas Moulard committed
54
55
56
ADD_REQUIRED_DEPENDENCY("jrl-mal >= 1.9.0")
ADD_REQUIRED_DEPENDENCY("abstract-robot-dynamics >= 1.15")
ADD_REQUIRED_DEPENDENCY("jrl-dynamics >= 1.19.1")
57

58
# Optional ones.
59
ADD_OPTIONAL_DEPENDENCY("hrp2-14 >= 1.8-6")
60
ADD_OPTIONAL_DEPENDENCY("hrp2-dynamics >= 1.0.1")
61
ADD_OPTIONAL_DEPENDENCY("metapod >= 1.0.7")
Thomas Moulard's avatar
Thomas Moulard committed
62

63
MESSAGE(STATUS "hrp2-dynamics: " ${HRP2_DYNAMICS_FOUND})
Thomas Moulard's avatar
Thomas Moulard committed
64

65
66
67
68
69
70
71
72
# Search for Eigen.
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.0")
# Eigen (at least version 3.0.5) makes gcc report conversion warnings
# when one assigns to a block. This floods the compilation results.
# So we include Eigen headers as if they were system headers: the compiler
# won't report warning coming from them.
INCLUDE_DIRECTORIES(SYSTEM ${EIGEN3_INCLUDE_DIRS})

73
# TODO kinda dirty patch to find lssol for now
74
#  using ADD_OPTIONAL_DEPENDENCY prevents the creation
75
76
77
78
79
80
81
#  of classic variables such as ${PKG}_FOUND
# hence we use ADD_REQUIRED_DEPENDENCY to get the data
OPTION(USE_LSSOL "Do you want to use the solver lssol?" OFF)
IF(USE_LSSOL)
 ADD_REQUIRED_DEPENDENCY("lssol >= 0.1.0")
ENDIF(USE_LSSOL)

Thomas Moulard's avatar
Thomas Moulard committed
82
# Add aggressive optimization flags in release mode.
83
84
IF(CMAKE_COMPILER_IS_GNUCXX)
  SET (CMAKE_CXX_FLAGS_RELEASE
85
    "-O3 -DNDEBUG")
86
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
Thomas Moulard's avatar
Thomas Moulard committed
87

88
89
90
91
92
93
94
95
96
97
98
#IF(CMAKE_COMPILER_IS_GNUCXX)
#  SET (CMAKE_CXX_FLAGS_RELEASE
#    "-O3 -funroll-loops -frerun-loop-opt -fschedule-insns2")
#  SET (CMAKE_CXX_FLAGS_RELEASE
#    "${CMAKE_CXX_FLAGS_RELEASE} -frerun-cse-after-loop -falign-functions")
#  SET (CMAKE_CXX_FLAGS_RELEASE
#    "${CMAKE_CXX_FLAGS_RELEASE} -falign-labels -falign-loops -falign-jumps")
#  SET (CMAKE_CXX_FLAGS_RELEASE
#    "${CMAKE_CXX_FLAGS_RELEASE} -fexpensive-optimizations")
#ENDIF(CMAKE_COMPILER_IS_GNUCXX)

99
# Define the set of headers to be exported
Thomas Moulard's avatar
Thomas Moulard committed
100
101
102
103
104
SET(${PROJECT_NAME}_HEADERS
  include/jrl/walkgen/patterngeneratorinterface.hh
  include/jrl/walkgen/pgtypes.hh
)

105
# Define subdirectories to explore for cmake
Thomas Moulard's avatar
Thomas Moulard committed
106
ADD_SUBDIRECTORY(src)
Thomas Moulard's avatar
Thomas Moulard committed
107
ADD_SUBDIRECTORY(tests)
olivier stasse's avatar
olivier stasse committed
108
#ADD_SUBDIRECTORY(debian)
Thomas Moulard's avatar
Thomas Moulard committed
109

110
111
112
113
# Generate dependency to jrl-walkgen in pc file
PKG_CONFIG_APPEND_LIBS("jrl-walkgen")

# Ask to generate the final steps.
Thomas Moulard's avatar
Thomas Moulard committed
114
SETUP_PROJECT_FINALIZE()
115
SETUP_PROJECT_CPACK()