CMakeLists.txt 2.57 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)
34
SEARCH_FOR_BOOST_PYTHON(REQUIRED)
35
36
37
IF(BUILD_TESTING)
  FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
ENDIF(BUILD_TESTING)
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
  include/${CUSTOM_HEADER_DIR}/python-compat.hh
47
  include/${CUSTOM_HEADER_DIR}/signal.hh
48
49
50
51
52
53
  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
54
55
  src/dynamic_graph/entity-py.cc
  src/dynamic_graph/convert-dg-to-py.cc
56
57
58
59
  )

ADD_LIBRARY(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
Guilhem Saurel's avatar
Guilhem Saurel committed
60
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIR})
61
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
62
63
64
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${PYTHON_LIBRARY}
  dynamic-graph::dynamic-graph)
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME} PRIVATE)
65
66
67
68
69
70
71
72
73

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
74
ADD_SUBDIRECTORY(src)
75
76
77
IF(BUILD_TESTING)
  ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTING)
Guilhem Saurel's avatar
v3.5.0    
Guilhem Saurel committed
78

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