]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseVTK.cmake
Merge branch 'vtk8itk5wx3-mingw64' of ssh://git.creatis.insa-lyon.fr/crea into vtk8it...
[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 message("EED CREAMacro_FindAndUseVTK.cmake  GTK2_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS} )
55 message("EED CREAMacro_FindAndUseVTK.cmake  GTK2_VERSION "${GTK2_VERSION} )
56                 # Can I require all my user to have the gl lib on linux, even if they do not really need it...
57                 SET(WXGLCANVASLIBS "gl")
58         ENDIF(VTK_USE_GL2PS)  
59
60       CREA_DEFINE( USE_VTK )
61       CREA_DEFINE( _USE_VTK_ )
62
63 ##EED 2017-01-01 Migration VTK7
64 IF("${VTK_MAJOR_VERSION}" LESS 6)
65         SET(VTK_LIBRARIES
66                 vtkCommon     # Mandatory
67                 vtkFiltering  # vtkImageData
68                 vtkRendering  # vtkProp3D
69                 vtkWidgets    # vtkImagePlaneWidget
70                 vtkIO         # vtkMetaImageReader/Writer
71                 vtkImaging    # filters such as vtkImageAnisotropicDiffusion3D
72                 vtkGraphics   # vtkContourFilter, sources
73                 vtkVolumeRendering # Mappers 
74                 vtkGenericFiltering
75                 vtkHybrid
76 #               vtkInfovis
77 #               vtkViews
78         )
79         IF(NOT USE_ITK)
80                 SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO)
81     ENDIF(NOT USE_ITK)
82
83 ENDIF("${VTK_MAJOR_VERSION}" LESS 6)
84
85
86 ##EED 2017-01-01 Migration VTK7
87 IF("${VTK_MAJOR_VERSION}" GREATER 5)
88         SET(VTK_LIBRARIES
89             vtkalglib                       
90             vtkFiltersHybrid           
91             vtkImagingCore           
92             vtkIOLegacy        
93             vtkRenderingAnnotation
94             vtkChartsCore
95             vtkFiltersHyperTree        
96             vtkImagingFourier        
97             vtkIOLSDyna        
98             vtkRenderingContext2D
99             vtkCommonColor                  
100             vtkFiltersImaging          
101             vtkImagingGeneral        
102             vtkIOMINC          
103             vtkCommonComputationalGeometry  
104             vtkFiltersModeling         
105             vtkImagingHybrid         
106             vtkIOMovie         
107             vtkRenderingCore
108             vtkCommonCore                   
109             vtkFiltersParallel         
110             vtkImagingMath           
111             vtkIONetCDF        
112             vtkRenderingFreeType
113             vtkCommonDataModel              
114             vtkFiltersParallelImaging  
115             vtkImagingMorphological  
116             vtkIOParallel      
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             vtkCommonTransforms             
137             vtkFiltersSources          
138             vtkInfovisLayout         
139             vtkIOVideo         
140             vtkDICOMParser                  
141             vtkFiltersStatistics       
142             vtkInteractionImage      
143             vtkIOXML           
144             vtkRenderingVolume
145             vtkDomainsChemistry             
146             vtkFiltersTexture          
147             vtkInteractionStyle      
148             vtkIOXMLParser     
149             vtkFiltersVerdict          
150             vtkInteractionWidgets    
151             vtkjpeg            
152             vtksqlite
153             vtkexoIIc                       
154             vtkfreetype                
155             vtkIOAMR                 
156             vtkjsoncpp         
157             vtksys
158             vtkexpat                        
159             vtkGeovisCore              
160             vtkIOCore                
161             vtklibxml2         
162             vtktiff
163             vtkFiltersAMR                   
164             vtkgl2ps                   
165             vtkIOEnSight             
166             vtkmetaio          
167 #           vtkverdict
168             vtkFiltersCore                  
169             vtkIOExodus              
170             vtkNetCDF          
171             vtkViewsContext2D
172             vtkFiltersExtraction            
173             vtkIOExport              
174             vtkViewsCore
175             vtkFiltersFlowPaths             
176             vtkIOGeometry            
177             vtkoggtheora       
178             vtkViewsGeovis
179             vtkFiltersGeneral               
180             vtkhdf5                    
181             vtkIOImage               
182             vtkParallelCore    
183             vtkViewsInfovis
184             vtkFiltersGeneric               
185             vtkhdf5_hl                 
186             vtkIOImport              
187             vtkpng             
188             vtkFiltersGeometry              
189             vtkImagingColor            
190             vtkIOInfovis             
191             vtkproj4               
192             vtkzlib
193
194 #           vtkRenderingVolumeOpenGL
195 #           vtkRenderingOpenGL
196 #           vtkRenderingGL2PS
197 #           vtkRenderingContextOpenGL
198
199             vtkglew                    
200             vtkRenderingVolumeOpenGL2
201             vtkDomainsChemistryOpenGL2      
202             vtkRenderingOpenGL2
203             vtkRenderingGL2PSOpenGL2
204             vtkRenderingContextOpenGL2
205         )
206         IF (WIN32)
207           SET(VTK_LIBRARIES ${VTK_LIBRARIES} )
208     ELSE(WIN32)
209           SET(VTK_LIBRARIES ${VTK_LIBRARIES} 
210 #           vtkRenderingQt
211 #           vtkGUISupportQt            
212 #           vtkGUISupportQtSQL         
213 #           vtkViewsQt
214 #           vtkNetCDF_cxx       
215                 )
216         ENDIF(WIN32)
217         
218         
219 ENDIF("${VTK_MAJOR_VERSION}" GREATER 5)
220
221
222         MARK_AS_ADVANCED(VTK_DIR)
223     ELSE(VTK_FOUND)
224       message(FATAL_ERROR "VTK_DIR not found")
225     ENDIF(VTK_FOUND)
226   ENDIF(NOT VTK_FOUND)  
227   #---------------------------------------------------------------------------
228 ENDMACRO(CREA_FIND_AND_USE_VTK)