CMakeLists.txt 5.01 KB
Newer Older
Nicolas Mansard's avatar
Nicolas Mansard committed
1
#
2
# Copyright (c) 2015-2018 LAAS-CNRS
jcarpent's avatar
jcarpent committed
3
4
5
6
7
8
9
10
11
12
13
14
#
# This file is part of eigenpy.
# eigenpy 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.
# eigenpy 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 Lesser General Public License for more details.  You should
# have received a copy of the GNU Lesser General Public License along
# with eigenpy.  If not, see <http://www.gnu.org/licenses/>.
Nicolas Mansard's avatar
Nicolas Mansard committed
15
#
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
16

Nicolas Mansard's avatar
Nicolas Mansard committed
17
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
Nicolas Mansard's avatar
IVIGIT.    
Nicolas Mansard committed
18

Nicolas Mansard's avatar
Nicolas Mansard committed
19
20
21
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/python.cmake)
jcarpent's avatar
jcarpent committed
22
INCLUDE(cmake/ide.cmake)
Guilhem Saurel's avatar
Guilhem Saurel committed
23
INCLUDE(cmake/test.cmake)
Nicolas Mansard's avatar
IVIGIT.    
Nicolas Mansard committed
24

Nicolas Mansard's avatar
Nicolas Mansard committed
25
26
SET(PROJECT_NAME eigenpy)
SET(PROJECT_DESCRIPTION "Wrapping Eigen3 -- numpy")
27
SET(PROJECT_URL "http://github.com/stack-of-tasks/eigenpy")
jcarpent's avatar
jcarpent committed
28
OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" FALSE)
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
29

Nicolas Mansard's avatar
Nicolas Mansard committed
30
31
32
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
SET(CMAKE_VERBOSE_MAKEFILE True)
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
33

Nicolas Mansard's avatar
Nicolas Mansard committed
34
SETUP_PROJECT()
35
STRING(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
Nicolas Mansard's avatar
Nicolas Mansard committed
36

37
38
IF(APPLE)
  SET(CMAKE_MACOSX_RPATH TRUE)
jcarpent's avatar
jcarpent committed
39
40
41
42
43
44
45
46
47
  SET(CMAKE_SKIP_BUILD_RPATH FALSE)
  SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

  #SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
  IF("${isSystemDir}" STREQUAL "-1")
     SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
  ENDIF("${isSystemDir}" STREQUAL "-1")
48
49
ENDIF(APPLE)

50
51
52
53
54
55
IF(WIN32)
  SET(LINK copy_if_different)
ELSE(WIN32)
  SET(LINK create_symlink)
ENDIF(WIN32)

56

57
58
59
# ----------------------------------------------------
# --- OPTIONS  ---------------------------------------
# ----------------------------------------------------
jcarpent's avatar
jcarpent committed
60
OPTION (BUILD_UNIT_TESTS "Build the unitary tests" ON)
61

62
63
64
65
66
67
FINDPYTHON()

INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
FIND_NUMPY()
INCLUDE_DIRECTORIES(SYSTEM ${NUMPY_INCLUDE_DIRS})

Nicolas Mansard's avatar
Nicolas Mansard committed
68
69
70
# ----------------------------------------------------
# --- DEPENDANCIES -----------------------------------
# ----------------------------------------------------
71
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
jcarpent's avatar
jcarpent committed
72

73
SET(BOOST_COMPONENTS python)
Nicolas Mansard's avatar
Nicolas Mansard committed
74
SEARCH_FOR_BOOST()
jcarpent's avatar
jcarpent committed
75
# Add Boost path to include directories.
76
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
jcarpent's avatar
jcarpent committed
77

Nicolas Mansard's avatar
Nicolas Mansard committed
78
79
80
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
jcarpent's avatar
jcarpent committed
81
SET(${PROJECT_NAME}_SOLVERS_HEADERS
jcarpent's avatar
jcarpent committed
82
83
84
85
86
87
88
89
  include/eigenpy/solvers/solvers.hpp
  include/eigenpy/solvers/preconditioners.hpp
  include/eigenpy/solvers/IterativeSolverBase.hpp
  include/eigenpy/solvers/LeastSquaresConjugateGradient.hpp
  include/eigenpy/solvers/ConjugateGradient.hpp
  include/eigenpy/solvers/SparseSolverBase.hpp
  include/eigenpy/solvers/BasicPreconditioners.hpp
  include/eigenpy/solvers/BFGSPreconditioners.hpp
jcarpent's avatar
jcarpent committed
90
91
  )

92
SET(${PROJECT_NAME}_HEADERS
jcarpent's avatar
jcarpent committed
93
  ${${PROJECT_NAME}_SOLVERS_HEADERS}
jcarpent's avatar
jcarpent committed
94
95
96
97
98
99
100
101
102
103
104
105
106
  include/eigenpy/eigenpy.hpp
  include/eigenpy/exception.hpp
  include/eigenpy/details.hpp
  include/eigenpy/fwd.hpp
  include/eigenpy/map.hpp
  include/eigenpy/geometry.hpp
  include/eigenpy/geometry-conversion.hpp
  include/eigenpy/memory.hpp
  include/eigenpy/registration.hpp
  include/eigenpy/angle-axis.hpp
  include/eigenpy/quaternion.hpp
  include/eigenpy/stride.hpp
  include/eigenpy/ref.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
107
)
jcarpent's avatar
jcarpent committed
108

109
INCLUDE_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/include)
jcarpent's avatar
jcarpent committed
110
INCLUDE_DIRECTORIES(${${PROJECT_NAME}_SOURCE_DIR}/include)
Nicolas Mansard's avatar
Nicolas Mansard committed
111
112
113
114

