]> Creatis software - gdcm.git/blob - gdcmPython/CMakeLists.txt
doh
[gdcm.git] / gdcmPython / CMakeLists.txt
1 #IF(GDCM_WRAP_PYTHON)
2 #If we reach this dir we have selected this option
3
4
5 #TODO
6 #http://www.cmake.org/pipermail/cmake/2003-August/004185.html
7 #http://www.cmake.org/pipermail/cmake/2003-January/001092.html
8
9
10 INCLUDE_DIRECTORIES(
11   ${GDCM_SOURCE_DIR}/src
12   ${PYTHON_INCLUDE_PATH}
13 )
14
15 SET(GDCM_INC
16   ${GDCM_SOURCE_DIR}/src
17 #  -I$(top_builddir)
18 )
19
20 SET(SWIG_INC
21   ${PYTHON_INCLUDES}
22   ${GDCM_INC}
23 )
24
25 ADD_CUSTOM_TARGET(mathieu ALL)
26
27 SET(GDCM_PYTHON_SOURCES
28   gdcm_wrap.cxx
29 )
30
31 SET_SOURCE_FILES_PROPERTIES(gdcm_wrap.cxx GENERATED)
32
33 ADD_LIBRARY(pygdcm ${GDCM_PYTHON_SOURCES})
34 TARGET_LINK_LIBRARIES(pygdcm 
35   ${PYTHON_LIBRARY}
36   gdcm
37 )
38
39 #-----------------------------------------------------------------------------
40 # As of 09/10/2003 there was no FindSWIG.cmake
41 # later we should use SWIG instead of swig
42 # Build our custom command :
43 ADD_CUSTOM_COMMAND(
44   SOURCE    ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i
45   COMMAND   swig
46   ARGS      -python -c++ -I${GDCM_SOURCE_DIR}/src -o 
47             ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx 
48             ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i 
49   TARGET    pygdcm
50   OUTPUTS   ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx
51 )
52
53
54
55
56 IF(GDCM_VTK)
57   INCLUDE_DIRECTORIES(
58     ${GDCM_SOURCE_DIR}/vtk
59   )
60
61   SET(vtkgdcmPython_la_SOURCES
62 #      vtkGdcmReaderPython.cxx
63 #      vtkGdcmInit.cxx
64       ${GDCM_SOURCE_DIR}/vtk/vtkGdcmReader.cxx
65   )
66   SET_SOURCE_FILES_PROPERTIES(vtkGdcmReaderPython.cxx GENERATED)
67   #vtkWrapPythonInit.c
68   
69   # The C++ files must be made into a C++ library
70   #ADD_LIBRARY ( vtkgdcmPython ${vtkgdcmPython_la_SOURCES})
71
72   # set the libraries to link against
73   #TARGET_LINK_LIBRARIES(vtkgdcmPython vtkCommon)
74
75   # Configure Python module, which is the plugin itself
76   IF (GDCM_WRAP_PYTHON)
77     VTK_WRAP_PYTHON2(vtkgdcmPython gdcmfoo
78                    ${vtkgdcmPython_la_SOURCES})
79     ADD_LIBRARY(vtkgdcmPython SHARED ${gdcmfoo})
80     TARGET_LINK_LIBRARIES (vtkgdcmPython
81                          pygdcm
82                          vtkgdcm
83                          vtkCommonPython
84                          vtkIOPython)
85   ENDIF (GDCM_WRAP_PYTHON)
86 ENDIF(GDCM_VTK)
87
88 #I should install in path of PYTHON_LIBRARY
89 GET_FILENAME_COMPONENT(PYTHON_LIB_INSTALL ${PYTHON_LIBRARY} PATH)
90 GET_FILENAME_COMPONENT(SITEPACKAGE ${PYTHON_LIB_INSTALL}/../site-packages ABSOLUTE)
91 MESSAGE(STATUS ${SITEPACKAGE})
92 #INSTALL_FILES(/include "\\.h$")
93 #INSTALL_TARGETS(/lib/ gdcm)