]> 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             vtkalglib                       
88             vtkFiltersHybrid           
89             vtkImagingCore           
90             vtkIOLegacy        
91             vtkRenderingAnnotation
92             vtkChartsCore
93             vtkFiltersHyperTree        
94             vtkImagingFourier        
95             vtkIOLSDyna        
96             vtkRenderingContext2D
97             vtkCommonColor                  
98             vtkFiltersImaging          
99             vtkImagingGeneral        
100             vtkIOMINC          
101             vtkRenderingContextOpenGL2
102             vtkCommonComputationalGeometry  
103             vtkFiltersModeling         
104             vtkImagingHybrid         
105             vtkIOMovie         
106             vtkRenderingCore
107             vtkCommonCore                   
108             vtkFiltersParallel         
109             vtkImagingMath           
110             vtkIONetCDF        
111             vtkRenderingFreeType
112             vtkCommonDataModel              
113             vtkFiltersParallelImaging  
114             vtkImagingMorphological  
115             vtkIOParallel      
116             vtkRenderingGL2PSOpenGL2
117             vtkCommonExecutionModel         
118             vtkFiltersPoints           
119             vtkImagingSources        
120             vtkIOParallelXML   
121             vtkRenderingImage
122             vtkCommonMath                   
123             vtkFiltersProgrammable     
124             vtkImagingStatistics     
125             vtkIOPLY           
126             vtkRenderingLabel
127             vtkCommonMisc                   
128             vtkFiltersSelection        
129             vtkImagingStencil        
130             vtkIOSQL           
131             vtkRenderingLOD
132             vtkCommonSystem                 
133             vtkFiltersSMP              
134             vtkInfovisCore           
135             vtkIOTecplotTable  
136             vtkRenderingOpenGL2
137             vtkCommonTransforms             
138             vtkFiltersSources          
139             vtkInfovisLayout         
140             vtkIOVideo         
141             vtkRenderingQt
142             vtkDICOMParser                  
143             vtkFiltersStatistics       
144             vtkInteractionImage      
145             vtkIOXML           
146             vtkRenderingVolume
147             vtkDomainsChemistry             
148             vtkFiltersTexture          
149             vtkInteractionStyle      
150             vtkIOXMLParser     
151             vtkRenderingVolumeOpenGL2
152             vtkDomainsChemistryOpenGL2      
153             vtkFiltersVerdict          
154             vtkInteractionWidgets    
155             vtkjpeg            
156             vtksqlite
157             vtkexoIIc                       
158             vtkfreetype                
159             vtkIOAMR                 
160             vtkjsoncpp         
161             vtksys
162             vtkexpat                        
163             vtkGeovisCore              
164             vtkIOCore                
165             vtklibxml2         
166             vtktiff
167             vtkFiltersAMR                   
168             vtkgl2ps                   
169             vtkIOEnSight             
170             vtkmetaio          
171 #           vtkverdict
172             vtkFiltersCore                  
173             vtkglew                    
174             vtkIOExodus              
175             vtkNetCDF          
176             vtkViewsContext2D
177             vtkFiltersExtraction            
178             vtkGUISupportQt            
179             vtkIOExport              
180             vtkNetCDF_cxx      
181             vtkViewsCore
182             vtkFiltersFlowPaths             
183             vtkGUISupportQtSQL         
184             vtkIOGeometry            
185             vtkoggtheora       
186             vtkViewsGeovis
187             vtkFiltersGeneral               
188             vtkhdf5                    
189             vtkIOImage               
190             vtkParallelCore    
191             vtkViewsInfovis
192             vtkFiltersGeneric               
193             vtkhdf5_hl                 
194             vtkIOImport              
195             vtkpng             
196             vtkViewsQt
197             vtkFiltersGeometry              
198             vtkImagingColor            
199             vtkIOInfovis             
200             vtkproj4               
201             vtkzlib
202         )
203 ENDIF("${VTK_MAJOR_VERSION}" GREATER 5)
204
205
206         MARK_AS_ADVANCED(VTK_DIR)
207     ELSE(VTK_FOUND)
208       message(FATAL_ERROR "VTK_DIR not found")
209     ENDIF(VTK_FOUND)
210   ENDIF(NOT VTK_FOUND)  
211   #---------------------------------------------------------------------------
212 ENDMACRO(CREA_FIND_AND_USE_VTK)