CMakeLists.txt 26.3 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 1.6)
Ken Martin's avatar
Ken Martin committed
2
PROJECT(VTK)
3
INCLUDE_REGULAR_EXPRESSION("^(lex|vtk|png|j).*$")
4

5
6
7
8
# Don't build anything unless the version of CMake is high enough.
# The matching ELSE/ENDIF should be the last lines in the file.
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)

9
#-----------------------------------------------------------------------------
Brad King's avatar
Brad King committed
10
# VTK version number.  An even minor number corresponds to releases.
11
SET(VTK_MAJOR_VERSION 4)
Ken Martin's avatar
Ken Martin committed
12
SET(VTK_MINOR_VERSION 2)
Ken Martin's avatar
Ken Martin committed
13
SET(VTK_BUILD_VERSION 1)
14
15
SET(VTK_VERSION
    "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
Brad King's avatar
Brad King committed
16

17
18
#-----------------------------------------------------------------------------
# Output directories.
19
20
SET(LIBRARY_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
SET(EXECUTABLE_OUTPUT_PATH ${VTK_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
21
22
23
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
SET(VTK_LIBRARY_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
SET(VTK_EXECUTABLE_DIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
24
25
26
27
28
29
30
31
32
SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})

# Put "." in the rpath of all VTK shared libraries.
LINK_DIRECTORIES(.)

#-----------------------------------------------------------------------------
# Load some macros.
INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkDependentOption.cmake)
INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkThirdParty.cmake)
33

34
#-----------------------------------------------------------------------------
35
# Platform configuration tests.
36
37
INCLUDE(${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
Ken Martin's avatar
Ken Martin committed
38

Ken Martin's avatar
Ken Martin committed
39
40
41
42
43
44
SET(VTK_SIZEOF_CHAR   ${CMAKE_SIZEOF_CHAR})
SET(VTK_SIZEOF_DOUBLE ${CMAKE_SIZEOF_DOUBLE})
SET(VTK_SIZEOF_FLOAT  ${CMAKE_SIZEOF_FLOAT})
SET(VTK_SIZEOF_INT    ${CMAKE_SIZEOF_INT})
SET(VTK_SIZEOF_LONG   ${CMAKE_SIZEOF_LONG})
SET(VTK_SIZEOF_SHORT  ${CMAKE_SIZEOF_SHORT})
Ken Martin's avatar
Ken Martin committed
45

46
IF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")
47
48
  MESSAGE(STATUS "Checking support for C++ type bool")
  TRY_COMPILE(VTK_COMPILER_HAS_BOOL
49
              ${VTK_BINARY_DIR}/CMakeTmp/Bool
50
51
52
53
54
55
56
              ${VTK_SOURCE_DIR}/CMake/vtkTestBoolType.cxx
              OUTPUT_VARIABLE OUTPUT)
  IF(VTK_COMPILER_HAS_BOOL)
    MESSAGE(STATUS "Checking support for C++ type bool -- yes")
    SET(VTK_COMPILER_HAS_BOOL 1 CACHE INTERNAL "Support for C++ type bool")
  ELSE(VTK_COMPILER_HAS_BOOL)
    MESSAGE(STATUS "Checking support for C++ type bool -- no")
57
    SET(VTK_COMPILER_HAS_BOOL 0 CACHE INTERNAL "Support for C++ type bool")
58
59
60
61
62
    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log 
      "Determining if the C++ compiler supports type bool "
      "failed with the following output:\n"
      "${OUTPUT}\n" APPEND)
  ENDIF(VTK_COMPILER_HAS_BOOL)
63
ENDIF("VTK_COMPILER_HAS_BOOL" MATCHES "^VTK_COMPILER_HAS_BOOL$")
64

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
IF("VTK_EXPLICIT_TEMPLATES" MATCHES "^VTK_EXPLICIT_TEMPLATES")
  MESSAGE(STATUS "Checking support for C++ explicit template instantiation")
  TRY_COMPILE(VTK_EXPLICIT_TEMPLATES
              ${VTK_BINARY_DIR}
              ${VTK_SOURCE_DIR}/CMake/vtkTestExplicitInstantiation.cxx
              OUTPUT_VARIABLE OUTPUT)
  IF(VTK_EXPLICIT_TEMPLATES)
    MESSAGE(STATUS "Checking support for C++ explicit template instantiation -- yes")
    SET(VTK_EXPLICIT_TEMPLATES 1 CACHE INTERNAL "Support for C++ explict templates")
  ELSE(VTK_EXPLICIT_TEMPLATES)
    MESSAGE(STATUS "Checking support for C++ explict templates instantiation -- no")
    SET(VTK_EXPLICIT_TEMPLATES_BOOL 0 CACHE INTERNAL "Support for C++ explict templates")
    WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeError.log 
      "Determining if the C++ compiler supports explict template instantiation "
      "failed with the following output:\n"
      "${OUTPUT}\n" APPEND)
  ENDIF(VTK_EXPLICIT_TEMPLATES)
ENDIF("VTK_EXPLICIT_TEMPLATES" MATCHES "^VTK_EXPLICIT_TEMPLATES")

84
85
86
87
88
89
IF(CMAKE_COMPILER_IS_GNUCXX AND WIN32)
  # GCC on Cygwin cannot do explicit template instantiation correctly with
  # DLLs.
  SET(CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION 1)
ENDIF(CMAKE_COMPILER_IS_GNUCXX AND WIN32)

90
#-----------------------------------------------------------------------------
91
# Load the VTK CMake extension modules.
92
93
94
95
96
97
98

# Import the VTK_LOAD_CMAKE_EXTENSIONS macro.
INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake)

# Compile the extensions into the build tree and load them.
VTK_LOAD_CMAKE_EXTENSIONS(${VTK_SOURCE_DIR}/CMake ${VTK_BINARY_DIR}/CMake)

99
100
101
102
#-----------------------------------------------------------------------------
# Choose static or shared libraries.
OPTION(BUILD_SHARED_LIBS "Build VTK with shared libraries." OFF)
SET(VTK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
103

Brad King's avatar
Brad King committed
104
105
#-----------------------------------------------------------------------------
# Determine the set of VTK kits that should be built.
106
107
108
109
110
111
112
113
OPTION(VTK_USE_RENDERING "Build the vtkRendering kit.  Needed for displaying data." ON)
OPTION(VTK_USE_PATENTED
       "Build the vtkPatented kit.  These classes are patented and may require a license to use."
       OFF)
VTK_DEPENDENT_OPTION(VTK_USE_HYBRID "Build the vtkHybrid kit." OFF
                     "VTK_USE_RENDERING" OFF)
VTK_DEPENDENT_OPTION(VTK_USE_PARALLEL "Build the vtkParallel kit." OFF
                     "VTK_USE_RENDERING" OFF)
Brad King's avatar
Brad King committed
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

SET(VTK_KITS COMMON FILTERING IO GRAPHICS IMAGING)
IF(VTK_USE_RENDERING)
  SET(VTK_KITS ${VTK_KITS} RENDERING)
ENDIF(VTK_USE_RENDERING)
IF(VTK_USE_HYBRID)
  SET(VTK_KITS ${VTK_KITS} HYBRID)
ENDIF(VTK_USE_HYBRID)
IF(VTK_USE_PARALLEL)
  SET(VTK_KITS ${VTK_KITS} PARALLEL)
ENDIF(VTK_USE_PARALLEL)
IF(VTK_USE_PATENTED)
  SET(VTK_KITS ${VTK_KITS} PATENTED)
ENDIF(VTK_USE_PATENTED)

129
130
131
132
133
134
135
136
#-----------------------------------------------------------------------------
# Configure Dart testing support.
INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake)
MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
IF(BUILD_TESTING)
  ENABLE_TESTING()
ENDIF(BUILD_TESTING)

Brad King's avatar
Brad King committed
137
138
#-----------------------------------------------------------------------------
# Determine the set of language wrappers that should be built.
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
OPTION(VTK_WRAP_TCL "Wrap VTK classes into the TCL language." OFF)
OPTION(VTK_WRAP_PYTHON "Wrap VTK classes into the Python language." OFF)
OPTION(VTK_WRAP_JAVA "Wrap VTK classes into the Java language." OFF)

# Python requires shared libraries.
IF(VTK_WRAP_PYTHON)
  IF(NOT BUILD_SHARED_LIBS)
    MESSAGE(SEND_ERROR "VTK_WRAP_PYTHON requires BUILD_SHARED_LIBS to be ON.")
    SET(VTK_WRAP_PYTHON 0)
  ENDIF(NOT BUILD_SHARED_LIBS)
ENDIF(VTK_WRAP_PYTHON)

# Java requires shared libraries on Windows.
IF(VTK_WRAP_JAVA)
  IF(WIN32)
    IF(NOT BUILD_SHARED_LIBS)
      MESSAGE(SEND_ERROR "VTK_WRAP_JAVA requires BUILD_SHARED_LIBS to be ON.")
      SET(VTK_WRAP_JAVA 0)
    ENDIF(NOT BUILD_SHARED_LIBS)
  ENDIF(WIN32)
ENDIF(VTK_WRAP_JAVA)
Brad King's avatar
Brad King committed
160
161
162
163
164
165
166
167
168
169
170
171

SET(VTK_LANGUAGES "")
IF(VTK_WRAP_TCL)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} TCL)
ENDIF(VTK_WRAP_TCL)
IF(VTK_WRAP_PYTHON)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} PYTHON)
ENDIF(VTK_WRAP_PYTHON)
IF(VTK_WRAP_JAVA)
  SET(VTK_LANGUAGES ${VTK_LANGUAGES} JAVA)
