CMakeLists.txt 2.42 KB
Newer Older
Thomas Moulard's avatar
Thomas Moulard committed
1
# Copyright 2010, 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
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
17
18
19
#
#
#  Python interpreter
#
#
SET(LIBRARY_NAME ${PROJECT_NAME})
ADD_LIBRARY(${LIBRARY_NAME}
  SHARED
  interpreter.cc)

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

24
25
IF(UNIX)
  TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${Boost_LIBRARIES})
26
  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}
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}
44
45
46
47
48
49
50
51
52
53
54
  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
55
)
florent's avatar
florent committed
56
57
58
59
60

# Remove prefix lib
SET_TARGET_PROPERTIES(${PYTHON_MODULE}
	PROPERTIES PREFIX "")

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

64
CONFIG_FILES(link-to-python.hh)
Joseph Mirabel's avatar
Joseph Mirabel committed
65
66
INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
florent's avatar
florent committed
67
68
69
70
71
72
73
74
75
76
77
78

#
# Installation
#

SET(PYTHON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB}/dynamic_graph)

INSTALL(TARGETS ${PYTHON_MODULE}
	       DESTINATION
	       ${PYTHON_INSTALL_DIR})

SET (PYTHON_SOURCES
79
80
81
82
83
84
85
    __init__.py
    attrpath.py
    entity.py
    signal_base.py
    matlab.py
    script_shortcuts.py
    tools.py
86
)
florent's avatar
florent committed
87
88

FOREACH (SOURCE ${PYTHON_SOURCES})
89
  PYTHON_INSTALL_ON_SITE(dynamic_graph ${SOURCE} )
florent's avatar
florent committed
90
91
ENDFOREACH (SOURCE)

92
93
# --- ADD the wrap on the dg modules
# Tracer plugin
94
IF(WIN32)
95
SET(TRACER_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer${CMAKE_STATIC_LIBRARY_SUFFIX})
96
ELSE(WIN32)
97
SET(TRACER_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer${CMAKE_SHARED_LIBRARY_SUFFIX})
98
ENDIF(WIN32)
99
DYNAMIC_GRAPH_PYTHON_MODULE("tracer" ${TRACER_PLUGIN} tracer-wrap)
100
101

# TracerRealTime plugin
102
IF(WIN32)
103
SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_STATIC_LIBRARY_SUFFIX})
104
ELSE(WIN32)
105
SET(TRACERREALTIME_PLUGIN ${DYNAMIC_GRAPH_PLUGINDIR}/tracer-real-time${CMAKE_SHARED_LIBRARY_SUFFIX})
106
ENDIF(WIN32)
107
DYNAMIC_GRAPH_PYTHON_MODULE("tracer_real_time" ${TRACERREALTIME_PLUGIN} tracer_real_time-wrap)