]> Creatis software - crea.git/blob - cmake/CREAMacro_FindAndUseVTK.cmake
#3392 vtk9itk5wx3-macos
[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_VERSION "${GTK2_VERSION} )
60                 # Can I require all my user to have the gl lib on linux, even if they do not really need it...
61                 SET(WXGLCANVASLIBS "gl")
62         ENDIF(VTK_USE_GL2PS)  
63
64       CREA_DEFINE( USE_VTK )
65       CREA_DEFINE( _USE_VTK_ )
66
67 ##EED 2017-01-01 Migration VTK7
68 IF("${VTK_MAJOR_VERSION}" LESS 6)
69         SET(VTK_LIBRARIES
70                 vtkCommon     # Mandatory
71                 vtkFiltering  # vtkImageData
72                 vtkRendering  # vtkProp3D
73                 vtkWidgets    # vtkImagePlaneWidget
74                 vtkIO         # vtkMetaImageReader/Writer
75                 vtkImaging    # filters such as vtkImageAnisotropicDiffusion3D
76                 vtkGraphics   # vtkContourFilter, sources
77                 vtkVolumeRendering # Mappers 
78                 vtkGenericFiltering
79                 vtkHybrid
80 #               vtkInfovis
81 #               vtkViews
82         )
83         IF(NOT USE_ITK)
84                 SET(VTK_LIBRARIES ${VTK_LIBRARIES} vtkIO)
85     ENDIF(NOT USE_ITK)
86
87 ENDIF("${VTK_MAJOR_VERSION}" LESS 6)
88
89
90 ##EED 2017-01-01 Migration VTK7
91 #IF("${VTK_MAJOR_VERSION}" GREATER 5)
92 #       SET(VTK_LIBRARIES
93 #           vtkalglib                       
94 #           vtkFiltersHybrid           
95 #           vtkImagingCore           
96 #           vtkIOLegacy        
97 #           vtkRenderingAnnotation
98 #           vtkChartsCore
99 #           vtkFiltersHyperTree        
100 #           vtkImagingFourier        
101 #           vtkIOLSDyna        
102 #           vtkRenderingContext2D
103 #           vtkCommonColor                  
104 #           vtkFiltersImaging          
105 #           vtkImagingGeneral        
106 #           vtkIOMINC          
107 #           vtkCommonComputationalGeometry  
108 #           vtkFiltersModeling         
109 #           vtkImagingHybrid         
110 #           vtkIOMovie         
111 #           vtkRenderingCore
112 #           vtkCommonCore                   
113 #           vtkFiltersParallel         
114 #           vtkImagingMath           
115 #           vtkIONetCDF        
116 #           vtkRenderingFreeType
117 #           vtkCommonDataModel              
118 #           vtkFiltersParallelImaging  
119 #           vtkImagingMorphological  
120 #           vtkIOParallel      
121 #           vtkCommonExecutionModel         
122 #           vtkFiltersPoints           
123 #           vtkImagingSources        
124 #           vtkIOParallelXML   
125 #           vtkRenderingImage
126 #           vtkCommonMath                   
127 #           vtkFiltersProgrammable     
128 #           vtkImagingStatistics     
129 #           vtkIOPLY           
130 #           vtkRenderingLabel
131 #           vtkCommonMisc                   
132 #           vtkFiltersSelection        
133 #           vtkImagingStencil        
134 #           vtkIOSQL           
135 #           vtkRenderingLOD
136 #           vtkCommonSystem                 
137 #           vtkFiltersSMP              
138 #           vtkInfovisCore           
139 #           vtkIOTecplotTable  
140 #           vtkCommonTransforms             
141 #           vtkFiltersSources          
142 #           vtkInfovisLayout         
143 #           vtkIOVideo         
144 #           vtkDICOMParser                  
145 #           vtkFiltersStatistics       
146 #           vtkInteractionImage      
147 #           vtkIOXML           
148 #           vtkRenderingVolume
149 #           vtkDomainsChemistry             
150 #           vtkFiltersTexture          
151 #           vtkInteractionStyle      
152 #           vtkIOXMLParser     
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 #           vtkIOExodus              
174 #           vtkNetCDF          
175 #           vtkViewsContext2D
176 #           vtkFiltersExtraction            
177 #           vtkIOExport              
178 #           vtkViewsCore
179 #           vtkFiltersFlowPaths             
180 #           vtkIOGeometry            
181 #           vtkoggtheora       
182 #           vtkViewsGeovis
183 #           vtkFiltersGeneral               
184 #           vtkhdf5                    
185 #           vtkIOImage               
186 #           vtkParallelCore    
187 #           vtkViewsInfovis
188 #           vtkFiltersGeneric               
189 #           vtkhdf5_hl                 
190 #           vtkIOImport              
191 #           vtkpng             
192 #           vtkFiltersGeometry              
193 #           vtkImagingColor            
194 #           vtkIOInfovis             
195 #           vtkproj4               
196 #           vtkzlib
197 #
198 ##          vtkRenderingVolumeOpenGL
199 ##          vtkRenderingOpenGL
200 ##          vtkRenderingGL2PS
201 ##          vtkRenderingContextOpenGL
202 #
203 #           vtkglew                    
204 #           vtkRenderingVolumeOpenGL2
205 #           vtkDomainsChemistryOpenGL2      
206 #           vtkRenderingOpenGL2
207 #           vtkRenderingGL2PSOpenGL2
208 #           vtkRenderingContextOpenGL2
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     
221         ENDIF(WIN32)
222         
223
224   IF(VTK_USE_TDX)
225         SET(VTK_LIBRARIES ${VTK_LIBRARIES}  vtkRenderingTDx )
226   ENDIF(VTK_USE_TDX)
227
228         
229 # ENDIF("${VTK_MAJOR_VERSION}" GREATER 5)
230
231
232         MARK_AS_ADVANCED(VTK_DIR)
233     ELSE(VTK_FOUND)
234       message(FATAL_ERROR "VTK_DIR not found")
235     ENDIF(VTK_FOUND)
236   ENDIF(NOT VTK_FOUND)  
237   #---------------------------------------------------------------------------
238 ENDMACRO(CREA_FIND_AND_USE_VTK)