CMakeLists.txt 3.1 KB
Newer Older
Nicolas Mansard's avatar
Nicolas Mansard committed
1
2
3
#
#  Copyright 2014 CNRS
#
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
4

Nicolas Mansard's avatar
Nicolas Mansard committed
5
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
Nicolas Mansard's avatar
IVIGIT.    
Nicolas Mansard committed
6

Nicolas Mansard's avatar
Nicolas Mansard committed
7
8
9
10
11
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/cpack.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/python.cmake)
Nicolas Mansard's avatar
IVIGIT.    
Nicolas Mansard committed
12

Nicolas Mansard's avatar
Nicolas Mansard committed
13
14
15
SET(PROJECT_NAME eigenpy)
SET(PROJECT_DESCRIPTION "Wrapping Eigen3 -- numpy")
SET(PROJECT_URL "http://github.com/stac-of-tasks/eigenpy")
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
16

Nicolas Mansard's avatar
Nicolas Mansard committed
17
18
19
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
SET(CMAKE_VERBOSE_MAKEFILE True)
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
20

Nicolas Mansard's avatar
Nicolas Mansard committed
21
22
project(${PROJECT_NAME})
SETUP_PROJECT()
23
STRING(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
Nicolas Mansard's avatar
Nicolas Mansard committed
24

Nicolas Mansard's avatar
Nicolas Mansard committed
25
26
27
28
29
30
31
32
33
# ----------------------------------------------------
# --- DEPENDANCIES -----------------------------------
# ----------------------------------------------------
SEARCH_FOR_EIGEN()
SET(BOOST_COMPONENTS python)
SEARCH_FOR_BOOST()
set(Python_ADDITIONAL_VERSIONS 2.7)
FINDPYTHON()
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
34

Nicolas Mansard's avatar
Nicolas Mansard committed
35
36
37
38
39
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
SET(${PROJECT_NAME}_HEADERS
  src/eigenpy.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
40
  src/exception.hpp
41
42
  src/details.hpp
  src/fwd.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
43
44
45
46
  src/map.hpp
  src/geometry.hpp
  src/angle-axis.hpp
  src/quaternion.hpp
Nicolas Mansard's avatar
Nicolas Mansard committed
47
48
)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/eigenpy")
Nicolas Mansard's avatar
Nicolas Mansard committed
49
INCLUDE_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/include/eigenpy)
Nicolas Mansard's avatar
Nicolas Mansard committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63

FOREACH(header ${${PROJECT_NAME}_HEADERS})
  GET_FILENAME_COMPONENT(headerName ${header} NAME)
  IF(WIN32)
    execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
                    ${${PROJECT_NAME}_SOURCE_DIR}/${header}
                    ${${PROJECT_NAME}_BINARY_DIR}/include/${PROJECT_NAME}/)
  ELSE(WIN32)
    execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
                    ${${PROJECT_NAME}_SOURCE_DIR}/${header}
                    ${${PROJECT_NAME}_BINARY_DIR}/include/${PROJECT_NAME}/${headerName})
  ENDIF(WIN32)
  INSTALL(FILES ${${PROJECT_NAME}_SOURCE_DIR}/${header}
	  DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}
Nicolas Mansard's avatar
Nicolas Mansard committed
64
          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
Nicolas Mansard's avatar
Nicolas Mansard committed
65
66
67
68
69
ENDFOREACH(header)

# ----------------------------------------------------
# --- TARGETS ----------------------------------------
# ----------------------------------------------------
Nicolas Mansard's avatar
Nicolas Mansard committed
70
71
72

ADD_LIBRARY(eigenpy SHARED
  src/exception.cpp
73
74
  src/eigenpy.cpp
  src/details.cpp
Nicolas Mansard's avatar
Nicolas Mansard committed
75
76
77
  src/angle-axis.cpp
  src/quaternion.cpp
  )
Nicolas Mansard's avatar
Nicolas Mansard committed
78
TARGET_LINK_LIBRARIES(eigenpy ${Boost_LIBRARIES})
Nicolas Mansard's avatar
Nicolas Mansard committed
79
80
81
82
83
84
85
86
87
88
89
90
91
92
INSTALL(TARGETS eigenpy DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)


# ----------------------------------------------------
# --- UNIT TEST --------------------------------------
# ----------------------------------------------------
ADD_LIBRARY(matrix SHARED unittest/matrix.cpp)
TARGET_LINK_LIBRARIES(matrix ${Boost_LIBRARIES} eigenpy)
SET_TARGET_PROPERTIES(matrix PROPERTIES PREFIX "")

ADD_LIBRARY(geometry SHARED unittest/geometry.cpp)
TARGET_LINK_LIBRARIES(geometry ${Boost_LIBRARIES} eigenpy)
SET_TARGET_PROPERTIES(geometry PROPERTIES PREFIX "")

Nicolas Mansard's avatar
Nicolas Mansard committed
93
94
95
96
97
98
PKG_CONFIG_APPEND_CFLAGS(${_Eigen_CFLAGS})
PKG_CONFIG_APPEND_CFLAGS("-I${PYTHON_INCLUDE_DIRS}")
PKG_CONFIG_APPEND_LIBS_RAW(${Boost_LIBRARIES})

SETUP_PROJECT_FINALIZE()
SETUP_PROJECT_CPACK()
Nicolas Mansard's avatar
IVIGIT.  
Nicolas Mansard committed
99