CMakeLists.txt 20 KB
Newer Older
VTK Developers's avatar
VTK Developers committed
1
2
3
4
5
# Core configuration options.
if("${CMAKE_SIZEOF_VOID_P}" GREATER 4)
 set(VTK_USE_64BIT_IDS_DEFAULT ON)
else()
 set(VTK_USE_64BIT_IDS_DEFAULT OFF)
6
7
8
 set(VTK_USE_64BIT_TIMESTAMPS_DEFAULT OFF)
 option(VTK_USE_64BIT_TIMESTAMPS "Build VTK with 64 bit timestamps"
  ${VTK_USE_64BIT_TIMESTAMPS_DEFAULT})
VTK Developers's avatar
VTK Developers committed
9
10
11
12
13
14
endif()

option(VTK_USE_64BIT_IDS "Build VTK with 64 bit ids"
  ${VTK_USE_64BIT_IDS_DEFAULT})

option(VTK_DEBUG_LEAKS "Build leak checking support into VTK." OFF)
15
16
17
18
19
20
21
22
23

# This option determines the behavior of the New methods of vtkObject derived
# classes. If this option is off then only classes specifically using the
# vtkObjectFactoryNewMacro and vtkAbstractObjectFactoryNewMacro will allow for
# overrides. If the method is on then vtkStandardNewMacro will use the
# vtkObjectFactoryNewMacro's implementation body.
option(VTK_ALL_NEW_OBJECT_FACTORY
  "Build all vtkObject derived classes with object factory new methods." OFF)

Wim Koomen's avatar
Wim Koomen committed
24
mark_as_advanced(VTK_DEBUG_LEAKS VTK_USE_64BIT_IDS VTK_ALL_NEW_OBJECT_FACTORY VTK_USE_64BIT_TIMESTAMPS)
VTK Developers's avatar
VTK Developers committed
25
26
27
28

set(vtkCommonCore_EXPORT_OPTIONS
  VTK_DEBUG_LEAKS
  VTK_USE_64BIT_IDS
29
  VTK_ALL_NEW_OBJECT_FACTORY
Wim Koomen's avatar
Wim Koomen committed
30
  VTK_USE_64BIT_TIMESTAMPS
VTK Developers's avatar
VTK Developers committed
31
  )
Ken Martin's avatar
Ken Martin committed
32

Berk Geveci's avatar
Berk Geveci committed
33
# Choose which multi-threaded parallelism library to use
34
set(VTK_SMP_IMPLEMENTATION_TYPE_DOC_STRING "Which multi-threaded parallelism implementation to use. Options are Sequential, OpenMP or TBB")
Sujin Philip's avatar
Sujin Philip committed
35
36
37

set(VTK_SMP_IMPLEMENTATION_TYPE "Sequential" CACHE STRING ${VTK_SMP_IMPLEMENTATION_TYPE_DOC_STRING})

38
set_property(CACHE VTK_SMP_IMPLEMENTATION_TYPE PROPERTY STRINGS Sequential OpenMP TBB)
Berk Geveci's avatar
Berk Geveci committed
39

40
41
if( NOT ("${VTK_SMP_IMPLEMENTATION_TYPE}" STREQUAL "OpenMP" OR
         "${VTK_SMP_IMPLEMENTATION_TYPE}" STREQUAL "TBB") )
Sujin Philip's avatar
Sujin Philip committed
42
  set(VTK_SMP_IMPLEMENTATION_TYPE "Sequential" CACHE STRING ${VTK_SMP_IMPLEMENTATION_TYPE_DOC_STRING} FORCE)
Berk Geveci's avatar
Berk Geveci committed
43
44
endif()

Sujin Philip's avatar
Sujin Philip committed
45
46
47
48
set(VTK_SMP_SOURCES "")
set(VTK_SMP_HEADERS "")
set(VTK_SMP_USE_DEFAULT_ATOMICS ON)

49
50
if ("${VTK_SMP_IMPLEMENTATION_TYPE}" STREQUAL "TBB")
  find_package(TBB REQUIRED)
Sujin Philip's avatar
Sujin Philip committed
51
  set(VTK_SMP_IMPLEMENTATION_LIBRARIES ${TBB_LIBRARIES})
Berk Geveci's avatar
Berk Geveci committed
52
53
54
  include_directories(${TBB_INCLUDE_DIRS})
  # This needs to be here because all modules that include vtkAtomic.h
  # need to include tbb/atomic.h
Berk Geveci's avatar
Berk Geveci committed
55
  list(APPEND vtkCommonCore_SYSTEM_INCLUDE_DIRS ${TBB_INCLUDE_DIRS})
