forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
171 lines (153 loc) · 4.93 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
##=============================================================================
##
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt for details.
##
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notice for more information.
##
## Copyright 2012 Sandia Corporation.
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
##=============================================================================
list(INSERT 0 CMAKE_MODULE_PATH
"${VTK_SOURCE_DIR}/ThirdParty/vtkm/vtkvtkm/vtk-m/CMake")
set(sources
vtkmlib/ArrayConvertersReal.cxx
vtkmlib/ArrayConvertersSigned.cxx
vtkmlib/ArrayConvertersUnsigned.cxx)
set(headers
vtkmFilterPolicy.h)
set(private_headers
vtkmlib/ArrayConverters.hxx
vtkmlib/Portals.hxx
vtkmlib/PortalTraits.h
vtkmlib/vtkmDataArray.hxx)
set(impl_classes
vtkmAverageToCells
vtkmAverageToPoints
vtkmCleanGrid
vtkmClip
vtkmContour
vtkmCoordinateSystemTransform
vtkmDataArray
vtkmDataSet
vtkmExternalFaces
vtkmExtractVOI
vtkmGradient
vtkmHistogram
vtkmImageConnectivity
vtkmLevelOfDetail
vtkmNDHistogram
vtkmPointElevation
vtkmPointTransform
vtkmPolyDataNormals
vtkmProbe
vtkmThreshold
vtkmTriangleMeshPointNormals
vtkmWarpScalar
vtkmWarpVector
)
set(private_impl_classes
vtkmlib/ArrayConverters
vtkmlib/CellSetConverters
vtkmlib/DataSetConverters
vtkmlib/ImageDataConverter
vtkmlib/ImplicitFunctionConverter
vtkmlib/PolyDataConverter
vtkmlib/Portals
vtkmlib/UnstructuredGridConverter)
foreach (class IN LISTS impl_classes)
list(APPEND sources "${class}.cxx")
list(APPEND headers "${class}.h")
endforeach ()
foreach (class IN LISTS private_impl_classes)
list(APPEND sources "${class}.cxx")
list(APPEND private_headers "${class}.h")
endforeach ()
set(VTKM_FILTER_INCLUDE_AOS ${VTK_DISPATCH_AOS_ARRAYS})
set(VTKM_FILTER_INCLUDE_SOA ${VTK_DISPATCH_SOA_ARRAYS})
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/vtkmConfig.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/vtkmConfig.h"
@ONLY)
list(APPEND headers
"${CMAKE_CURRENT_BINARY_DIR}/vtkmConfig.h")
if (TARGET vtkm::cuda)
enable_language(CUDA)
# Temporarily suppress "has address taken but no possible call to it" warnings,
# until we figure out its implications.
# We are disabling all warnings as nvlink has no known way to suppress
# individual warning types.
string(APPEND CMAKE_CUDA_FLAGS " -Xnvlink -w")
endif ()
if(TARGET vtkm::cuda AND BUILD_SHARED_LIBS)
message("Cuda is enabled. Module VTK::AcceleratorsVTKm will be forced to build as static.")
vtk_module_add_module(VTK::AcceleratorsVTKm
FORCE_STATIC
SOURCES ${sources}
HEADERS ${headers}
PRIVATE_HEADERS ${private_headers})
else()
vtk_module_add_module(VTK::AcceleratorsVTKm
SOURCES ${sources}
HEADERS ${headers}
PRIVATE_HEADERS ${private_headers})
endif()
_vtk_module_real_target(vtkm_accel_target VTK::AcceleratorsVTKm)
vtkm_add_target_information(${vtkm_accel_target}
EXTENDS_VTKM
MODIFY_CUDA_FLAGS
DEVICE_SOURCES ${sources})
vtk_module_set_property(VTK::AcceleratorsVTKm
PROPERTY JOB_POOL_COMPILE
VALUE vtkm_pool)
vtk_module_link(VTK::AcceleratorsVTKm
PRIVATE
vtkm_worklet
vtkm_filter)
if (TARGET vtkm::cuda)
vtk_module_set_property(VTK::AcceleratorsVTKm
PROPERTY CUDA_SEPARABLE_COMPILATION
VALUE ON)
vtk_module_compile_options(VTK::AcceleratorsVTKm
PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe --diag_suppress=extra_semicolon>)
endif ()
# We need to install the private headers so that consumers of VTK can write
# new VTK-m filters and do data conversions correctly.
vtk_module_install_headers(
FILES ${private_headers}
SUBDIR "vtkmlib")
if (MSVC)
set(msvc_warning_flags
# Generates numerous false positives with template code about unreachable
# code
/wd4702
# Generates numerous warning that implicit assignment operators can't be
# constructed. This is understood and we don't care.
/wd4512
# Generates numerous warning that implicit constructors can't be
# constructed. This is understood and we don't care.
/wd4510
# Generates warnings when decorated names are over 4096 characters
# This compiler warning is deprecated and no longer occurs with VS2017+.
# So we suppress for VS2015
/wd4503
)
set(vtkm_msvc_flags)
foreach (msvc_warning_flag IN LISTS msvc_warning_flags)
if (TARGET vtkm::cuda)
list(APPEND vtkm_msvc_flags
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${msvc_warning_flag},${msvc_warning_flag}>)
else ()
list(APPEND vtkm_msvc_flags
${msvc_warning_flag})
endif ()
endforeach ()
vtk_module_compile_options(VTK::AcceleratorsVTKm
PRIVATE
${msvc_warning_flags})
endif ()