CMakeLists.txt 1.68 KB
Newer Older
florent's avatar
florent committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
#  Copyright 2010 CNRS
#
#  Author: Florent Lamiraux
#

#
# Python
#
INCLUDE(FindPythonLibs)
IF (NOT ${PYTHONLIBS_FOUND} STREQUAL TRUE)
   MESSAGE(FATAL_ERROR "Python has not been found.")
ENDIF (NOT ${PYTHONLIBS_FOUND} STREQUAL TRUE)

INCLUDE(FindPythonInterp)
IF (NOT ${PYTHONINTERP_FOUND} STREQUAL TRUE)
   MESSAGE(FATAL_ERROR "Python executable has not been found.")
ENDIF (NOT ${PYTHONINTERP_FOUND} STREQUAL TRUE)

# provide path to library libdynamic-graph.so
LINK_DIRECTORIES(${DYNAMIC_GRAPH_LIBRARY_DIRS})
florent's avatar
florent committed
22
ADD_DEFINITIONS(${DYNAMIC_GRAPH_CFLAGS})
florent's avatar
florent committed
23
24
25
26
27
28
29
30
31
32
33

#
#
#  Python bindings
#
#

SET(PYTHON_MODULE wrap)

ADD_LIBRARY(${PYTHON_MODULE}
	MODULE
34
35
36
	dynamic-graph-py.cc
	signal-base-py.cc
	entity-py.cc
florent's avatar
florent committed
37
	factory-py.cc
38
	signal-caster-py.cc
39
)
florent's avatar
florent committed
40
41
42
43
44

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

florent's avatar
florent committed
45
46
TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${DYNAMIC_GRAPH_LIBRARIES})

florent's avatar
florent committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})

#
# Installation
#

EXEC_PROGRAM(${PYTHON_EXECUTABLE} ARGS "-c \"from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='')\""
  OUTPUT_VARIABLE PYTHON_SITELIB)

MESSAGE(STATUS "PYTHON_SITELIB=${PYTHON_SITELIB}")

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

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

SET (PYTHON_SOURCES
    dynamic_graph/__init__.py
66
67
    dynamic_graph/entity.py
    dynamic_graph/signal_base.py
florent's avatar
florent committed
68
69
70
71
72
73
74
75
76
77
78
79
)

SET (PYTHON_SOURCES_FULLPATH "")
FOREACH (SOURCE ${PYTHON_SOURCES})
    SET(PYTHON_SOURCES_FULLPATH
    	${PYTHON_SOURCES_FULLPATH}
	${CMAKE_SOURCE_DIR}/src/${SOURCE}
    )
ENDFOREACH (SOURCE)

INSTALL(FILES ${PYTHON_SOURCES_FULLPATH}
	DESTINATION ${PYTHON_INSTALL_DIR})