ENDIF(VTK_WRAP_JAVA)

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#-----------------------------------------------------------------------------
# Dispatch the build into the proper subdirectories.

# Utility libraries and executables.
SUBDIRS(Wrapping Utilities)

# Kits.
SUBDIRS(Common Filtering Imaging Graphics IO)
IF(VTK_USE_RENDERING)
  SUBDIRS(Rendering)
ENDIF(VTK_USE_RENDERING)
IF(VTK_USE_HYBRID)
  SUBDIRS(Hybrid)
ENDIF(VTK_USE_HYBRID)
IF(VTK_USE_PATENTED)
  SUBDIRS(Patented)
ENDIF(VTK_USE_PATENTED)
IF(VTK_USE_PARALLEL)
  SUBDIRS(Parallel)
ENDIF(VTK_USE_PARALLEL)

# Wrapping.
IF(VTK_WRAP_TCL)
  SUBDIRS(Wrapping/Tcl)
ENDIF(VTK_WRAP_TCL)
IF(VTK_WRAP_PYTHON)
  SUBDIRS(Wrapping/Python)
ENDIF(VTK_WRAP_PYTHON)
IF(VTK_WRAP_JAVA)
  SUBDIRS(Wrapping/Java)
ENDIF(VTK_WRAP_JAVA)

