forked from nmansard/irepa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
152 lines (122 loc) · 5.21 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#
# Copyright (c) 2015-2016 CNRS
# Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
#
# This file is part of Pinocchio
# pinocchio 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.
# pinocchio 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
# pinocchio If not, see
# <http://www.gnu.org/licenses/>.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/eigen.cmake)
INCLUDE(cmake/python.cmake)
SET(PROJECT_NAME pycado)
SET(PROJECT_DESCRIPTION "Python bindings for dedicated ACADO problems")
SET(PROJECT_URL "???")
OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" ON)
SET(DOXYGEN_USE_MATHJAX YES)
IF(APPLE)
SET(CMAKE_MACOSX_RPATH TRUE)
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")
ENDIF(APPLE)
# Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True)
SET(CMAKE_VERBOSE_MAKEFILE True)
SETUP_PROJECT()
IF(WIN32)
SET(LINK copy_if_different)
ELSE(WIN32)
SET(LINK create_symlink)
ENDIF(WIN32)
# --- OPTIONS ----------------------------------------
OPTION (INITIALIZE_WITH_NAN "Initialize Eigen entries with NaN" OFF)
OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
IF (INITIALIZE_WITH_NAN)
MESSAGE (STATUS "Initialize with NaN all the Eigen entries.")
ADD_DEFINITIONS(-DEIGEN_INITIALIZE_MATRICES_BY_NAN)
ENDIF (INITIALIZE_WITH_NAN)
# ----------------------------------------------------
# --- DEPENDANCIES -----------------------------------
# ----------------------------------------------------
ADD_REQUIRED_DEPENDENCY("eigen3 >= 3.0.5")
# Spetcial care of Eigen3 greater than 3.2.10
IF(EIGEN3_FOUND)
IF(${EIGEN3_VERSION} VERSION_GREATER "3.2.10")
ADD_DEFINITIONS(-DEIGEN3_FUTURE)
SET(EIGEN3_FUTURE TRUE)
PKG_CONFIG_APPEND_CFLAGS("-DEIGEN3_FUTURE")
ELSE(${EIGEN3_VERSION} VERSION_GREATER "3.2.10")
SET(EIGEN3_FUTURE FALSE)
ENDIF(${EIGEN3_VERSION} VERSION_GREATER "3.2.10")
ENDIF(EIGEN3_FOUND)
#share/acado/cmake
MESSAGE(STATUS "*** " $ENV{ACADO_INSTALL_DIR})
SET(ACADO_DIR $ENV{ACADO_INSTALL_DIR})
SET( ACADO_INCLUDE_DIRS ${ACADO_DIR}/include/acado ${ACADO_DIR}/include )
SET( ACADO_LIBRARY_DIRS ${ACADO_DIR}/lib )
SET( ACADO_SHARED_LIBRARIES acado_toolkit_s )
INCLUDE_DIRECTORIES( ${ACADO_INCLUDE_DIRS} )
LINK_DIRECTORIES(${ACADO_LIBRARY_DIRS})
set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
SET(BOOST_REQUIERED_COMPONENTS filesystem system program_options)
SET(BOOST_BUILD_COMPONENTS unit_test_framework)
SET(BOOST_OPTIONAL_COMPONENTS "")
IF(BUILD_PYTHON_INTERFACE)
SET(BOOST_OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS} python)
FINDPYTHON(2.7 EXACT REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
ENDIF(BUILD_PYTHON_INTERFACE)
SET(BOOST_COMPONENTS ${BOOST_REQUIERED_COMPONENTS} ${BOOST_OPTIONAL_COMPONENTS} ${BOOST_BUILD_COMPONENTS})
SEARCH_FOR_BOOST()
# Variable containing all the cflags definition relative to optional dependencies
SET(CFLAGS_DEPENDENCIES)
# Path to boost headers
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
# ----------------------------------------------------
# --- INCLUDE ----------------------------------------
# ----------------------------------------------------
SET(HEADERS
pycado.hpp
utils.hpp
)
MAKE_DIRECTORY("${${PROJECT_NAME}_BINARY_DIR}/include/pycado")
FOREACH(header ${HEADERS})
GET_FILENAME_COMPONENT(headerName ${header} NAME)
GET_FILENAME_COMPONENT(headerPath ${header} PATH)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E ${LINK}
${${PROJECT_NAME}_SOURCE_DIR}/src/${header}
${${PROJECT_NAME}_BINARY_DIR}/include/${PROJECT_NAME}/${header})
INSTALL(FILES ${${PROJECT_NAME}_SOURCE_DIR}/src/${header}
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}/${headerPath}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE)
ENDFOREACH(header)
# --- MAIN LIBRARY -------------------------------------------------------------
ADD_SUBDIRECTORY(src)
# --- BINDINGS -----------------------------------------------------------------
SET(PYWRAP ${PROJECT_NAME}_pywrap)
ADD_SUBDIRECTORY(bindings)
# --- UNIT TESTS ---------------------------------------------------------------
ADD_SUBDIRECTORY(unittest)
# --- PACKAGING ----------------------------------------------------------------
PKG_CONFIG_APPEND_LIBS (${PROJECT_NAME})
PKG_CONFIG_APPEND_BOOST_LIBS(${BOOST_REQUIERED_COMPONENTS})
FOREACH(cflags ${CFLAGS_DEPENDENCIES})
PKG_CONFIG_APPEND_CFLAGS(${cflags})
ENDFOREACH(cflags ${CFLAGS_DEPENDENCIES})
SETUP_PROJECT_FINALIZE()