]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseVTK.cmake
#3204 crea Feature New Normal branch mingw64
[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             vtkCommonComputationalGeometry  
102             vtkFiltersModeling         
103             vtkImagingHybrid         
104             vtkIOMovie         
105             vtkRenderingCore
106             vtkCommonCore                   
107             vtkFiltersParallel         
108             vtkImagingMath           
109             vtkIONetCDF        
110             vtkRenderingFreeType
111             vtkCommonDataModel              
112             vtkFiltersParallelImaging  
113             vtkImagingMorphological  
114             vtkIOParallel      
115             vtkCommonExecutionModel         
116             vtkFiltersPoints           
117             vtkImagingSources        
118             vtkIOParallelXML   
119             vtkRenderingImage
120             vtkCommonMath                   
121             vtkFiltersProgrammable     
122             vtkImagingStatistics     
123             vtkIOPLY           
124             vtkRenderingLabel
125             vtkCommonMisc                   
126             vtkFiltersSelection        
127             vtkImagingStencil        
128             vtkIOSQL           
129             vtkRenderingLOD
130             vtkCommonSystem                 
131             vtkFiltersSMP              
132             vtkInfovisCore           
133             vtkIOTecplotTable  
134             vtkCommonTransforms             
135             vtkFiltersSources          
136             vtkInfovisLayout         
137             vtkIOVideo         
138             vtkDICOMParser                  
139             vtkFiltersStatistics       
140             vtkInteractionImage      
141             vtkIOXML           
142             vtkRenderingVolume
143             vtkDomainsChemistry             
144             vtkFiltersTexture          
145             vtkInteractionStyle      
146             vtkIOXMLParser     
147             vtkFiltersVerdict          
148             vtkInteractionWidgets    
149             vtkjpeg            
150             vtksqlite
151             vtkexoIIc                       
152             vtkfreetype                
153             vtkIOAMR                 
154             vtkjsoncpp         
155             vtksys
156             vtkexpat                        
157             vtkGeovisCore              
158             vtkIOCore                
159             vtklibxml2         
160             vtktiff
161             vtkFiltersAMR                   
162             vtkgl2ps                   
163             vtkIOEnSight             
164             vtkmetaio          
165 #           vtkverdict
166             vtkFiltersCore                  
167             vtkIOExodus              
168             vtkNetCDF          
169             vtkViewsContext2D
170             vtkFiltersExtraction            
171             vtkIOExport              
172             vtkViewsCore
173             vtkFiltersFlowPaths             
174             vtkIOGeometry            
175             vtkoggtheora       
176             vtkViewsGeovis
177             vtkFiltersGeneral               
178             vtkhdf5                    
179             vtkIOImage               
180             vtkParallelCore    
181             vtkViewsInfovis
182             vtkFiltersGeneric               
183             vtkhdf5_hl                 
184             vtkIOImport              
185             vtkpng             
186             vtkFiltersGeometry              
187             vtkImagingColor            
188             vtkIOInfovis             
189             vtkproj4               
190             vtkzlib
191
192 #           vtkRenderingVolumeOpenGL
193 #           vtkRenderingOpenGL
194 #           vtkRenderingGL2PS
195 #           vtkRenderingContextOpenGL
196
197             vtkglew                    
198             vtkRenderingVolumeOpenGL2
199             vtkDomainsChemistryOpenGL2      
200             vtkRenderingOpenGL2
201             vtkRenderingGL2PSOpenGL2
202             vtkRenderingContextOpenGL2
203
204 #           vtkRenderingQt
205 #           vtkGUISupportQt            
206 #           vtkGUISupportQtSQL         
207 #           vtkViewsQt
208 #           vtkNetCDF_cxx      
209         )
210         IF (WIN32)
211           SET(VTK_LIBRARIES ${VTK_LIBRARIES} )
212     ELSE(WIN32)
213           SET(VTK_LIBRARIES ${VTK_LIBRARIES} 
214             vtkRenderingQt
215             vtkGUISupportQt            
216             vtkGUISupportQtSQL         
217             vtkViewsQt
218             vtkNetCDF_cxx       
219                 )
220         ENDIF(WIN32)
221         
222         
223 ENDIF("${VTK_MAJOR_VERSION}" GREATER 5)
224
225
226         MARK_AS_ADVANCED(VTK_DIR)
227     ELSE(VTK_FOUND)
228       message(FATAL_ERROR "VTK_DIR not found")
229     ENDIF(VTK_FOUND)
230   ENDIF(NOT VTK_FOUND)  
231   #---------------------------------------------------------------------------
232 ENDMACRO(CREA_FIND_AND_USE_VTK)