# Testing.
IF(BUILD_TESTING)
  SUBDIRS(Common/Testing Filtering/Testing Graphics/Testing Imaging/Testing 
          IO/Testing)
  IF(VTK_USE_RENDERING)
    SUBDIRS(Rendering/Testing)
  ENDIF(VTK_USE_RENDERING)
  IF(VTK_USE_HYBRID)
    SUBDIRS(Hybrid/Testing)
  ENDIF(VTK_USE_HYBRID)
  IF(VTK_USE_PARALLEL)
    SUBDIRS(Parallel/Testing)
  ENDIF(VTK_USE_PARALLEL)
  IF(VTK_USE_PATENTED)
    SUBDIRS(Patented/Testing)
  ENDIF(VTK_USE_PATENTED)
ENDIF(BUILD_TESTING)

# Examples.
IF(BUILD_EXAMPLES)
  SUBDIRS(Examples)
ENDIF(BUILD_EXAMPLES)

#-----------------------------------------------------------------------------
# Determine GUI.
SET(VTK_USE_X_OPTIONAL 0)
SET(VTK_USE_X_FORCE 0)
IF(CMAKE_HAS_X)
  IF(APPLE)
    SET(VTK_USE_X_OPTIONAL 1)
  ENDIF(APPLE)
  IF(CYGWIN)
    SET(VTK_USE_X_OPTIONAL 1)
  ENDIF(CYGWIN)
  SET(VTK_USE_X_FORCE ${VTK_USE_RENDERING})
ENDIF(CMAKE_HAS_X)

VTK_DEPENDENT_OPTION(VTK_USE_CARBON "Build classes using Carbon API." ON
                     "APPLE;VTK_USE_RENDERING" OFF)
VTK_DEPENDENT_OPTION(VTK_USE_COCOA "Build classes using Cocoa API." OFF
                     "APPLE;VTK_USE_RENDERING" OFF)
VTK_DEPENDENT_OPTION(VTK_USE_X
                     "Build classes for the X11 window system." OFF
                     "CMAKE_HAS_X;VTK_USE_RENDERING;VTK_USE_X_OPTIONAL"
                     "${VTK_USE_X_FORCE}")

IF(VTK_USE_CARBON AND VTK_USE_COCOA)
  MESSAGE(SEND_ERROR "Only one of VTK_USE_CARBON and VTK_USE_COCOA may be ON.")
  SET(VTK_USE_CARBON 0)
  SET(VTK_USE_COCOA 0)
ENDIF(VTK_USE_CARBON AND VTK_USE_COCOA)

#-----------------------------------------------------------------------------
# Select a streams library.
SET(VTK_USE_ANSI_STDLIB_DEFAULT ON)
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
  IF(CMAKE_BUILD_TOOL MATCHES "devenv")
  ELSE(CMAKE_BUILD_TOOL MATCHES "devenv")
    SET(VTK_USE_ANSI_STDLIB_DEFAULT OFF)
  ENDIF(CMAKE_BUILD_TOOL MATCHES "devenv")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
OPTION(VTK_USE_ANSI_STDLIB "Use the ANSI standard iostream library."
       ${VTK_USE_ANSI_STDLIB_DEFAULT})
MARK_AS_ADVANCED(VTK_USE_ANSI_STDLIB)

#-----------------------------------------------------------------------------
# Provide a few configuration options.
OPTION(BUILD_EXAMPLES "Build VTK examples." OFF)
OPTION(VTK_USE_64BIT_IDS "Build VTK with 64 bit ids" OFF)
OPTION(VTK_DEBUG_LEAKS "Build leak checking support into VTK." OFF)
MARK_AS_ADVANCED(VTK_DEBUG_LEAKS VTK_USE_64BIT_IDS)

