]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseVTK.cmake
9541f57cd80c5c39cd8183dab81b43e3de1a35a0
[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     
34     FIND_PACKAGE(VTK)
35     
36     # If vtk found
37     IF(VTK_FOUND)
38
39       MESSAGE ( STATUS "=======================================")
40       MESSAGE ( STATUS "Looking for VTK... found")
41       MESSAGE ( STATUS "* Dir     = ${VTK_DIR}")
42       MESSAGE ( STATUS "* Version = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
43       SET(VTK_BUILD_SETTINGS_FILE OFF)
44       
45 ## EED 2022-07-21
46 ##      INCLUDE(${VTK_USE_FILE})
47 ##      LINK_DIRECTORIES(${VTK_DIR}) #DFCH -- 16/7/2012
48 INCLUDE_DIRECTORIES(include ${VTK_INCLUDE_DIRS} )
49
50         IF(VTK_USE_GL2PS)
51                 add_definitions(-DUSE_WXGLCANVAS)
52                 # CMake 2.6:
53                 # technically those packages are not required since one can still use the Motif/X11 version and not the gtk one:
54                 FIND_PACKAGE(PkgConfig)
55                 pkg_check_modules (GTK2 gtk+-2.0)
56                 #MESSAGE("${GTK2_INCLUDE_DIRS}")
57                 INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
58                 LINK_LIBRARIES(${GTK2_LIBRARIES})
59 message("EED CREAMacro_FindAndUseVTK.cmake  GTK2_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS} )
60 message("EED CREAMacro_FindAndUseVTK.cmake  GTK2_VERSION "${GTK2_VERSION} )
61                 # Can I require all my user to have the gl lib on linux, even if they do not really need it...
62                 SET(WXGLCANVASLIBS "gl")
63         ENDIF(VTK_USE_GL2PS)  
64
65       CREA_DEFINE( USE_VTK )
66       CREA_DEFINE( _USE_VTK_ )
67
68 ##EED 2017-01-01 Migration VTK7
69 IF("${VTK_MAJOR_VERSION}" LESS 6)
70         SET(VTK_LIBRARIES
71                 vtkCommon     # Mandatory
72                 vtkFiltering  # vtkImageData
73                 vtkRendering  # vtkProp3D
74                 vtkWidgets    # vtkImagePlaneWidget
75                 vtkIO         # vtkMetaImageReader/Writer
76                 vtkImaging    # filters such as vtkImageAnisotropicDiffusion3D
77                 vtkGraphics   # vtkContourFilter, sources
78                 vtkVolumeRendering # Mappers 
79                 vtkGenericFiltering
80                 vtkHybrid
81 #               vtkInfovis
82 #               vtkViews
83         )
84         IF(NOT USE_ITK)
85                 SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO)
86     ENDIF(NOT USE_ITK)
87
88 ENDIF("${VTK_MAJOR_VERSION}" LESS 6)
89
90
91 ##EED 2017-01-01 Migration VTK7
92 #IF("${VTK_MAJOR_VERSION}" GREATER 5)
93 #       SET(VTK_LIBRARIES
94 #           vtkalglib                       
95 #           vtkFiltersHybrid           
96 #           vtkImagingCore           
97 #           vtkIOLegacy        
98 #           vtkRenderingAnnotation
99 #           vtkChartsCore
100 #           vtkFiltersHyperTree        
101 #           vtkImagingFourier        
102 #           vtkIOLSDyna        
103 #           vtkRenderingContext2D
104 #           vtkCommonColor                  
105 #           vtkFiltersImaging          
106 #           vtkImagingGeneral        
107 #           vtkIOMINC          
108 #           vtkCommonComputationalGeometry  
109 #           vtkFiltersModeling         
110 #           vtkImagingHybrid         
111 #           vtkIOMovie         
112 #           vtkRenderingCore
113 #           vtkCommonCore                   
114 #           vtkFiltersParallel         
115 #           vtkImagingMath           
116 #           vtkIONetCDF        
117 #           vtkRenderingFreeType
118 #           vtkCommonDataModel              
119 #           vtkFiltersParallelImaging  
120 #           vtkImagingMorphological  
121 #           vtkIOParallel      
122 #           vtkCommonExecutionModel         
123 #           vtkFiltersPoints           
124 #           vtkImagingSources        
125 #           vtkIOParallelXML   
126 #           vtkRenderingImage
127 #           vtkCommonMath                   
128 #           vtkFiltersProgrammable     
129 #           vtkImagingStatistics     
130 #           vtkIOPLY           
131 #           vtkRenderingLabel
132 #           vtkCommonMisc                   
133 #           vtkFiltersSelection        
134 #           vtkImagingStencil        
135 #           vtkIOSQL           
136 #           vtkRenderingLOD
137 #           vtkCommonSystem                 
138 #           vtkFiltersSMP              
139 #           vtkInfovisCore           
140 #           vtkIOTecplotTable  
141 #           vtkCommonTransforms             
142 #           vtkFiltersSources          
143 #           vtkInfovisLayout         
144 #           vtkIOVideo         
145 #           vtkDICOMParser                  
146 #           vtkFiltersStatistics       
147 #           vtkInteractionImage      
148 #           vtkIOXML           
149 #           vtkRenderingVolume
150 #           vtkDomainsChemistry             
151 #           vtkFiltersTexture          
152 #           vtkInteractionStyle      
153 #           vtkIOXMLParser     
154 #           vtkFiltersVerdict          
155 #           vtkInteractionWidgets    
156 #           vtkjpeg            
157 #           vtksqlite
158 #           vtkexoIIc                       
159 #           vtkfreetype                
160 #           vtkIOAMR                 
161 #           vtkjsoncpp         
162 #           vtksys
163 #           vtkexpat                        
164 #           vtkGeovisCore              
165 #           vtkIOCore                
166 #           vtklibxml2         
167 #           vtktiff
168 #           vtkFiltersAMR                   
169 #           vtkgl2ps                   
170 #           vtkIOEnSight             
171 #           vtkmetaio          
172 ##          vtkverdict
173 #           vtkFiltersCore                  
174 #           vtkIOExodus              
175 #           vtkNetCDF          
176 #           vtkViewsContext2D
177 #           vtkFiltersExtraction            
178 #           vtkIOExport              
179 #           vtkViewsCore
180 #           vtkFiltersFlowPaths             
181 #           vtkIOGeometry            
182 #           vtkoggtheora       
183 #           vtkViewsGeovis
184 #           vtkFiltersGeneral               
185 #           vtkhdf5                    
186 #           vtkIOImage               
187 #           vtkParallelCore    
188 #           vtkViewsInfovis
189 #           vtkFiltersGeneric               
190 #           vtkhdf5_hl                 
191 #           vtkIOImport              
192 #           vtkpng             
193 #           vtkFiltersGeometry              
194 #           vtkImagingColor            
195 #           vtkIOInfovis             
196 #           vtkproj4               
197 #           vtkzlib
198 #
199 ##          vtkRenderingVolumeOpenGL
200 ##          vtkRenderingOpenGL
201 ##          vtkRenderingGL2PS
202 ##          vtkRenderingContextOpenGL
203 #
204 #           vtkglew                    
205 #           vtkRenderingVolumeOpenGL2
206 #           vtkDomainsChemistryOpenGL2      
207 #           vtkRenderingOpenGL2
208 #           vtkRenderingGL2PSOpenGL2
209 #           vtkRenderingContextOpenGL2
210 #       )
211         IF (WIN32)
212 #         SET(VTK_LIBRARIES ${VTK_LIBRARIES} )
213     ELSE(WIN32)
214 #         SET(VTK_LIBRARIES ${VTK_LIBRARIES}
215 #           vtkRenderingQt
216 #           vtkGUISupportQt            
217 #           vtkGUISupportQtSQL         
218 #           vtkViewsQt
219 #           vtkNetCDF_cxx       
220 #               )
221     message("EED-a vtk libraries: "${VTK_LIBRARIES})
222     message("EED-start vtk include dirs: "${VTK_INCLUDE_DIRS})
223     message("EED-end")
224     
225         ENDIF(WIN32)
226         
227
228   IF(VTK_USE_TDX)
229         SET(VTK_LIBRARIES ${VTK_LIBRARIES}  vtkRenderingTDx )
230   ENDIF(VTK_USE_TDX)
231
232         
233 # ENDIF("${VTK_MAJOR_VERSION}" GREATER 5)
234
235
236         MARK_AS_ADVANCED(VTK_DIR)
237     ELSE(VTK_FOUND)
238       message(FATAL_ERROR "VTK_DIR not found")
239     ENDIF(VTK_FOUND)
240   ENDIF(NOT VTK_FOUND)  
241   #---------------------------------------------------------------------------
242 ENDMACRO(CREA_FIND_AND_USE_VTK)