CMakeLists.txt 2.58 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
2
# Copyright (c) 2015-2020, CNRS
# Authors: Justin Carpentier <jcarpent@laas.fr>, Guilhem Saurel
Justin Carpentier's avatar
Justin Carpentier committed
3

Guilhem Saurel's avatar
Guilhem Saurel committed
4
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
Justin Carpentier's avatar
Justin Carpentier committed
5

Guilhem Saurel's avatar
Guilhem Saurel committed
6
7
# Project properties
SET(PROJECT_ORG loco-3d)
8
9
SET(PROJECT_NAME multicontact-api)
SET(PROJECT_DESCRIPTION "API to define and store Contact phases and Contact Sequences")
Guilhem Saurel's avatar
Guilhem Saurel committed
10
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
11

Guilhem Saurel's avatar
Guilhem Saurel committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Project options
OPTION(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
OPTION(INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python bindings" OFF)
OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON)

# Project configuration
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
  SET(PROJECT_USE_CMAKE_EXPORT TRUE)
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
SET(CUSTOM_HEADER_DIR "${PROJECT_NAME}")
SET(CMAKE_CXX_STANDARD 11)
SET(CXX_DISABLE_WERROR TRUE)
SET(DOXYGEN_USE_MATHJAX YES)

# JRL-cmakemodule setup
Justin Carpentier's avatar
Justin Carpentier committed
27
28
29
30
31
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/boost.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake/ide.cmake)

Guilhem Saurel's avatar
Guilhem Saurel committed
32
# Project definition
Guilhem Saurel's avatar
Guilhem Saurel committed
33
34
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
Justin Carpentier's avatar
Justin Carpentier committed
35

Guilhem Saurel's avatar
Guilhem Saurel committed
36
37
# Project dependencies
ADD_PROJECT_DEPENDENCY(pinocchio REQUIRED PKG_CONFIG_REQUIRES "pinocchio >= 2.0.0")
38
39
40
41
ADD_PROJECT_DEPENDENCY(curves 0.4.1 REQUIRED PKG_CONFIG_REQUIRES "curves >= 0.4.1")
IF(NOT CURVES_WITH_PINOCCHIO_SUPPORT)
  MESSAGE(FATAL_ERROR "you need to use a curves version compiled with pinocchio support")
ENDIF(NOT CURVES_WITH_PINOCCHIO_SUPPORT)
Justin Carpentier's avatar
Justin Carpentier committed
42
43
44
SET(BOOST_COMPONENTS unit_test_framework serialization)

IF(BUILD_PYTHON_INTERFACE)
Guilhem Saurel's avatar
Guilhem Saurel committed
45
  FINDPYTHON()
Guilhem Saurel's avatar
Guilhem Saurel committed
46
47
48
  STRING(REGEX REPLACE "-" "_" PY_NAME ${CUSTOM_HEADER_DIR})
  ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES "eigenpy >= 1.6.12")
  SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
Guilhem Saurel's avatar
Guilhem Saurel committed
49
50
51
  INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS})
  STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
  SET(${PY_NAME}_INSTALL_DIR ${PYTHON_SITELIB}/${PY_NAME})
Justin Carpentier's avatar
Justin Carpentier committed
52
53
54
ENDIF(BUILD_PYTHON_INTERFACE)

SEARCH_FOR_BOOST()
Guilhem Saurel's avatar
Guilhem Saurel committed
55
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
Justin Carpentier's avatar
Justin Carpentier committed
56

Guilhem Saurel's avatar
Guilhem Saurel committed
57
58
59
60
61
62
63
64
65
66
# Main Library

ADD_LIBRARY(${PROJECT_NAME} INTERFACE)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} INTERFACE pinocchio::pinocchio curves::curves)

IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
  INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)

67
68
69
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
  ADD_SUBDIRECTORY(include/${CUSTOM_HEADER_DIR})
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
Justin Carpentier's avatar
Justin Carpentier committed
70
71
72
73
ADD_SUBDIRECTORY(bindings)
ADD_SUBDIRECTORY(unittest)

PKG_CONFIG_APPEND_BOOST_LIBS(serialization)