VTK_DEPENDENT_OPTION(VTK_USE_MANGLED_MESA "Use mangled Mesa with OpenGL." OFF
                     "VTK_USE_RENDERING" OFF)
VTK_DEPENDENT_OPTION(VTK_OPENGL_HAS_OSMESA 
                     "The opengl library being used supports off screen Mesa calls." OFF
                     "VTK_USE_RENDERING;UNIX" OFF)
VTK_DEPENDENT_OPTION(VTK_USE_MPI
                     "Use Message Passing Interface (MPI) library for parallel support." OFF
                     "VTK_USE_PARALLEL" OFF)
VTK_DEPENDENT_OPTION(VTK_USE_VOLUMEPRO "Build VTK with VolumePro support." OFF
                     "VTK_USE_RENDERING" OFF)
VTK_DEPENDENT_OPTION(VTK_USE_MATROX_IMAGING
                     "Use Matrox Imaging Library for video input." OFF
                     "VTK_USE_HYBRID;WIN32" OFF)
VTK_DEPENDENT_OPTION(VTK_USE_VIDEO_FOR_WINDOWS
                     "Use Video for Windows for video input." OFF
                     "VTK_USE_HYBRID;WIN32" OFF)
IF(VTK_USE_COCOA)
  SET(VTK_DISABLE_TK_INIT 1)
ELSE(VTK_USE_COCOA)
  VTK_DEPENDENT_OPTION(VTK_DISABLE_TK_INIT
                       "Disables the automatic initialization of Tk widgets when loading the rendering library." OFF
297
                       "VTK_WRAP_TCL;VTK_USE_RENDERING" OFF)
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
  MARK_AS_ADVANCED(VTK_DISABLE_TK_INIT)
ENDIF(VTK_USE_COCOA)
MARK_AS_ADVANCED(VTK_OPENGL_HAS_OSMESA
                 VTK_USE_MANGLED_MESA
                 VTK_USE_MATROX_IMAGING
                 VTK_USE_MPI
                 VTK_USE_VIDEO_FOR_WINDOWS
                 VTK_USE_VOLUMEPRO)

#-----------------------------------------------------------------------------
# Provide options to use system versions of third-party libraries.
VTK_THIRD_PARTY_OPTION(ZLIB zlib)
VTK_THIRD_PARTY_OPTION(JPEG jpeg)
VTK_THIRD_PARTY_OPTION(PNG  png)
VTK_THIRD_PARTY_OPTION(TIFF tiff)
VTK_THIRD_PARTY_OPTION(EXPAT expat)

Brad King's avatar
Brad King committed
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
#-----------------------------------------------------------------------------
# VTK requires special compiler flags on some platforms.
IF(CMAKE_COMPILER_IS_GNUCXX)
  IF(WIN32)
    # The platform is gcc on cygwin.
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -mwin32")
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -mwin32")
  ENDIF(WIN32)
ELSE(CMAKE_COMPILER_IS_GNUCXX)
  IF(CMAKE_ANSI_CFLAGS)
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
  ENDIF(CMAKE_ANSI_CFLAGS)
  IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
     SET(VTK_REQUIRED_CXX_FLAGS
         "${VTK_REQUIRED_CXX_FLAGS} -timplicit_local -no_implicit_include")
  ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

IF(APPLE)
334
335
  SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} -no-cpp-precomp")
  SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -no-cpp-precomp")
336
  IF(VTK_USE_CARBON)
Brad King's avatar
Brad King committed
337
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} -fpascal-strings")
338
  ENDIF(VTK_USE_CARBON)
339
340
341
  IF(BUILD_SHARED_LIBS)
    SET(VTK_APPLE_SHARED_FLAGS_NEEDED 1)
  ENDIF(BUILD_SHARED_LIBS)
Brad King's avatar
Brad King committed
342
343
344
345
346
347
348
349
350
ENDIF(APPLE)

IF(VTK_USE_X)
  IF(CMAKE_X_CFLAGS)
    SET(VTK_REQUIRED_C_FLAGS "${VTK_REQUIRED_C_FLAGS} ${CMAKE_X_CFLAGS}")
    SET(VTK_REQUIRED_CXX_FLAGS "${VTK_REQUIRED_CXX_FLAGS} ${CMAKE_X_CFLAGS}")
  ENDIF(CMAKE_X_CFLAGS)
ENDIF(VTK_USE_X)

351
352
353
354
355
356
357
358
359
360
#-----------------------------------------------------------------------------
# Configure OpenGL support.
IF(VTK_USE_RENDERING)
  INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
ENDIF(VTK_USE_RENDERING)

#-----------------------------------------------------------------------------
# Configure Mangled MESA support.
IF(VTK_USE_MANGLED_MESA)
  INCLUDE(${VTK_SOURCE_DIR}/CMake/FindMangledMesa.cmake)
361
362
363
364

  MARK_AS_ADVANCED(MANGLED_MESA_INCLUDE_DIR MANGLED_MESA_LIBRARY
                   MANGLED_OSMESA_INCLUDE_DIR MANGLED_OSMESA_LIBRARY)

