CMakeLists.txt 2.31 KB
Newer Older
Guilhem Saurel's avatar
Guilhem Saurel committed
1
# Copyright 2010 - 2019, Florent Lamiraux, Thomas Moulard, Guilhem Saurel, JRL, CNRS/AIST, LAAS-CNRS
florent's avatar
florent committed
2
3
4
5
6

#
# Python
#

Joseph Mirabel's avatar
Joseph Mirabel committed
7
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIRS})
Francois Keith's avatar
Francois Keith committed
8
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS})
florent's avatar
florent committed
9

10
11
12
13
14
15
16
#
#
#  Python interpreter
#
#
SET(LIBRARY_NAME ${PROJECT_NAME})
ADD_LIBRARY(${LIBRARY_NAME}
Guilhem Saurel's avatar
Guilhem Saurel committed
17
18
    SHARED
    interpreter.cc)
19

20
TARGET_LINK_LIBRARIES(${LIBRARY_NAME}
Guilhem Saurel's avatar
Guilhem Saurel committed
21
    ${PYTHON_LIBRARY})
Guilhem Saurel's avatar
Guilhem Saurel committed
22
TARGET_LINK_BOOST_PYTHON(${LIBRARY_NAME})
23

24
IF(UNIX)
Guilhem Saurel's avatar
Guilhem Saurel committed
25
26
    TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
    TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CMAKE_DL_LIBS})
27
ENDIF(UNIX)
28

29
30
31
32
SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} dynamic-graph)

INSTALL(TARGETS ${LIBRARY_NAME}
Guilhem Saurel's avatar
Guilhem Saurel committed
33
    DESTINATION lib)
34

florent's avatar
florent committed
35
36
37
38
39
40
41
42
43
#
#
#  Python bindings
#
#

SET(PYTHON_MODULE wrap)

ADD_LIBRARY(${PYTHON_MODULE}
Guilhem Saurel's avatar
Guilhem Saurel committed
44
45
46
47
48
49
50
51
52
53
54
55
    MODULE
    convert-dg-to-py.cc
    debug-py.cc
    dynamic-graph-py.cc
    entity-py.cc
    exception-python.cc
    factory-py.cc
    pool-py.cc
    signal-base-py.cc
    signal-caster-py.cc
    signal-wrapper.cc
    )
florent's avatar
florent committed
56
57
58

# Remove prefix lib
SET_TARGET_PROPERTIES(${PYTHON_MODULE}
Guilhem Saurel's avatar
Guilhem Saurel committed
59
    PROPERTIES PREFIX "")
florent's avatar
florent committed
60

Francois Keith's avatar
Francois Keith committed
61
PKG_CONFIG_USE_DEPENDENCY(${PYTHON_MODULE} dynamic-graph)
florent's avatar
florent committed
62

63
CONFIG_FILES(link-to-python.hh)
Joseph Mirabel's avatar
Joseph Mirabel committed
64
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
florent's avatar
florent committed
65
66
67
68
69

#
# Installation
#

Guilhem Saurel's avatar
Guilhem Saurel committed
70
INSTALL(TARGETS ${PYTHON_MODULE} DESTINATION ${PYTHON_SITELIB}/dynamic_graph)
florent's avatar
florent committed
71
72

SET (PYTHON_SOURCES
73
74
75
76
77
78
79
    __init__.py
    attrpath.py
    entity.py
    signal_base.py
    matlab.py
    script_shortcuts.py
    tools.py
Guilhem Saurel's avatar
Guilhem Saurel committed
80
    )
florent's avatar
florent committed
81
82

FOREACH (SOURCE ${PYTHON_SOURCES})
Guilhem Saurel's avatar
Guilhem Saurel committed
83
    PYTHON_INSTALL_ON_SITE(dynamic_graph ${SOURCE})
florent's avatar
florent committed
84
85
ENDFOREACH (SOURCE)

86
87
# --- ADD the wrap on the dg modules
# Tracer plugin
88
IF(WIN32)
Guilhem Saurel's avatar
Guilhem Saurel committed
89
    SET(TRACER_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer${CMAKE_STATIC_LIBRARY_SUFFIX})
90
ELSE(WIN32)
Guilhem Saurel's avatar
Guilhem Saurel committed
91
    SET(TRACER_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer${CMAKE_SHARED_LIBRARY_SUFFIX})
92
ENDIF(WIN32)
93
DYNAMIC_GRAPH_PYTHON_MODULE("tracer" ${TRACER_PLUGIN} tracer-wrap)
94
95

# TracerRealTime plugin
96
IF(WIN32)
Guilhem Saurel's avatar
Guilhem Saurel committed
97
    SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_STATIC_LIBRARY_SUFFIX})
98
ELSE(WIN32)
Guilhem Saurel's avatar
Guilhem Saurel committed
99
    SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_SHARED_LIBRARY_SUFFIX})
100
ENDIF(WIN32)
101
DYNAMIC_GRAPH_PYTHON_MODULE("tracer_real_time" ${TRACERREALTIME_PLUGIN} tracer_real_time-wrap)