Sujin Philip's avatar
Sujin Philip committed
56
57
58
59
60

  set(VTK_SMP_USE_DEFAULT_ATOMICS OFF)
  set(VTK_SMP_IMPLEMENTATION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SMP/TBB")
  set(VTK_SMP_SOURCES ${VTK_SMP_IMPLEMENTATION_DIR}/vtkSMPTools.cxx)
  set(VTK_SMP_HEADERS_TO_CONFIG
61
    vtkAtomic.h vtkSMPToolsInternal.h vtkSMPThreadLocal.h)
Sujin Philip's avatar
Sujin Philip committed
62

Sujin Philip's avatar
Sujin Philip committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
elseif ("${VTK_SMP_IMPLEMENTATION_TYPE}" STREQUAL "OpenMP")
  find_package(OpenMP REQUIRED)
  add_definitions(${OpenMP_CXX_FLAGS})
  set(VTK_SMP_IMPLEMENTATION_LIBRARIES "${OpenMP_CXX_LIBRARIES}")

  set(VTK_SMP_IMPLEMENTATION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SMP/OpenMP")
  set(VTK_SMP_SOURCES ${VTK_SMP_IMPLEMENTATION_DIR}/vtkSMPTools.cxx
    ${VTK_SMP_IMPLEMENTATION_DIR}/vtkSMPThreadLocalImpl.cxx)
  set(VTK_SMP_HEADERS_TO_CONFIG
    vtkSMPToolsInternal.h vtkSMPThreadLocal.h vtkSMPThreadLocalImpl.h)

  if (OpenMP_CXX_SPEC_DATE AND NOT ${OpenMP_CXX_SPEC_DATE} LESS 201107)
    set(VTK_SMP_USE_DEFAULT_ATOMICS OFF)
    list(APPEND VTK_SMP_SOURCES ${VTK_SMP_IMPLEMENTATION_DIR}/vtkAtomic.cxx)
    list(APPEND VTK_SMP_HEADERS_TO_CONFIG vtkAtomic.h)
  else()
    message(WARNING "Required OpenMP version (3.1) for atomics not detected. Using default atomics implementation.")
  endif()
Sujin Philip's avatar
Sujin Philip committed
81

82
83
elseif ("${VTK_SMP_IMPLEMENTATION_TYPE}" STREQUAL "Sequential")
  set(VTK_SMP_IMPLEMENTATION_LIBRARIES)
Sujin Philip's avatar
Sujin Philip committed
84
85
86
  set(VTK_SMP_IMPLEMENTATION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SMP/Sequential")
  set(VTK_SMP_SOURCES ${VTK_SMP_IMPLEMENTATION_DIR}/vtkSMPTools.cxx)
  set(VTK_SMP_HEADERS_TO_CONFIG vtkSMPToolsInternal.h vtkSMPThreadLocal.h)
87
88
endif()

Sujin Philip's avatar
Sujin Philip committed
89
90
if (${VTK_SMP_USE_DEFAULT_ATOMICS})
  set(VTK_ATOMICS_DEFAULT_IMPL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SMP/Sequential")
91
92
93
94
  list(APPEND VTK_SMP_SOURCES ${VTK_ATOMICS_DEFAULT_IMPL_DIR}/vtkAtomic.cxx)
  configure_file(${VTK_ATOMICS_DEFAULT_IMPL_DIR}/vtkAtomic.h.in
    ${CMAKE_CURRENT_BINARY_DIR}/vtkAtomic.h COPYONLY)
  list(APPEND VTK_SMP_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/vtkAtomic.h)
Berk Geveci's avatar
Berk Geveci committed
95
96
endif()

Sujin Philip's avatar
Sujin Philip committed
97
98
99
100
101
foreach (HDR_FILE ${VTK_SMP_HEADERS_TO_CONFIG})
  configure_file(${VTK_SMP_IMPLEMENTATION_DIR}/${HDR_FILE}.in
    ${CMAKE_CURRENT_BINARY_DIR}/${HDR_FILE} COPYONLY)
  list(APPEND VTK_SMP_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${HDR_FILE})
endforeach()
102

103
list(APPEND VTK_SMP_HEADERS vtkSMPTools.h vtkSMPThreadLocalObject.h)
104

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#-------------------------------------------------------------------------------
# Generate the vtkTypeList_Create macros:
include(vtkCreateTypeListMacros)
CreateTypeListMacros(
  VTK_TYPELISTMACRO_HEADER_CONTENTS
  99
  vtkTypeList_Create
  "vtkTypeList::TypeList"
  "vtkTypeList::NullType"
)
configure_file(vtkTypeListMacros.h.in vtkTypeListMacros.h)

#-------------------------------------------------------------------------------
# And the ArrayDispatch array list header:
option(VTK_DISPATCH_AOS_ARRAYS
  "Include array-of-structs vtkDataArray subclasses in dispatcher."
  ON
)
option(VTK_DISPATCH_SOA_ARRAYS
  "Include struct-of-arrays vtkDataArray subclasses in dispatcher."
  OFF
)
option(VTK_DISPATCH_TYPED_ARRAYS
  "Include vtkTypedDataArray subclasses (e.g. old mapped arrays) in dispatcher."
  OFF
)
include(vtkCreateArrayDispatchArrayList)
vtkArrayDispatch_default_array_setup()
vtkArrayDispatch_generate_array_header(VTK_ARRAYDISPATCH_ARRAY_LIST)
configure_file(vtkArrayDispatchArrayList.h.in vtkArrayDispatchArrayList.h)

option(VTK_WARN_ON_DISPATCH_FAILURE
  "If enabled, vtkArrayDispatch will print a warning when a dispatch fails."
  OFF
)

141
142
143
144
145
146
147
mark_as_advanced(
  VTK_DISPATCH_AOS_ARRAYS
  VTK_DISPATCH_SOA_ARRAYS
  VTK_DISPATCH_TYPED_ARRAYS
  VTK_WARN_ON_DISPATCH_FAILURE
)

VTK Developers's avatar
VTK Developers committed
148
#-----------------------------------------------------------------------------
149

VTK Developers's avatar
VTK Developers committed
150
151
SET(Module_SRCS
  vtkAbstractArray.cxx
152
  vtkAngularPeriodicDataArray.txx
153
  vtkAnimationCue.cxx
154
  vtkAOSDataArrayTemplate.txx
VTK Developers's avatar
VTK Developers committed
155
156
157
158
159
  vtkArrayCoordinates.cxx
  vtkArray.cxx
  vtkArrayExtents.cxx
  vtkArrayExtentsList.cxx
  vtkArrayIterator.cxx
160
  vtkArrayIteratorTemplate.txx
161
  vtkArrayIteratorTemplateInstantiate.cxx
VTK Developers's avatar
VTK Developers committed
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
  vtkArrayRange.cxx
  vtkArraySort.cxx
  vtkArrayWeights.cxx
  vtkBitArray.cxx
  vtkBitArrayIterator.cxx
  vtkBoxMuellerRandomSequence.cxx
  vtkBreakPoint.cxx
  vtkByteSwap.cxx
  vtkCallbackCommand.cxx
  vtkCharArray.cxx
  vtkCollection.cxx
  vtkCollectionIterator.cxx
  vtkCommand.cxx
  vtkCommonInformationKeyManager.cxx
  vtkConditionVariable.cxx
  vtkCriticalSection.cxx
  vtkDataArrayCollection.cxx
  vtkDataArrayCollectionIterator.cxx
  vtkDataArray.cxx
181
  vtkDataArrayPrivate.txx
VTK Developers's avatar
VTK Developers committed
182
183
184
185
186
187
188
189
190
191
192
193
  vtkDataArraySelection.cxx
  vtkDebugLeaks.cxx
  vtkDebugLeaksManager.cxx
  vtkDoubleArray.cxx
  vtkDynamicLoader.cxx
  vtkEventForwarderCommand.cxx
  vtkFileOutputWindow.cxx
  vtkFloatArray.cxx
  vtkFloatingPointExceptions.cxx
  vtkGarbageCollector.cxx
  vtkGarbageCollectorManager.cxx
  vtkGaussianRandomSequence.cxx
194
  vtkGenericDataArray.txx
VTK Developers's avatar
VTK Developers committed
195
196
197
198
199
  vtkIdListCollection.cxx
  vtkIdList.cxx
  vtkIdTypeArray.cxx
  vtkIndent.cxx
  vtkInformation.cxx
200
  vtkInformationDataObjectKey.cxx
VTK Developers's avatar
VTK Developers committed
201
202
203
204
205
206
207
208
209
210
  vtkInformationDoubleKey.cxx
  vtkInformationDoubleVectorKey.cxx
  vtkInformationIdTypeKey.cxx
  vtkInformationInformationKey.cxx
  vtkInformationInformationVectorKey.cxx
  vtkInformationIntegerKey.cxx
  vtkInformationIntegerPointerKey.cxx
  vtkInformationIntegerVectorKey.cxx
  vtkInformationIterator.cxx
  vtkInformationKey.cxx
211
  vtkInformationKeyLookup.cxx
VTK Developers's avatar
VTK Developers committed
212
213
214
215
216
217
218
  vtkInformationKeyVectorKey.cxx
  vtkInformationObjectBaseKey.cxx
  vtkInformationObjectBaseVectorKey.cxx
  vtkInformationRequestKey.cxx
  vtkInformationStringKey.cxx
  vtkInformationStringVectorKey.cxx
  vtkInformationUnsignedLongKey.cxx
219
220
  vtkInformationVariantKey.cxx
  vtkInformationVariantVectorKey.cxx
VTK Developers's avatar
VTK Developers committed
221
222
223
224
  vtkInformationVector.cxx
  vtkIntArray.cxx
  vtkLargeInteger.cxx
  vtkLongArray.cxx
225
  vtkLongLongArray.cxx
VTK Developers's avatar
VTK Developers committed
226
  vtkLookupTable.cxx
David C. Lonie's avatar
David C. Lonie committed
227
  vtkMappedDataArray.txx
VTK Developers's avatar
VTK Developers committed
228
  vtkMath.cxx
229
  vtkMersenneTwister.cxx
VTK Developers's avatar
VTK Developers committed
230
231
232
233
234
235
236
237
238
239
240
241
242
  vtkMinimalStandardRandomSequence.cxx
  vtkMultiThreader.cxx
  vtkMutexLock.cxx
  vtkObjectBase.cxx
  vtkObject.cxx
  vtkObjectFactoryCollection.cxx
  vtkObjectFactory.cxx
  vtkOldStyleCallbackCommand.cxx
  vtkOStreamWrapper.cxx
  vtkOStrStreamWrapper.cxx
  vtkOutputWindow.cxx
  vtkOverrideInformationCollection.cxx
  vtkOverrideInformation.cxx
243
  vtkPeriodicDataArray.txx
VTK Developers's avatar
VTK Developers committed
244
245
246
247
248
249
250
251
  vtkPoints2D.cxx
  vtkPoints.cxx
  vtkPriorityQueue.cxx
  vtkRandomSequence.cxx
  vtkReferenceCount.cxx
  vtkScalarsToColors.cxx
  vtkShortArray.cxx
  vtkSignedCharArray.cxx
Berk Geveci's avatar
Berk Geveci committed
252
  vtkSimpleCriticalSection.cxx
VTK Developers's avatar
VTK Developers committed
253
  vtkSmartPointerBase.cxx
254
255
  vtkSOADataArrayTemplate.txx
  vtkSOADataArrayTemplateInstantiate.cxx
VTK Developers's avatar
VTK Developers committed
256
257
258
  vtkSortDataArray.cxx
  vtkStdString.cxx
  vtkStringArray.cxx
259
  vtkStringOutputWindow.cxx
VTK Developers's avatar
VTK Developers committed
260
261
  vtkTimePointUtility.cxx
  vtkTimeStamp.cxx
262
  vtkTypedDataArray.txx
VTK Developers's avatar
VTK Developers committed
263
264
265
266
267
  vtkUnicodeStringArray.cxx
  vtkUnicodeString.cxx
  vtkUnsignedCharArray.cxx
  vtkUnsignedIntArray.cxx
  vtkUnsignedLongArray.cxx
268
  vtkUnsignedLongLongArray.cxx
VTK Developers's avatar
VTK Developers committed
269
270
271
272
273
274
  vtkUnsignedShortArray.cxx
  vtkVariantArray.cxx
  vtkVariant.cxx
  vtkVersion.cxx
  vtkVoidArray.cxx
  vtkWeakPointerBase.cxx
275
  vtkWeakReference.cxx
VTK Developers's avatar
VTK Developers committed
276
277
  vtkWindow.cxx
  vtkXMLFileOutputWindow.cxx
278
279
280
  vtkDenseArray.txx
  vtkSparseArray.txx
  vtkTypedArray.txx
281
282
  vtkType.h
  vtkSystemIncludes.h
283
  vtkWrappingHints.h
Sujin Philip's avatar
Sujin Philip committed
284
  ${VTK_SMP_SOURCES}
285
286
287
  ${CMAKE_CURRENT_BINARY_DIR}/vtkConfigure.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkMathConfigure.h
  ${CMAKE_CURRENT_BINARY_DIR}/vtkVersionMacros.h
288
289
  )

290
set(${vtk-module}_HDRS
291
  vtkABI.h
292
  vtkAngularPeriodicDataArray.h
293
294
  vtkArrayDispatch.h
  vtkArrayDispatch.txx
295
296
297
298
299
300
  vtkArrayInterpolate.h
  vtkArrayInterpolate.txx
  vtkArrayIteratorIncludes.h
  vtkArrayIteratorTemplateImplicit.txx
  vtkArrayPrint.h
  vtkArrayPrint.txx
301
  vtkAssume.h
302
303
  vtkAtomicTypeConcepts.h
  vtkAtomicTypes.h
304
  vtkAutoInit.h
305
  vtkBuffer.h
David C. Lonie's avatar
David C. Lonie committed
306
  vtkDataArrayAccessor.h
307
  vtkDataArrayIteratorMacro.h
308
  vtkDataArrayTemplate.h
309
  vtkGenericDataArrayLookupHelper.h
310
  vtkIOStream.h
311
312
  vtkIOStreamFwd.h
  vtkInformationInternals.h
David C. Lonie's avatar
David C. Lonie committed
313
  vtkMappedDataArray.h
314
  vtkMathUtilities.h
315
  vtkMersenneTwister.h
316
  vtkNew.h
317
  vtkPeriodicDataArray.h
318
319
  vtkSetGet.h
  vtkSmartPointer.h
320
  vtkSOADataArrayTemplate.txx
321
  vtkTemplateAliasMacro.h
322
  vtkTestDataArray.h
323
324
  vtkTypeList.h
  vtkTypeList.txx
325
  vtkTypeTraits.h
326
327
  vtkTypedDataArray.h
  vtkTypedDataArrayIterator.h
328
329
330
331
332
  vtkVariantCast.h
  vtkVariantCreate.h
  vtkVariantExtract.h
  vtkVariantInlineOperators.h
  vtkWeakPointer.h
333
  vtkWeakReference.h
334
335
  vtkWin32Header.h
  vtkWindows.h
336
  ${VTK_SMP_HEADERS}
337
  ${CMAKE_CURRENT_BINARY_DIR}/vtkArrayDispatchArrayList.h
338
  ${CMAKE_CURRENT_BINARY_DIR}/vtkToolkits.h
339
  ${CMAKE_CURRENT_BINARY_DIR}/vtkTypeListMacros.h
VTK Developers's avatar
VTK Developers committed
340
341
  )

342
343
344
345
346
347
if(vtkCommonDataModel_ENABLED)
  include_directories(${VTK_BINARY_DIR}/Common/DataModel)
  set_property(SOURCE vtkInformationDataObjectKey.cxx
    PROPERTY COMPILE_DEFINITIONS vtkCommonDataModel_ENABLED)
endif()

VTK Developers's avatar
VTK Developers committed
348
349
350
351
352
353
354
355
356
357
if(WIN32)
  # TODO: VTK_USE_X was once tested here but is now in another module
  list(APPEND Module_SRCS
    vtkWin32OutputWindow.cxx
    vtkWin32OutputWindowProcessEncoded.c
    vtkWin32ProcessOutputWindow.cxx
    )
  set_property(SOURCE vtkWin32OutputWindowProcessEncoded.c PROPERTY WRAP_EXCLUDE 1)
endif()

Ken Martin's avatar
Ken Martin committed
358
359
360
361
362
363
if(ANDROID)
  list(APPEND Module_SRCS
    vtkAndroidOutputWindow.cxx
    )
endif()

VTK Developers's avatar
VTK Developers committed
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# Generate data for folding Unicode strings
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkUnicodeString.cmake.in
  ${CMAKE_CURRENT_BINARY_DIR}/vtkUnicodeString.cmake @ONLY)

# Setup clean configuration of vtkConfigure.h and vtkToolkits.h.
macro(VTK_PREPARE_CMAKEDEFINE not invar outvar)
  if(${not} ${invar})
    set(${outvar} 1)
  else()
    set(${outvar})
  endif()
endmacro()

vtk_prepare_cmakedefine("" CMAKE_WORDS_BIGENDIAN VTK_WORDS_BIGENDIAN)

Brad King's avatar
Brad King committed
379
380
381
382
383
384
385
# Provide version macros through vtkConfigure.h for compatibility.
if(VTK_LEGACY_REMOVE)
  set(VTK_CONFIG_LEGACY_VERSION "")
else()
  set(VTK_CONFIG_LEGACY_VERSION "#include \"vtkVersionMacros.h\" // removed by VTK_LEGACY_REMOVE")
endif()

386
387
# Check for atomic functions
include(CheckSymbolExists)
388
if (WIN32)
389
390
391
  check_symbol_exists(InterlockedAdd "windows.h" VTK_HAS_INTERLOCKEDADD)
endif()

Brad King's avatar
Brad King committed
392
configure_file(vtkVersionMacros.h.in vtkVersionMacros.h @ONLY)
VTK Developers's avatar
VTK Developers committed
393
394
395
396
configure_file(vtkConfigure.h.in vtkConfigure.h @ONLY)
configure_file(vtkToolkits.h.in vtkToolkits.h @ONLY)

add_custom_command(
397
398
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CaseFolding.txt
  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/vtkUnicodeString.cmake
399
  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/vtkUnicodeString.cmake
400
401
402
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vtkUnicodeCaseFoldData.h
  )

VTK Developers's avatar
VTK Developers committed
403
set_source_files_properties(
404
405
406
407
  vtkUnicodeString.cxx
  OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/vtkUnicodeCaseFoldData.h
  )

408
409
# Configure data arrays for platform-independent fixed-size types.
# Match the type selection here to that in vtkType.h.
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
set(VTK_TYPE_NATIVE_Int8 "
#if VTK_TYPE_INT8 == VTK_CHAR
# include \"vtkCharArray.h\"
# define vtkTypeArrayBase vtkCharArray
#else
# include \"vtkSignedCharArray.h\"
# define vtkTypeArrayBase vtkSignedCharArray
#endif
")
set(VTK_TYPE_NATIVE_UInt8 "
#if VTK_TYPE_UINT8 == VTK_UNSIGNED_CHAR
# include \"vtkUnsignedCharArray.h\"
# define vtkTypeArrayBase vtkUnsignedCharArray
#endif
")
set(VTK_TYPE_NATIVE_Int16 "
#if VTK_TYPE_INT16 == VTK_SHORT
# include \"vtkShortArray.h\"
# define vtkTypeArrayBase vtkShortArray
#endif
")
set(VTK_TYPE_NATIVE_UInt16 "
#if VTK_TYPE_UINT16 == VTK_UNSIGNED_SHORT
# include \"vtkUnsignedShortArray.h\"
# define vtkTypeArrayBase vtkUnsignedShortArray
#endif
")
set(VTK_TYPE_NATIVE_Int32 "
#if VTK_TYPE_INT32 == VTK_INT
# include \"vtkIntArray.h\"
# define vtkTypeArrayBase vtkIntArray
#endif
")
set(VTK_TYPE_NATIVE_UInt32 "
#if VTK_TYPE_UINT32 == VTK_UNSIGNED_INT
# include \"vtkUnsignedIntArray.h\"
# define vtkTypeArrayBase vtkUnsignedIntArray
#endif
")
set(VTK_TYPE_NATIVE_Int64 "
#if VTK_TYPE_INT64 == VTK_LONG
# include \"vtkLongArray.h\"
# define vtkTypeArrayBase vtkLongArray
#elif VTK_TYPE_INT64 == VTK_LONG_LONG
# include \"vtkLongLongArray.h\"
# define vtkTypeArrayBase vtkLongLongArray
#endif
")
set(VTK_TYPE_NATIVE_UInt64 "
#if VTK_TYPE_UINT64 == VTK_UNSIGNED_LONG
# include \"vtkUnsignedLongArray.h\"
# define vtkTypeArrayBase vtkUnsignedLongArray
#elif VTK_TYPE_UINT64 == VTK_UNSIGNED_LONG_LONG
# include \"vtkUnsignedLongLongArray.h\"
# define vtkTypeArrayBase vtkUnsignedLongLongArray
#endif
")
set(VTK_TYPE_NATIVE_Float32 "
#if VTK_TYPE_FLOAT32 == VTK_FLOAT
# include \"vtkFloatArray.h\"
# define vtkTypeArrayBase vtkFloatArray
#endif
")
set(VTK_TYPE_NATIVE_Float64 "
#if VTK_TYPE_FLOAT64 == VTK_DOUBLE
# include \"vtkDoubleArray.h\"
# define vtkTypeArrayBase vtkDoubleArray
#endif
")

VTK Developers's avatar
VTK Developers committed
480
481
foreach(t Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float32 Float64)
  set(VTK_TYPE_NAME ${t})
482
  set(VTK_TYPE_NATIVE "${VTK_TYPE_NATIVE_${t}}")
VTK Developers's avatar
VTK Developers committed
483
484
  if(VTK_TYPE_NATIVE)
    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkTypedArray.h.in
485
                   ${CMAKE_CURRENT_BINARY_DIR}/vtkType${t}Array.h
486
                   @ONLY)
VTK Developers's avatar
VTK Developers committed
487
    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkTypedArray.cxx.in
488
                   ${CMAKE_CURRENT_BINARY_DIR}/vtkType${t}Array.cxx
489
                   @ONLY)
VTK Developers's avatar
VTK Developers committed
490
491
492
    set(Module_SRCS ${Module_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/vtkType${t}Array.cxx)
  endif()
endforeach()
493

494
# look for various headers and functions
495
include(CheckCXXExpressionCompiles)
VTK Developers's avatar
VTK Developers committed
496
497
include(CheckIncludeFile)

498
# Check C++ <cmath> first, where the C++11 standard says these must be.
499
500
501
check_cxx_expression_compiles("std::isnan(0.0)" "cmath" VTK_HAS_STD_ISNAN)
check_cxx_expression_compiles("std::isinf(0.0)" "cmath" VTK_HAS_STD_ISINF)
check_cxx_expression_compiles("std::isfinite(0.0)" "cmath" VTK_HAS_STD_ISFINITE)
502
503
504
505
506
507
508
509
510
511
512
513
514

# Check C99 <math.h> next, where the C99 standard says these must be.
# (they will be found even if they are defined as macros)
check_symbol_exists(isnan "math.h" VTK_HAS_ISNAN)
check_symbol_exists(isinf "math.h" VTK_HAS_ISINF)
check_symbol_exists(isfinite "math.h" VTK_HAS_ISFINITE)

# Check for finite() which is widespread, though non-standard.
check_symbol_exists(finite "math.h" VTK_HAS_FINITE)

# Check float.h last, where Windows keeps its underscore versions.
if(NOT VTK_HAS_ISNAN AND NOT VTK_HAS_STD_ISNAN)
  check_symbol_exists(_isnan "float.h" VTK_HAS__ISNAN)
VTK Developers's avatar
VTK Developers committed
515
endif()
516
517
if(NOT VTK_HAS_FINITE AND NOT VTK_HAS_ISFINITE AND NOT VTK_HAS_STD_ISFINITE)
  check_symbol_exists(_finite "float.h" VTK_HAS__FINITE)
VTK Developers's avatar
VTK Developers committed
518
519
520
endif()

configure_file(
521
522
523
  ${CMAKE_CURRENT_SOURCE_DIR}/vtkMathConfigure.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/vtkMathConfigure.h
  )
524
525

# Figure out if feenableexcept and fedisableexcept functions are present
VTK Developers's avatar
VTK Developers committed
526
527
528
529
530
531
532
533
534
535
536
check_include_file("fenv.h" HAVE_FENV_H)
if(HAVE_FENV_H)
  set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
  if(UNIX)
    set(CMAKE_REQUIRED_LIBRARIES m)
  endif()
  check_symbol_exists(feenableexcept "fenv.h" VTK_HAS_FEENABLEEXCEPT)
  set(CMAKE_REQUIRED_LIBRARIES)
endif()

configure_file(
537
538
539
  ${CMAKE_CURRENT_SOURCE_DIR}/vtkFloatingPointExceptionsConfigure.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/vtkFloatingPointExceptionsConfigure.h
  )
540

VTK Developers's avatar
VTK Developers committed
541
set_source_files_properties(
542
543
  vtkAOSDataArrayTemplate.h
  vtkAOSDataArrayTemplate.txx
VTK Developers's avatar
VTK Developers committed
544
545
546
  vtkArrayCoordinates.cxx
  vtkArrayExtents.cxx
  vtkArrayExtentsList.cxx
Utkarsh Ayachit's avatar
ENH:    
Utkarsh Ayachit committed
547
  vtkArrayIteratorTemplate.txx
548
  vtkArrayIteratorTemplateInstantiate.cxx
VTK Developers's avatar
VTK Developers committed
549
550
551
  vtkArrayRange.cxx
  vtkArraySort.cxx
  vtkArrayWeights.cxx
552
  vtkBuffer.h
553
  vtkBoundingBox.cxx
554
  vtkBreakPoint.cxx
555
  vtkCallbackCommand.cxx
556
  vtkCommonInformationKeyManager.cxx
557
  vtkDebugLeaksManager.cxx
558
  vtkEventForwarderCommand.cxx
559
  vtkFloatingPointExceptions
560
  vtkGarbageCollectorManager.cxx
561
562
  vtkIndent.cxx
  vtkLargeInteger.cxx
563
  vtkMersenneTwister_Private.cxx
564
565
  vtkOStrStreamWrapper.cxx
  vtkOStreamWrapper.cxx
566
  vtkOldStyleCallbackCommand.cxx
Berk Geveci's avatar
Berk Geveci committed
567
  vtkSimpleCriticalSection.cxx
568
  vtkSmartPointerBase.cxx
569
570
  vtkSOADataArrayTemplate.txx
  vtkSOADataArrayTemplateInstantiate.cxx # Has no API
571
  vtkStdString.cxx
572
573
  vtkTimeStamp.cxx
  vtkVariant.cxx
574
  vtkWeakPointerBase.cxx
575
  vtkUnicodeString.cxx
576
  vtkDataArrayPrivate.txx
577
578

  vtkABI.h
579
  vtkAngularPeriodicDataArray.txx
580
581
582
583
584
585
586
  vtkArrayInterpolate.h
  vtkArrayInterpolate.txx
  vtkArrayIteratorIncludes.h
  vtkArrayIteratorTemplate.h
  vtkArrayIteratorTemplateImplicit.txx
  vtkArrayPrint.h
  vtkArrayPrint.txx
587
588
  vtkAtomicTypeConcepts.h
  vtkAtomicTypes.h
589
590
  vtkAutoInit.h
  vtkDenseArray.txx
591
  vtkGenericDataArray.txx
592
  vtkGenericDataArrayHelpers.h
593
  vtkInformationInternals.h
594
  vtkIOStream.h
595
  vtkIOStreamFwd.h
596
  vtkIOStreamFwd.h
597
  vtkMathUtilities.h
David C. Lonie's avatar
David C. Lonie committed
598
  vtkMappedDataArray.txx
599
  vtkNew.h
600
  vtkPeriodicDataArray.txx
601
602
603
604
605
606
  vtkSetGet.h
  vtkSmartPointer.h
  vtkSparseArray.txx
  vtkTemplateAliasMacro.h
  vtkTypeTraits.h
  vtkTypedArray.txx
607
  vtkTypedDataArray.txx
608
609
610
611
612
613
614
615
  vtkVariantCast.h
  vtkVariantCreate.h
  vtkVariantExtract.h
  vtkVariantInlineOperators.h
  vtkWeakPointer.h
  vtkWin32Header.h
  vtkWindows.h
  vtkToolkits.h
616
617
618
619
620
  vtkSystemIncludes.h
  vtkType.h
  vtkConfigure.h
  vtkMathConfigure.h
  vtkVersionMacros.h
621
  vtkWrappingHints.h
Sujin Philip's avatar
Sujin Philip committed
622
623
  ${VTK_SMP_SOURCES}
  ${VTK_SMP_HEADERS}
624
  "${VTK_TYPELISTMACROS_HEADER}"
625

Ken Martin's avatar
Ken Martin committed
626
  WRAP_EXCLUDE
VTK Developers's avatar
VTK Developers committed
627
628
  )

629
630
631
# python uses WRAP_EXCLUDE_PYTHON and ignores WRAP_EXCLUDE
set_source_files_properties(
  vtkABI.h
632
  vtkAOSDataArrayTemplate.txx
633
  vtkArrayIteratorTemplateInstantiate.cxx
634
  vtkAutoInit.h
635
  vtkDataArrayPrivate.txx
636
  vtkIOStream.cxx
637
638
639
640
641
642
643
644
645
  vtkIOStreamFwd.h
  vtkLargeInteger.cxx
  vtkOldStyleCallbackCommand.cxx
  vtkOStreamWrapper.cxx
  vtkOStrStreamWrapper.cxx
  vtkNew.h
  vtkSetGet.h
  vtkSmartPointer.h
  vtkSmartPointerBase.h
646
  vtkSOADataArrayTemplateInstantiate.cxx # Has no API
647
648
649
650
651
  vtkStdString.cxx
  vtkUnicodeString.cxx
  vtkWeakPointer.h
  vtkWeakPointerBase.cxx
  vtkWin32Header.h
652
  vtkWrappingHints.h
653
654
  ${VTK_SMP_SOURCES}
  ${VTK_SMP_HEADERS}
655
656
657
  PROPERTIES WRAP_EXCLUDE_PYTHON 1
)

VTK Developers's avatar
VTK Developers committed
658
set_source_files_properties(
659
  vtkDataArrayTemplate.h
VTK Developers's avatar
VTK Developers committed
660
661
662
  vtkDenseArray.h
  vtkSparseArray.h
  vtkTypedArray.h
663
  "${VTK_TYPELISTMACROS_HEADER}"
VTK Developers's avatar
VTK Developers committed
664
665
  HEADER_FILE_ONLY
  )
Ken Martin's avatar
Ken Martin committed
666

667
set_source_files_properties(
668
  vtkArrayIteratorTemplateInstantiate.cxx # Has no header
669
  vtkSOADataArrayTemplateInstantiate.cxx # Has no header
670
671
672
  PROPERTIES SKIP_HEADER_INSTALL 1
)

673
674
675
676
677
678
679
if(MSVC)
  set_source_files_properties(
    vtkDataArray.cxx
    PROPERTIES COMPILE_FLAGS /bigobj
    )
endif()

680
681
# Need nsl to resolve gethostbyname on SunOS-5.8
# and socket also
VTK Developers's avatar
VTK Developers committed
682
683
684
if(CMAKE_SYSTEM MATCHES "SunOS.*")
  set(KIT_LIBS ${KIT_LIBS} socket nsl)
endif()
685

686
vtk_module_library(vtkCommonCore ${Module_SRCS})
687

688
vtk_module_link_libraries(vtkCommonCore LINK_PRIVATE ${CMAKE_THREAD_LIBS} LINK_PUBLIC ${VTK_SMP_IMPLEMENTATION_LIBRARIES})
689
690
691
692

if(ANDROID)
  target_link_libraries(vtkCommonCore LINK_PRIVATE log)
endif()