CMakeLists.txt 2.52 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
# Copyright 2010-2020, Florent Lamiraux, Thomas Moulard, Olivier Stasse, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
florent's avatar
florent committed
2

3
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
Guilhem Saurel's avatar
Guilhem Saurel committed
4

5
6
# Project properties
SET(PROJECT_ORG stack-of-tasks)
Guilhem Saurel's avatar
Guilhem Saurel committed
7
8
SET(PROJECT_NAME dynamic-graph-python)
SET(PROJECT_DESCRIPTION "Dynamic graph library Python bindings")
9
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
florent's avatar
florent committed
10

11
12
13
14
# Project options
OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON)

# Project configuration
15
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
16
17
SET(CUSTOM_HEADER_DIR "dynamic-graph/python")
SET(CXX_DISABLE_WERROR TRUE)
Guilhem Saurel's avatar
Guilhem Saurel committed
18
SET(DOXYGEN_USE_MATHJAX YES)
19

20
# JRL-cmakemodule setup
21
INCLUDE(cmake/base.cmake)
Thomas Moulard's avatar
Thomas Moulard committed
22
INCLUDE(cmake/boost.cmake)
23
INCLUDE(cmake/python.cmake)
florent's avatar
florent committed
24

25
# Project definition
26
27
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
florent's avatar
florent committed
28

29
# Project dependencies
Guilhem Saurel's avatar
Guilhem Saurel committed
30
FINDPYTHON()
Guilhem Saurel's avatar
Guilhem Saurel committed
31

32
ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED PKG_CONFIG_REQUIRES dynamic-graph)
Joseph Mirabel's avatar
Joseph Mirabel committed
33
ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES eigenpy)
Joseph Mirabel's avatar
Joseph Mirabel committed
34
ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED PKG_CONFIG_REQUIRES eigenpy)
35
SET(BOOST_COMPONENTS filesystem system thread program_options unit_test_framework python)
36
37
SEARCH_FOR_BOOST()

38
39
40
41
42
43
44

# Main Library
SET(${PROJECT_NAME}_HEADERS
  include/${CUSTOM_HEADER_DIR}/api.hh
  include/${CUSTOM_HEADER_DIR}/convert-dg-to-py.hh
  include/${CUSTOM_HEADER_DIR}/dynamic-graph-py.hh
  include/${CUSTOM_HEADER_DIR}/interpreter.hh
Joseph Mirabel's avatar
Joseph Mirabel committed
45
  include/${CUSTOM_HEADER_DIR}/module.hh
46
47
48
49
50
51
52
  include/${CUSTOM_HEADER_DIR}/python-compat.hh
  include/${CUSTOM_HEADER_DIR}/signal-wrapper.hh
  )

SET(${PROJECT_NAME}_SOURCES
  src/interpreter.cc
  src/dynamic_graph/python-compat.cc
Joseph Mirabel's avatar
Joseph Mirabel committed
53
54
  src/dynamic_graph/entity-py.cc
  src/dynamic_graph/convert-dg-to-py.cc
55
56
57
58
59
60
  )

ADD_LIBRARY(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
Joseph Mirabel's avatar
Joseph Mirabel committed
61
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES}
Joseph Mirabel's avatar
Joseph Mirabel committed
62
  ${PYTHON_LIBRARY} Boost::python dynamic-graph::dynamic-graph)
63
64
65
66
67
68
69
70
71

IF(SUFFIX_SO_VERSION)
  SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)

TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE PYTHON_LIBRARY="${PYTHON_LIBRARY}")

INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)

florent's avatar
florent committed
72
ADD_SUBDIRECTORY(src)
73
ADD_SUBDIRECTORY(tests)
Guilhem Saurel's avatar
v3.5.0    
Guilhem Saurel committed
74

75
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
Guilhem Saurel's avatar
v3.5.0    
Guilhem Saurel committed
76
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})