CMakeLists.txt 1.55 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
34
35
36
37
38
39

#
#
#  Python bindings
#
#

SET(PYTHON_MODULE wrap)

ADD_LIBRARY(${PYTHON_MODULE}
	MODULE
	dynamic-graph-py.cc)

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

florent's avatar
florent committed
40
41
TARGET_LINK_LIBRARIES(${PYTHON_MODULE} ${DYNAMIC_GRAPH_LIBRARIES})

florent's avatar
florent committed
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
70
71
72
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
)

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})