]> Creatis software - gdcm.git/blob - gdcmPython/CMakeLists.txt
*ENH: Update CMakeLists
[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 )
18
19 SET(SWIG_INC
20   ${PYTHON_INCLUDES}
21   ${GDCM_INC}
22 )
23
24 ADD_CUSTOM_TARGET(mathieu ALL)
25
26 SET(GDCM_PYTHON_SOURCES
27   gdcm_wrap.cxx
28 )
29
30 SET_SOURCE_FILES_PROPERTIES(gdcm_wrap.cxx GENERATED)
31
32 ADD_LIBRARY(pygdcm ${GDCM_PYTHON_SOURCES})
33 #http://www.cmake.org/pipermail/cmake/2003-August/004190.html
34 #SET_TARGET_PROPERTIES(pygdcm PROPERTIES PREFIX "")
35 TARGET_LINK_LIBRARIES(pygdcm 
36   ${PYTHON_LIBRARY}
37   gdcm
38 )
39
40 #-----------------------------------------------------------------------------
41 # As of 09/10/2003 there was no FindSWIG.cmake
42 # later we should use SWIG instead of swig
43 # Build our custom command :
44 ADD_CUSTOM_COMMAND(
45   SOURCE    ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i
46   COMMAND   swig
47   ARGS      -python -c++ -I${GDCM_SOURCE_DIR}/src -o 
48             ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx 
49             ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i 
50   TARGET    pygdcm
51   OUTPUTS   ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx
52 )
53
54 IF(GDCM_VTK)
55   INCLUDE_DIRECTORIES(
56     ${GDCM_SOURCE_DIR}/vtk
57   )
58
59   SET(vtkgdcmPython_la_SOURCES
60       ${GDCM_SOURCE_DIR}/vtk/vtkGdcmReader.cxx
61   )
62   SET_SOURCE_FILES_PROPERTIES(vtkGdcmReaderPython.cxx GENERATED)
63   
64   # The C++ files must be made into a C++ library
65   #ADD_LIBRARY ( vtkgdcmPython ${vtkgdcmPython_la_SOURCES})
66
67   # set the libraries to link against
68   #TARGET_LINK_LIBRARIES(vtkgdcmPython vtkCommon)
69
70   # Configure Python module, which is the plugin itself
71   IF (GDCM_WRAP_PYTHON)
72     VTK_WRAP_PYTHON2(vtkgdcmPython gdcmfoo
73                    ${vtkgdcmPython_la_SOURCES})
74     ADD_LIBRARY(vtkgdcmPython SHARED ${gdcmfoo})
75     TARGET_LINK_LIBRARIES (vtkgdcmPython
76                          pygdcm
77                          vtkgdcm
78                          vtkCommonPython
79                          vtkIOPython)
80   ENDIF (GDCM_WRAP_PYTHON)
81 ENDIF(GDCM_VTK)
82
83 #I should install in path of PYTHON_LIBRARY
84 #GET_FILENAME_COMPONENT(PYTHON_LIB_INSTALL ${PYTHON_LIBRARY} PATH)
85 #GET_FILENAME_COMPONENT(SITEPACKAGE ${PYTHON_LIB_INSTALL}/../site-packages ABSOLUTE)
86 #MESSAGE(STATUS ${SITEPACKAGE})
87 #INSTALL_FILES(/include "\\.h$")
88 #INSTALL_TARGETS(/lib/ gdcm)
89
90 # When installing swig-generated python module one should pay attention
91 # to library naming convention, see here for more detail:
92 # http://www.swig.org/Doc1.3/Python.html#n6
93 # even with the $swig -module mylib, there is always a trailing underscore added