365
366
367
368
369
370
371
372
373
374
  IF(MANGLED_MESA_INCLUDE_DIR)
    USE_MANGLED_MESA(${MANGLED_MESA_INCLUDE_DIR}/GL
                     ${VTK_BINARY_DIR}/MangleMesaInclude)
  ENDIF(MANGLED_MESA_INCLUDE_DIR)
ENDIF(VTK_USE_MANGLED_MESA)

#-----------------------------------------------------------------------------
# Configure Off-Screen MESA support.
IF(VTK_OPENGL_HAS_OSMESA)
  INCLUDE(${VTK_SOURCE_DIR}/CMake/FindOSMesa.cmake)
375
  MARK_AS_ADVANCED(OSMESA_INCLUDE_DIR OSMESA_LIBRARY)
376
377
378
379
380
ENDIF(VTK_OPENGL_HAS_OSMESA)

#-----------------------------------------------------------------------------
# Configure VolumePro support.
IF(VTK_USE_VOLUMEPRO)
381
  INCLUDE(${VTK_SOURCE_DIR}/CMake/FindVLI.cmake)
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
  MARK_AS_ADVANCED(VLI_LIBRARY_FOR_VG500 VLI_INCLUDE_PATH_FOR_VG500
                   VLI_LIBRARY_FOR_VP1000 VLI_INCLUDE_PATH_FOR_VP1000)
  IF(VLI_LIBRARY_FOR_VG500 AND VLI_INCLUDE_PATH_FOR_VG500)
    SET(VTK_HAVE_VG500 ON)
  ENDIF(VLI_LIBRARY_FOR_VG500 AND VLI_INCLUDE_PATH_FOR_VG500)
  IF(VLI_LIBRARY_FOR_VP1000 AND VLI_INCLUDE_PATH_FOR_VP1000)
    SET(VTK_HAVE_VP1000 ON)
  ENDIF(VLI_LIBRARY_FOR_VP1000 AND VLI_INCLUDE_PATH_FOR_VP1000)
ENDIF(VTK_USE_VOLUMEPRO)

#-----------------------------------------------------------------------------
# Configure Matrox Imaging support.
IF(VTK_USE_MATROX_IMAGING)
  FIND_LIBRARY(MIL_LIBRARY MIL
    "C:/Program Files/Matrox Imaging/mil/library/winnt/msc/dll"
    "C:/Program Files/Matrox Imaging/mil/library/windows/msc/dll"
    )
  FIND_PATH(MIL_INCLUDE_PATH mil.h
    "C:/Program Files/Matrox Imaging/mil/include"
    )
ENDIF(VTK_USE_MATROX_IMAGING)

#-----------------------------------------------------------------------------
# Configure MPI testing support.
IF(VTK_USE_MPI AND BUILD_TESTING)
  FIND_PROGRAM(VTK_MPIRUN_EXE NAMES mpirun lamexec)
  SET(VTK_MPI_PREFLAGS "-np 2" CACHE STRING "Flags used by MPI start program.")
  SET(VTK_MPI_POSTFLAGS "" CACHE STRING "Flags used by MPI start program.")
  SET(VTK_MPI_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run parallel applications.")
  MARK_AS_ADVANCED(VTK_MPIRUN_EXE VTK_MPI_PREFLAGS VTK_MPI_POSTFLAGS VTK_MPI_MAX_NUMPROCS)
  SEPARATE_ARGUMENTS(VTK_MPI_PREFLAGS)
  SEPARATE_ARGUMENTS(VTK_MPI_POSTFLAGS)
ENDIF(VTK_USE_MPI AND BUILD_TESTING)

Brad King's avatar
Brad King committed
416
417
418
419
420
421
422
423
424
425
426
427
#-----------------------------------------------------------------------------
# VTK utility script locations.
SET(VTK_DOXYGEN_HOME ${VTK_SOURCE_DIR}/Utilities/Doxygen)
SET(VTK_HEADER_TESTING_PY ${VTK_SOURCE_DIR}/Common/Testing/HeaderTesting.py)
SET(VTK_FIND_STRING_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/FindString.tcl)
SET(VTK_PRINT_SELF_CHECK_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/PrintSelfCheck.tcl)
SET(VTK_RT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl)
IF(VTK_USE_PARALLEL)
  SET(VTK_PRT_IMAGE_TEST_TCL ${VTK_SOURCE_DIR}/Common/Testing/Tcl/prtImageTest.tcl)
ENDIF(VTK_USE_PARALLEL)

#-----------------------------------------------------------------------------
428
# Configure Tcl wrapping support.
Brad King's avatar
Brad King committed
429
IF(VTK_WRAP_TCL)
430
  INCLUDE(${CMAKE_ROOT}/Modules/FindTCL.cmake)
431
432
433
434
435
436
437
438
439
440
441

  # Hide useless settings provided by FindTCL.
  FOREACH(entry TCL_LIBRARY_DEBUG
		TK_LIBRARY_DEBUG
		TCL_STUB_LIBRARY
		TCL_STUB_LIBRARY_DEBUG
		TK_STUB_LIBRARY
		TK_STUB_LIBRARY_DEBUG
                TK_WISH)
    SET(${entry} "${${entry}}" CACHE INTERNAL "This value is not used by VTK.")
  ENDFOREACH(entry)
442
443
444
445
446
447
448
449
450
451
452
453
454

  # Wrapping executables.
  UTILITY_SOURCE(VTK_WRAP_TCL_EXE vtkWrapTcl Wrapping vtkWrapTcl.c)
  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping)
  MARK_AS_ADVANCED(VTK_WRAP_TCL_EXE VTK_WRAP_HINTS)

  # VTK tcl executables.
  SET(VTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/vtk)
  IF(VTK_USE_PARALLEL AND VTK_USE_MPI)
    SET(PVTK_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/pvtk)
  ENDIF(VTK_USE_PARALLEL AND VTK_USE_MPI)

  # Tcl package location.
