]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseVTK.cmake
#3106 crea Bug New Normal - branch vtk7itk4 compilation with vtk7
[crea.git] / cmake / CREAMacro_FindAndUseVTK.cmake
1 # ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
4 #                        pour la Santé)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and 
10 #  abiding by the rules of distribution of free software. You can  use, 
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
12 #  license as circulated by CEA, CNRS and INRIA at the following URL 
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability. 
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */ 
25
26
27 MACRO(CREA_FIND_AND_USE_VTK)
28   #---------------------------------------------------------------------------
29   IF(NOT VTK_FOUND)
30     # Search VTK
31         message("DFCH--VTK: CREAMacro_FindAndUseVTK.cmake: " ${CMAKE_CURRENT_LIST_FILE})
32         message("DFCH--VTK: CREAMacro_FindAndUseVTK.cmake: " ${_IMPORT_PREFIX})
33     FIND_PACKAGE(VTK)
34     # If vtk found
35     IF(VTK_FOUND)
36
37       MESSAGE ( STATUS "=======================================")
38       MESSAGE ( STATUS "Looking for VTK... found")
39       MESSAGE ( STATUS "* Dir     = ${VTK_DIR}")
40       MESSAGE ( STATUS "* Version = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
41       SET(VTK_BUILD_SETTINGS_FILE OFF)      
42         INCLUDE(${VTK_USE_FILE})
43         LINK_DIRECTORIES(${VTK_DIR}) #DFCH -- 16/7/2012
44
45         IF(VTK_USE_GL2PS)
46                 add_definitions(-DUSE_WXGLCANVAS)
47                 # CMake 2.6:
48                 # technically those packages are not required since one can still use the Motif/X11 version and not the gtk one:
49                 FIND_PACKAGE(PkgConfig)
50                 pkg_check_modules (GTK2 gtk+-2.0)
51                 #MESSAGE("${GTK2_INCLUDE_DIRS}")
52                 INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
53                 LINK_LIBRARIES(${GTK2_LIBRARIES})
54                 # Can I require all my user to have the gl lib on linux, even if they do not really need it...
55                 SET(WXGLCANVASLIBS "gl")
56         ENDIF(VTK_USE_GL2PS)  
57
58       CREA_DEFINE( USE_VTK )
59       CREA_DEFINE( _USE_VTK_ )
60
61 ##EED 2017-01-01 Migration VTK7
62 IF("${VTK_MAJOR_VERSION}" LESS 6)
63         SET(VTK_LIBRARIES
64                 vtkCommon     # Mandatory
65                 vtkFiltering  # vtkImageData
66                 vtkRendering  # vtkProp3D
67                 vtkWidgets    # vtkImagePlaneWidget
68                 vtkIO         # vtkMetaImageReader/Writer
69                 vtkImaging    # filters such as vtkImageAnisotropicDiffusion3D
70                 vtkGraphics   # vtkContourFilter, sources
71                 vtkVolumeRendering # Mappers 
72                 vtkGenericFiltering
73                 vtkHybrid
74 #               vtkInfovis
75 #               vtkViews
76         )
77         IF(NOT USE_ITK)
78                 SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO)
79     ENDIF(NOT USE_ITK)
80
81 ENDIF("${VTK_MAJOR_VERSION}" LESS 6)
82
83
84 ##EED 2017-01-01 Migration VTK7
85 IF("${VTK_MAJOR_VERSION}" GREATER 5)
86         SET(VTK_LIBRARIES
87                 vtkCommonCore
88                 vtkCommonColor
89                 vtkCommonExecutionModel
90                 vtkCommonSystem
91                 vtktiff
92                 vtkjpeg
93                 vtkpng
94                 vtkDICOMParser
95                 vtkmetaio
96                 vtkIOImage
97                 vtkIOGeometry
98                 vtkFiltersGeometry
99                 vtkCommonComputationalGeometry
100                 vtkRenderingCore
101                 vtkFiltersSources
102                 vtkInteractionStyle
103                 vtkalglib
104                 vtkImagingFourier
105                 vtkFiltersStatistics
106                 vtkFiltersExtraction
107                 vtkImagingCore
108                 vtkRenderingFreeType
109                 vtksys
110                 vtkRenderingOpenGL2
111                 vtkRenderingVolumeOpenGL2
112                 vtkRenderingGL2PSOpenGL2
113                 vtkIOLegacy
114                 vtkImagingColor
115                 vtkImagingSources
116                 vtkFiltersHybrid
117                 vtkFiltersModeling
118                 vtkImagingGeneral
119                 vtkImagingHybrid
120                 vtkexpat
121                 vtkIOXMLParser
122                 vtkIOXML
123                 vtkRenderingVolume
124                 vtkInteractionWidgets
125                 vtkRenderingAnnotation
126                 vtkInteractionImage 
127                 vtkglew
128
129     vtkalglib                       
130     vtkFiltersHybrid           
131     vtkImagingCore           
132     vtkIOLegacy        
133     vtkRenderingAnnotation
134     vtkChartsCore
135     vtkFiltersHyperTree        
136     vtkImagingFourier        
137     vtkIOLSDyna        
138     vtkRenderingContext2D
139     vtkCommonColor                  
140     vtkFiltersImaging          
141     vtkImagingGeneral        
142     vtkIOMINC          
143     vtkRenderingContextOpenGL2
144     vtkCommonComputationalGeometry  
145     vtkFiltersModeling         
146     vtkImagingHybrid         
147     vtkIOMovie         
148     vtkRenderingCore
149     vtkCommonCore                   
150     vtkFiltersParallel         
151     vtkImagingMath           
152     vtkIONetCDF        
153     vtkRenderingFreeType
154     vtkCommonDataModel              
155     vtkFiltersParallelImaging  
156     vtkImagingMorphological  
157     vtkIOParallel      
158     vtkRenderingGL2PSOpenGL2
159     vtkCommonExecutionModel         
160     vtkFiltersPoints           
161     vtkImagingSources        
162     vtkIOParallelXML   
163     vtkRenderingImage
164     vtkCommonMath                   
165     vtkFiltersProgrammable     
166     vtkImagingStatistics     
167     vtkIOPLY           
168     vtkRenderingLabel
169     vtkCommonMisc                   
170     vtkFiltersSelection        
171     vtkImagingStencil        
172     vtkIOSQL           
173     vtkRenderingLOD
174     vtkCommonSystem                 
175     vtkFiltersSMP              
176     vtkInfovisCore           
177     vtkIOTecplotTable  
178     vtkRenderingOpenGL2
179     vtkCommonTransforms             
180     vtkFiltersSources          
181     vtkInfovisLayout         
182     vtkIOVideo         
183     vtkRenderingQt
184     vtkDICOMParser                  
185     vtkFiltersStatistics       
186     vtkInteractionImage      
187     vtkIOXML           
188     vtkRenderingVolume
189     vtkDomainsChemistry             
190     vtkFiltersTexture          
191     vtkInteractionStyle      
192     vtkIOXMLParser     
193     vtkRenderingVolumeOpenGL2
194     vtkDomainsChemistryOpenGL2      
195     vtkFiltersVerdict          
196     vtkInteractionWidgets    
197     vtkjpeg            
198     vtksqlite
199     vtkexoIIc                       
200     vtkfreetype                
201     vtkIOAMR                 
202     vtkjsoncpp         
203     vtksys
204     vtkexpat                        
205     vtkGeovisCore              
206     vtkIOCore                
207     vtklibxml2         
208     vtktiff
209     vtkFiltersAMR                   
210     vtkgl2ps                   
211     vtkIOEnSight             
212     vtkmetaio          
213 #    vtkverdict
214     vtkFiltersCore                  
215     vtkglew                    
216     vtkIOExodus              
217     vtkNetCDF          
218     vtkViewsContext2D
219     vtkFiltersExtraction            
220     vtkGUISupportQt            
221     vtkIOExport              
222     vtkNetCDF_cxx      
223     vtkViewsCore
224     vtkFiltersFlowPaths             
225     vtkGUISupportQtSQL         
226     vtkIOGeometry            
227     vtkoggtheora       
228     vtkViewsGeovis
229     vtkFiltersGeneral               
230     vtkhdf5                    
231     vtkIOImage               
232     vtkParallelCore    
233     vtkViewsInfovis
234     vtkFiltersGeneric               
235     vtkhdf5_hl                 
236     vtkIOImport              
237     vtkpng             
238     vtkViewsQt
239     vtkFiltersGeometry              
240     vtkImagingColor            
241     vtkIOInfovis             
242     vtkproj4               
243     vtkzlib
244
245
246         )
247 ENDIF("${VTK_MAJOR_VERSION}" GREATER 5)
248
249
250         MARK_AS_ADVANCED(VTK_DIR)
251     ELSE(VTK_FOUND)
252       message(FATAL_ERROR "VTK_DIR not found")
253     ENDIF(VTK_FOUND)
254   ENDIF(NOT VTK_FOUND)  
255   #---------------------------------------------------------------------------
256 ENDMACRO(CREA_FIND_AND_USE_VTK)