CMakeLists.txt 2.42 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)
Guilhem Saurel's avatar
Guilhem Saurel committed
24
INCLUDE(cmake/sphinx.cmake)
florent's avatar
florent committed
25

26
# Project definition
27
28
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
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

33
ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED PKG_CONFIG_REQUIRES dynamic-graph)
34
SET(BOOST_COMPONENTS filesystem system thread program_options unit_test_framework python)
35
36
SEARCH_FOR_BOOST()

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

# 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}/exception.hh
  include/${CUSTOM_HEADER_DIR}/exception-python.hh
  include/${CUSTOM_HEADER_DIR}/interpreter.hh
  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
  )

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>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}
  ${PYTHON_LIBRARY} ${Boost_PYTHON_LIBRARIES} dynamic-graph::dynamic-graph)

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
70
ADD_SUBDIRECTORY(src)
Thomas Moulard's avatar
Thomas Moulard committed
71
ADD_SUBDIRECTORY(doc)
72
ADD_SUBDIRECTORY(tests)
Guilhem Saurel's avatar
v3.5.0    
Guilhem Saurel committed
73

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