Brad King's avatar
Brad King committed
455
456
457
  SET(VTK_TCL_HOME ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ENDIF(VTK_WRAP_TCL)

458
#-----------------------------------------------------------------------------
459
460
461
# Configure Python wrapping support.
IF(VTK_WRAP_PYTHON)
  INCLUDE(${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
Berk Geveci's avatar
Berk Geveci committed
462

463
464
465
466
  # Wrapping executables.
  UTILITY_SOURCE(VTK_WRAP_PYTHON_EXE vtkWrapPython Wrapping vtkWrapPython.c)
  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping)
  MARK_AS_ADVANCED(VTK_WRAP_PYTHON_EXE VTK_WRAP_HINTS)
467

468
469
470
471
472
  # VTK tcl executables.
  SET(VTK_PYTHON_EXE ${EXECUTABLE_OUTPUT_PATH}/vtkpython)
  IF(VTK_USE_PARALLEL AND VTK_USE_MPI)
    SET(PVTK_PYTHON_EXE ${EXECUTABLE_OUTPUT_PATH}/pvtkpython)
  ENDIF(VTK_USE_PARALLEL AND VTK_USE_MPI)
473

474
475
476
477
478
479
480
481
482
483
484
  # Safety check.
  IF(NOT PYTHON_DEBUG_LIBRARY)
    SET(PYTHON_DEBUG_LIBRARY ${PYTHON_LIBRARY})
    IF(WIN32)
      MESSAGE("Cannot find Python debug library.  The regular Python library "
              "will be used.  This means that when using debug build of VTK, "
              "python examples might not run.  If you use release build or "
              "you do not care about python working, set PYTHON_DEBUG_LIBRARY "
              "to the same file as PYTHON_LIBRARY.")
    ENDIF(WIN32)
  ENDIF(NOT PYTHON_DEBUG_LIBRARY)
485
486
ENDIF(VTK_WRAP_PYTHON)

487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
#-----------------------------------------------------------------------------
# Configure Java wrapping support.
IF(VTK_WRAP_JAVA)
  INCLUDE(${CMAKE_ROOT}/Modules/FindJava.cmake)
  INCLUDE(${CMAKE_ROOT}/Modules/FindJNI.cmake)

  # Wrapping executables.
  UTILITY_SOURCE(VTK_WRAP_JAVA_EXE vtkWrapJava Wrapping vtkWrapJava.c)
  UTILITY_SOURCE(VTK_PARSE_JAVA_EXE vtkParseJava Wrapping vtkParseJava.c)
  FIND_FILE(VTK_WRAP_HINTS hints ${VTK_SOURCE_DIR}/Wrapping)
  MARK_AS_ADVANCED(VTK_WRAP_JAVA_EXE VTK_PARSE_JAVA_EXE VTK_WRAP_HINTS)

  # Java package location.
  SET(VTK_JAVA_JAR ${LIBRARY_OUTPUT_PATH}/vtk.jar)
  SET(VTK_JAVA_HOME ${VTK_BINARY_DIR}/java/vtk)
  MAKE_DIRECTORY(${VTK_JAVA_HOME})
ENDIF(VTK_WRAP_JAVA)

#-----------------------------------------------------------------------------
# Configure the Tk library for vtkRendering.
IF(VTK_USE_RENDERING)
  IF(VTK_WRAP_TCL)
    SET(VTK_INCLUDE_NEED_TK 1)
  ENDIF(VTK_WRAP_TCL)
  IF(VTK_WRAP_PYTHON)
    SET(VTK_INCLUDE_NEED_TK 1)
  ENDIF(VTK_WRAP_PYTHON)
ENDIF(VTK_USE_RENDERING)

516
IF(VTK_INCLUDE_NEED_TK)
Ken Martin's avatar
Ken Martin committed
517
  # Need Tk sources on windows
518
  IF(WIN32)
Ken Martin's avatar
Ken Martin committed
519
520
521
    FIND_PATH(TK_XLIB_PATH X11/Xlib.h ${TK_INCLUDE_PATH} 
              ${TK_INCLUDE_PATH}/../xlib)
    MARK_AS_ADVANCED(TK_XLIB_PATH)
522
  ENDIF(WIN32)
523
524
525
526
  # Need Tk headers and libraries for python TK widgets
  IF(NOT VTK_WRAP_TCL)
    INCLUDE(${CMAKE_ROOT}/Modules/FindTCL.cmake)
  ENDIF(NOT VTK_WRAP_TCL)
527
528
ENDIF(VTK_INCLUDE_NEED_TK)

529
530
531
532
533
534
# Need Tk internal headers for Tk initialization.
SET(VTK_RENDERING_NEED_TK_INTERNAL ${VTK_INCLUDE_NEED_TK})
IF(VTK_DISABLE_TK_INIT)
  SET(VTK_RENDERING_NEED_TK_INTERNAL 0)
ENDIF(VTK_DISABLE_TK_INIT)

Ken Martin's avatar
Ken Martin committed
535
536
537
538
539
540
541
IF(VTK_INCLUDE_NEED_TK)
  # Need Tk Internal headers to include tk.h on Cocoa
  IF(VTK_USE_RENDERING AND VTK_USE_COCOA)
     SET(VTK_RENDERING_NEED_TK_INTERNAL 1)
  ENDIF(VTK_USE_RENDERING AND VTK_USE_COCOA)
ENDIF(VTK_INCLUDE_NEED_TK)

542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
IF(VTK_RENDERING_NEED_TK_INTERNAL AND TK_LIBRARY)
  IF(APPLE)
    FIND_PATH(TK_INTERNAL_PATH tkMacOSXInt.h
      ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk84OSX)
  ELSE(APPLE)
    IF(TK_LIBRARY MATCHES tk82)
      FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
        ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk82)
    ENDIF(TK_LIBRARY MATCHES tk82)
    IF(TK_LIBRARY MATCHES tk83)
      FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
        ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk83)
    ENDIF(TK_LIBRARY MATCHES tk83)
    IF(TK_LIBRARY MATCHES tk84)
      FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
        ${VTK_SOURCE_DIR}/Rendering/tkInternals/tk84)
    ENDIF(TK_LIBRARY MATCHES tk84)
  ENDIF(APPLE)
