CMakeLists.txt 2.79 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})
Guilhem Saurel's avatar
Guilhem Saurel committed
28
CHECK_MINIMAL_CXX_STANDARD(14 ENFORCE)
florent's avatar
florent committed
29

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

Guilhem Saurel's avatar
Guilhem Saurel committed
33
34
ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED)
ADD_PROJECT_DEPENDENCY(eigenpy REQUIRED)
35
SEARCH_FOR_BOOST_PYTHON(REQUIRED)
36
37
38
IF(BUILD_TESTING)
  FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
ENDIF(BUILD_TESTING)
39

40
41
42
43
44
45
IF(Boost_VERSION GREATER 107299 OR Boost_VERSION_MACRO GREATER 107299)
  # Silence a warning about a deprecated use of boost bind by boost >= 1.73
  # without dropping support for boost < 1.73
  ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
ENDIF()

46
47
48
49
50
# 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
Florent Lamiraux's avatar
Florent Lamiraux committed
51
  include/${CUSTOM_HEADER_DIR}/fwd.hh
52
  include/${CUSTOM_HEADER_DIR}/interpreter.hh
Joseph Mirabel's avatar
Joseph Mirabel committed
53
  include/${CUSTOM_HEADER_DIR}/module.hh
54
  include/${CUSTOM_HEADER_DIR}/python-compat.hh
55
  include/${CUSTOM_HEADER_DIR}/signal.hh
56
57
58
59
60
61
  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
62
63
  src/dynamic_graph/entity-py.cc
  src/dynamic_graph/convert-dg-to-py.cc
64
65
66
67
  )

ADD_LIBRARY(${PROJECT_NAME} SHARED
  ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
Guilhem Saurel's avatar
Guilhem Saurel committed
68
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${PYTHON_INCLUDE_DIR})
69
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
70
71
72
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${PYTHON_LIBRARY}
  dynamic-graph::dynamic-graph)
TARGET_LINK_BOOST_PYTHON(${PROJECT_NAME} PRIVATE)
73
74
75
76
77
78
79
80
81

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
82
ADD_SUBDIRECTORY(src)
83
84
85
IF(BUILD_TESTING)
  ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTING)
Guilhem Saurel's avatar
v3.5.0    
Guilhem Saurel committed
86
87

INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})