]> Creatis software - gdcm.git/blob - gdcmPython/Makefile.am
ENH: Fix compilation on Win32
[gdcm.git] / gdcmPython / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2
3 ### VTK related
4 VTK_INC = -I/usr/include/vtk
5 LIBS_VTK=-L/usr/lib/vtk \
6          -lvtkCommon -lvtkIO -lvtkFiltering -lvtkRendering -lvtkGraphics \
7          -lvtkImaging -lvtkpng -lvtkzlib -lvtkjpeg -lvtkexpat -lvtktiff \
8          -lvtkftgl -lvtkfreetype
9 LIBS_VTK_PYTHON= $(LIBS_VTK) \
10          -lvtkCommonPython -lvtkIOPython -lvtkFilteringPython \
11          -lvtkRenderingPython -lvtkGraphicsPython -lvtkImagingPython
12 ### Gdcm itself:
13 GDCM_INC    = -I$(top_srcdir)/src  -I$(top_builddir)
14 ### Vtk wrappers of gdcm relate:
15 VTKGDCM_DIR = $(top_srcdir)/vtk/
16 VTKGDCM_INC = -I$(VTKGDCM_DIR)
17 ### Swig related (for wrapping Gdcm):
18 SWIG_INC    = $(PYTHON_INCLUDES) $(GDCM_INC) 
19
20 ### The resulting include path:
21 INCLUDES    = $(GDCM_INC) $(PYTHON_INCLUDES) $(VTK_INC) $(VTKGDCM_INC)
22
23 ### Since maude_LDFLAGS cannot be defined conditionaly:
24 pygdcm_la_LDFLAGS = -module -avoid-version -L$(top_builddir)/src/.libs
25 vtkgdcmPython_la_LDFLAGS = -module -avoid-version
26
27 ############################################################
28 if BUILD_PYTHON
29 pythondir = $(prefix)/lib/python${PYTHON_VERSION}/site-packages/gdcm
30 if BUILD_VTK
31 GDCMVTKLIB = vtkgdcmPython.la
32 endif
33 python_LTLIBRARIES = pygdcm.la $(GDCMVTKLIB)
34
35 ############ Gdcm python wrappers:
36 pygdcm_la_SOURCES = gdcm_wrap.cxx
37 pygdcm_la_LIBADD = $(top_builddir)/src/libgdcm.la -lstdc++
38 gdcm_wrap.cxx: $(srcdir)/gdcm.i
39         $(SWIG)  -python -c++ $(SWIG_INC) -o $@ $<
40
41 ############ Vtk wrappers of Gdcm wrapped for python
42 if BUILD_VTK
43 PYTHON_LIB_BASENAME=vtkgdcmPython
44
45 # Python wrappers
46 PYTHON_WRAPPER = vtkWrapPython
47 PYTHON_WRAPPER_INIT=./vtkWrapPythonInit
48 PWFLAGS=hints
49
50 vtkgdcmPython_la_SOURCES =  \
51         vtkGdcmReaderPython.cxx     \
52         vtkGdcmInit.cxx
53 vtkgdcmPython_la_LIBADD = $(top_builddir)/vtk/libvtkgdcm.la \
54                              $(LIBS_VTK_PYTHON)
55
56 vtkGdcmReaderPython.cxx: $(VTKGDCM_DIR)/vtkGdcmReader.h
57         $(PYTHON_WRAPPER) $< $(PWFLAGS) $@
58
59 vtkGdcmInit.cxx : $(VTKGDCM_DIR)/vtkGdcmReader.h $(PYTHON_WRAPPER_INIT)
60         $(PYTHON_WRAPPER_INIT) $(PYTHON_LIB_BASENAME) \
61         vtkGdcmReader.h \
62         > $@
63
64 $(PYTHON_WRAPPER_INIT) : vtkWrapPythonInit.c
65         gcc -o $@ $<
66 endif### BUILD_PYTHON #######################################
67
68 ############ Automake general usage classics:
69 MOSTLYCLEANFILES = $(pygdcm_la_SOURCES) $(vtkgdcmPython_la_SOURCES)
70 BUILT_SOURCES =    $(pygdcm_la_SOURCES) $(vtkgdcmPython_la_SOURCES)
71 CLEANFILES = gdcm_wrap.cxx gdcm.py gdcm.pyc $(PYTHON_WRAPPER_INIT)
72
73 dist-hook:
74         rm -f $(distdir)/gdcm_wrap.cxx
75
76 install-data-local:
77         @INSTALL@ -m 0644 gdcm.py $(DESTDIR)$(pythondir)
78         @INSTALL@ -m 0644 __init__.py $(DESTDIR)$(pythondir)
79         cp -a $(DESTDIR)$(pythondir)/pygdcm.so $(DESTDIR)$(pythondir)/_gdcm.so
80 else
81 all:
82 endif
83
84 EXTRA_DIST =  gdcm.i __init__.py testSuite.py