ENDIF(VTK_RENDERING_NEED_TK_INTERNAL AND TK_LIBRARY)
561

562
#-----------------------------------------------------------------------------
563
# Configure the python executable for use by testing.
564

565
# Python executable is used by some tests whether VTK_WRAP_PYTHON is
566
567
# on or not.  do not add a VTK_WRAP_PYTHON to this if.
SET(VTK_NEED_PYTHON_EXECUTABLE 0)
568
569
570
IF(BUILD_TESTING AND DART_ROOT)
  SET(VTK_NEED_PYTHON_EXECUTABLE 1)
ENDIF(BUILD_TESTING AND DART_ROOT)
571
572
573
574
575
576
577
578

# If VTK_WRAP_PYTHON is on, then we need python executable to compile
# scripts.
IF(VTK_WRAP_PYTHON)
  SET(VTK_NEED_PYTHON_EXECUTABLE 1)
ENDIF(VTK_WRAP_PYTHON)

IF(VTK_NEED_PYTHON_EXECUTABLE)
579
  FIND_PROGRAM(PYTHON_EXECUTABLE
580
    NAMES python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
581
582
583
584
585
586
587
588
    PATHS
    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]
    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]
    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]
    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]
    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
)
589
  MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
590
ENDIF(VTK_NEED_PYTHON_EXECUTABLE)
Berk Geveci's avatar
Berk Geveci committed
591

592
593
#-----------------------------------------------------------------------------
# Configure the default VTK_DATA_ROOT for the location of VTKData.
594
FIND_PATH(VTK_DATA_ROOT VTKData.readme ${VTK_SOURCE_DIR}/../VTKData $ENV{VTK_DATA_ROOT})
595

Brad King's avatar
Brad King committed
596
#-----------------------------------------------------------------------------
597
# Configure files with settings for use by the build.
Ken Martin's avatar
fixes  
Ken Martin committed
598
599
600
CONFIGURE_FILE(
${VTK_SOURCE_DIR}/vtkConfigure.h.in 
${VTK_BINARY_DIR}/vtkConfigure.h)
Ken Martin's avatar
Ken Martin committed
601

Ken Martin's avatar
Ken Martin committed
602
CONFIGURE_FILE(
Charles Law's avatar
Charles Law committed
603
604
${VTK_SOURCE_DIR}/UseVTK.cmake.in 
${VTK_BINARY_DIR}/UseVTK.cmake COPYONLY IMMEDIATE)
Ken Martin's avatar
Ken Martin committed
605