# ----------------------------------------------------
# --- TARGETS ----------------------------------------
# ----------------------------------------------------
jcarpent's avatar
jcarpent committed
115
SET(${PROJECT_NAME}_SOLVERS_SOURCES
jcarpent's avatar
jcarpent committed
116
  src/solvers/preconditioners.cpp
jcarpent's avatar
jcarpent committed
117
118
  src/solvers/solvers.cpp
  )
119

120
SET(${PROJECT_NAME}_SOURCES
jcarpent's avatar
jcarpent committed
121
  ${${PROJECT_NAME}_SOLVERS_SOURCES}
Nicolas Mansard's avatar
Nicolas Mansard committed
122
  src/exception.cpp
123
  src/eigenpy.cpp
Nicolas Mansard's avatar
Nicolas Mansard committed
124
125
  src/angle-axis.cpp
  src/quaternion.cpp
126
  src/geometry-conversion.cpp
127
)
Nicolas Mansard's avatar
Nicolas Mansard committed
128

129
ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
130

131
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME})
132
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} eigen3)
133
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
Nicolas Mansard's avatar
Nicolas Mansard committed
134

jcarpent's avatar
jcarpent committed
135
136
137
ADD_HEADER_GROUP(${PROJECT_NAME}_HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)

Nicolas Mansard's avatar
Nicolas Mansard committed
138
# ----------------------------------------------------
139
# --- PYTHON LIBRARY ---------------------------------
jcarpent's avatar
jcarpent committed
140
# ----------------------------------------------------
141
ADD_SUBDIRECTORY(python)
Nicolas Mansard's avatar
Nicolas Mansard committed
142

143
# ----------------------------------------------------
144
# --- UNIT TEST --------------------------------------
145
# ----------------------------------------------------
146
ADD_SUBDIRECTORY(unittest)
147

148
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
149
150
PKG_CONFIG_APPEND_CFLAGS("-isystem${PYTHON_INCLUDE_DIRS}")
PKG_CONFIG_APPEND_CFLAGS("-isystem${NUMPY_INCLUDE_DIRS}")
151
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_COMPONENTS})
Nicolas Mansard's avatar
Nicolas Mansard committed
152
153

SETUP_PROJECT_FINALIZE()