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