Ken Martin's avatar
fixes  
Ken Martin committed
606
607
608
CONFIGURE_FILE(
${VTK_SOURCE_DIR}/vtkToolkits.h.in 
${VTK_BINARY_DIR}/vtkToolkits.h)
Ken Martin's avatar
Ken Martin committed
609

Brad King's avatar
Brad King committed
610
611
612
613
#-----------------------------------------------------------------------------
# The entire VTK tree should use the same include path.

# Create the list of include directories needed for VTK header files.
614
INCLUDE(${VTK_SOURCE_DIR}/vtkIncludeDirectories.cmake)
Brad King's avatar
Brad King committed
615
616
617
618
619
620
621
622
623
624
625

# This should be the only INCLUDE_DIRECTORIES command in the entire
# tree, except for the CMake, Utilities, and Examples directories.  We
# need to do this in one place to make sure the order is correct.
INCLUDE_DIRECTORIES(
  ${VTK_INCLUDE_DIRS_BUILD_TREE}
  ${VTK_INCLUDE_DIRS_SOURCE_TREE}
  ${VTK_INCLUDE_DIRS_BUILD_TREE_CXX}
  ${VTK_INCLUDE_DIRS_SYSTEM}
)

626
#-----------------------------------------------------------------------------
627
# Help other projects use VTK.
628

629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# Install the instantiator headers.
INSTALL_FILES(/include/vtk .h vtkCommonInstantiator vtkFilteringInstantiator 
              vtkIOInstantiator vtkImagingInstantiator vtkGraphicsInstantiator)
IF(VTK_USE_RENDERING)
  INSTALL_FILES(/include/vtk .h vtkRenderingInstantiator)
ENDIF(VTK_USE_RENDERING)
IF(VTK_USE_HYBRID)
  INSTALL_FILES(/include/vtk .h vtkHybridInstantiator)
ENDIF(VTK_USE_HYBRID)
IF(VTK_USE_PATENTED)
  INSTALL_FILES(/include/vtk .h vtkPatentedInstantiator)
ENDIF(VTK_USE_PATENTED)
IF(VTK_USE_PARALLEL)
  INSTALL_FILES(/include/vtk .h vtkParallelInstantiator)
ENDIF(VTK_USE_PARALLEL)
644

645
646
647
648
649
650
651
652
653
# Install cmake extension directory so user projects can build the commands.
INSTALL_FILES(/lib/vtk/CMake FILES
              ${VTK_SOURCE_DIR}/CMake/CMakeLists.txt
              ${VTK_SOURCE_DIR}/CMake/vtkLoadCMakeExtensions.cmake
              ${VTK_SOURCE_DIR}/CMake/cmVTKGenerateJavaDependencies.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapTcl2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapPython2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKWrapJava2Command.c
              ${VTK_SOURCE_DIR}/CMake/cmVTKMakeInstantiator2Command.c)
Brad King's avatar
Brad King committed
654
655

# Save the compiler settings so another project can import them.
656
657
658
INCLUDE(${CMAKE_ROOT}/Modules/CMakeExportBuildSettings.cmake)
CMAKE_EXPORT_BUILD_SETTINGS(${VTK_BINARY_DIR}/VTKBuildSettings.cmake)
INSTALL_FILES(/lib/vtk .cmake VTKBuildSettings)
Brad King's avatar
Brad King committed
659

660
661
662
# Save library dependencies.
EXPORT_LIBRARY_DEPENDENCIES(${VTK_BINARY_DIR}/VTKLibraryDepends.cmake)

Brad King's avatar
Brad King committed
663
# Create the VTKConfig.cmake file containing the VTK configuration.
664
INCLUDE(${VTK_SOURCE_DIR}/vtkGenerateVTKConfig.cmake)
Brad King's avatar
Brad King committed
665
666

# Install some files.
Ken Martin's avatar
Ken Martin committed
667
INSTALL_FILES(/include/vtk .h vtkConfigure vtkToolkits)
668
INSTALL_FILES(/lib/vtk .cmake UseVTK VTKLibraryDepends)
669

Brad King's avatar
Brad King committed
670
671
672
673
674
675
676
677
678
#-----------------------------------------------------------------------------
# Add compiler flags VTK needs to work on this platform.  This must be
# done AFTER the call to CMAKE_EXPORT_BUILD_SETTINGS.

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VTK_REQUIRED_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")

#-----------------------------------------------------------------------------
# Allow local additions to this file without CVS conflicts.
679
680
INCLUDE(${VTK_BINARY_DIR}/LocalUserOptions.cmake OPTIONAL)
INCLUDE(${VTK_SOURCE_DIR}/LocalUserOptions.cmake OPTIONAL)
681
682
683
684
685
686
687
688

# If the version of CMake was too old, complain and build nothing.
# These should be the last lines in this file.
ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)
  MESSAGE(SEND_ERROR
          "This version of CMake is too old to build VTK.  "
          "Please upgrade to CMake 1.6.")
ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.5)