X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=setup.py;h=6d8eee5da927f5c124a231fca0cf2aca0d2fcf27;hb=5fbee0c35cc0f02ceea5d5a8be0c1900c63143bb;hp=b1f59235ab8dcdbdcb6ef49f385743db015f988b;hpb=73dbefbe532057ce77d9f338a4dc093cdce89898;p=gdcm.git diff --git a/setup.py b/setup.py index b1f59235..6d8eee5d 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,7 @@ from WrapVTK import * ThisModule='gdcmPython' gdcmPythonSrcDir=ThisModule gdcmSrcDir ="src" +gdcmJpeg8SrcDir =os.path.join('src', 'jpeg', 'libijg8') gdcmvtkSrcDir ="vtk" gdcmDictsDir ="Dicts" gdcmTestDir ="Test" @@ -36,37 +37,53 @@ else: targetDir=os.path.join(targetDir, ThisModule) -# For the Swig compilation +### Sources section: determination of sources for the extensions: +# Sources 1a/ The kernel of gdcm itself (which wrapped with Swig) +# defines the first extension Sources = [] Sources.extend(glob.glob(os.path.join(gdcmSrcDir,"*.cxx"))) -Sources.extend(glob.glob(os.path.join(gdcmSrcDir,"*.h"))) Sources.append(os.path.join(gdcmPythonSrcDir,"gdcm.i")) +# Sources 1b/ The kernel of gdcm depends on a jpeg library whose sources are +# contained in subdir gdcmJpeg8SrcDir. But within this subdir +# some of the C files should not be compiled (refer to +# gdcmJpeg8SrcDir/Makefile.am) ! +Jpeg8Sources = glob.glob(os.path.join(gdcmJpeg8SrcDir,"j*.c")) +Jpeg8SourcesToRemove = ['jmemansi.c', 'jmemname.c', 'jmemdos.c', 'jmemmac.c'] +for Remove in Jpeg8SourcesToRemove: + ### Because setup.py is a multiple pass process we need to trap + ### the case were the files were allready wed out on a previous pass. + try: + Jpeg8Sources.remove(os.path.join(gdcmJpeg8SrcDir, Remove)) + except ValueError: + continue +Sources.extend(Jpeg8Sources) -# For the VTK compilation +# Sources 2/ The second extension contains the VTK classes (which we wrap +# with the vtk wrappers): VTK_INCLUDE_DIR=os.path.join(VTK_PATH,"include","vtk") VTK_LIB_DIR=os.path.join(VTK_PATH,"lib","vtk") - vtkSources = [] vtkSources.extend(glob.glob(os.path.join(gdcmvtkSrcDir,"vtk*.cxx"))) vtkSources.extend(glob.glob(os.path.join(gdcmSrcDir,"*.cxx"))) -# vtkSources.extend(glob.glob(os.path.join(gdcmvtkSrcDir,"vtk*.h"))) - +vtkSources.extend(Jpeg8Sources) vtkLibraries=["vtkCommon","vtkCommonPython", "vtkIO","vtkIOPython", "vtkFiltering","vtkFilteringPython"] +##### setup(name=ThisModule, - version="0.2", + version="0.3", description="...", author="frog", author_email="frog@creatis.insa-lyon.fr", url="http://www.creatis.insa-lyon.fr/", - packages=[ gdcmPythonSrcDir, + packages=[ '.', + gdcmPythonSrcDir, gdcmPythonSrcDir + '.demo' ], cmdclass={'build_ext':build_extWrap}, # redirects default build_ext ext_modules=[SwigExtension(name='_gdcm', sources=Sources, - include_dirs=[gdcmSrcDir], + include_dirs=[gdcmSrcDir,gdcmJpeg8SrcDir], libraries=libraries, define_macros=macros, swig_cpp=1, @@ -74,7 +91,8 @@ setup(name=ThisModule, ), VTKExtension(name='gdcmPython.vtkgdcmPython', sources=vtkSources, - include_dirs=[gdcmSrcDir,gdcmvtkSrcDir,VTK_INCLUDE_DIR], + include_dirs=[gdcmSrcDir,gdcmvtkSrcDir, + VTK_INCLUDE_DIR], libraries=libraries+vtkLibraries, define_macros=macros, library_dirs=[VTK_LIB_DIR],