-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
219 lines (185 loc) · 5.8 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
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
## Copyright 2021 Intel Corporation
## SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.12)
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX
"${CMAKE_BINARY_DIR}/install"
CACHE STRING "Final install location." FORCE)
endif()
project(renderkit_superbuild)
include(CheckCXXCompilerFlag)
include(CMakeDependentOption)
include(ExternalProject)
include(GNUInstallDirs)
include(ProcessorCount)
include(macros.cmake)
# Options ##
cmake_dependent_option(
ENABLE_GPU_SUPPORT
"Enable RenderKit's GPU(SYCL) support"
OFF
"NOT APPLE"
OFF
)
set (EMBREE_GPU_SUPPORT ${ENABLE_GPU_SUPPORT})
set (OIDN_GPU_SUPPORT ${ENABLE_GPU_SUPPORT})
set (OPENVKL_GPU_SUPPORT ${ENABLE_GPU_SUPPORT})
set (OSPRAY_GPU_SUPPORT ${ENABLE_GPU_SUPPORT})
cmake_dependent_option(
OSPRAY_ENABLE_MODULE_MPI
"Enable OSPRay's MPI module"
OFF
"NOT APPLE"
OFF
)
ProcessorCount(PROCESSOR_COUNT)
set(NUM_BUILD_JOBS ${PROCESSOR_COUNT} CACHE STRING "Number of build jobs '-j <n>'")
set(DEFAULT_BUILD_COMMAND cmake --build . --config release -j ${NUM_BUILD_JOBS})
get_filename_component(INSTALL_DIR_ABSOLUTE
${CMAKE_INSTALL_PREFIX} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
if(APPLE)
set (CMAKE_MACOSX_RPATH_STATE ON)
set (FP_MODEL_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FP_MODEL_CXX_FLAGS}")
elseif(WIN32)
set (CMAKE_MACOSX_RPATH_STATE OFF)
set (FP_MODEL_CXX_FLAGS "/fp:precise")
check_cxx_compiler_flag("/fp:precise" _flag_is_fp_model)
check_cxx_compiler_flag("/ffp:precise" _flag_is_ffp_model)
if(_flag_is_fp_model)
set (FP_MODEL_CXX_FLAGS "/fp:precise")
elseif(_flag_is_ffp_model)
set (FP_MODEL_CXX_FLAGS "/ffp:precise")
else()
message(WARNING "Neither /fp: nor /ffp: supported by compiler; some tests may not be repeatable")
set (FP_MODEL_CXX_FLAGS)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FP_MODEL_CXX_FLAGS}")
else()
set (CMAKE_MACOSX_RPATH_STATE OFF)
check_cxx_compiler_flag("-fp-model=precise" _flag_is_fp_model)
check_cxx_compiler_flag("-ffp-model=precise" _flag_is_ffp_model)
if(_flag_is_fp_model)
set (FP_MODEL_CXX_FLAGS "-fp-model=precise")
elseif(_flag_is_ffp_model)
set (FP_MODEL_CXX_FLAGS "-ffp-model=precise")
else()
set (FP_MODEL_CXX_FLAGS)
endif()
check_cxx_compiler_flag("-fhonor-infinities" _fhonor_infinities)
if(_fhonor_infinities)
set(HONOR_INFINITES_CXX_FLAGS "-fhonor-infinities")
else()
set (HONOR_INFINITES_CXX_FLAGS)
endif()
check_cxx_compiler_flag("-fhonor-nans" _fhonor_nans)
if(_fhonor_nans)
set(HONOR_NANS_CXX_FLAGS "-fhonor-nans")
else()
set (HONOR_NANS_CXX_FLAGS)
endif()
check_cxx_compiler_flag("-static-intel" _static_intel)
if(_static_intel)
set(STATIC_INTEL_CXX_FLAGS "-static-intel")
else()
set (STATIC_INTEL_CXX_FLAGS)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FP_MODEL_CXX_FLAGS} ${HONOR_INFINITES_CXX_FLAGS} ${HONOR_NANS_CXX_FLAGS} ${STATIC_INTEL_CXX_FLAGS}")
endif()
## Build projects ##
include(get_tbb.cmake)
include(get_ispc.cmake)
include(get_glfw.cmake)
if(OSPRAY_ENABLE_MODULE_MPI)
include(get_snappy.cmake)
endif()
set(_RKCOMMON_VERSION 1.14.0)
set(_EMBREE_VERSION 4.3.3)
set(_OPENPGL_VERSION 0.6.0)
set(_OPENVKL_VERSION 2.0.1)
set(_OIDN_VERSION 2.3.0)
set(_OSPRAY_VERSION 3.2.0)
set(_OSPRAY_STUDIO_VERSION 1.1.0)
build_subproject(
NAME rkcommon
URL "https://github.com/renderkit/rkcommon/archive/refs/tags/v${_RKCOMMON_VERSION}.zip"
BUILD_ARGS
-DTBB_ROOT=${TBB_PATH}
-DINSTALL_DEPS=OFF
-DBUILD_TESTING=OFF
DEPENDS_ON tbb
)
build_subproject(
NAME embree
URL "https://github.com/renderkit/embree/archive/refs/tags/v${_EMBREE_VERSION}.zip"
BUILD_ARGS
-DTBB_ROOT=${TBB_PATH}
-DEMBREE_ISPC_SUPPORT=ON
-DEMBREE_ISPC_EXECUTABLE=${ISPC_PATH}
-DEMBREE_SYCL_SUPPORT=${EMBREE_GPU_SUPPORT}
-DEMBREE_TUTORIALS=OFF
-DBUILD_TESTING=OFF
DEPENDS_ON tbb ispc glfw
)
build_subproject(
NAME openpgl
URL "https://github.com/renderkit/openpgl/archive/refs/tags/v${_OPENPGL_VERSION}.zip"
BUILD_ARGS
-DTBB_ROOT=${TBB_PATH}
DEPENDS_ON tbb
)
build_subproject(
NAME openvkl
URL "https://github.com/renderkit/openvkl/archive/refs/tags/v${_OPENVKL_VERSION}.zip"
BUILD_ARGS
-DTBB_ROOT=${TBB_PATH}
-DISPC_EXECUTABLE=${ISPC_PATH}
-DOPENVKL_ENABLE_DEVICE_GPU=${OPENVKL_GPU_SUPPORT}
-DBUILD_BENCHMARKS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTING=OFF
DEPENDS_ON rkcommon embree
)
build_subproject(
NAME oidn
URL "https://github.com/renderkit/oidn/releases/download/v${_OIDN_VERSION}/oidn-${_OIDN_VERSION}.src.zip"
BUILD_ARGS
-DTBB_ROOT=${TBB_PATH}
-DISPC_EXECUTABLE=${ISPC_PATH}
-DOIDN_DEVICE_SYCL=${OIDN_GPU_SUPPORT}
-DOIDN_DEVICE_SYCL_AOT_SINGLE_BIN=OFF
-DOIDN_APPS=ON
DEPENDS_ON ispc tbb rkcommon
)
build_subproject(
NAME ospray
URL "https://github.com/renderkit/ospray/archive/refs/tags/v${_OSPRAY_VERSION}.zip"
BUILD_ARGS
-DTBB_ROOT=${TBB_PATH}
-DISPC_EXECUTABLE=${ISPC_PATH}
-DBUILD_GPU_SUPPORT=${OSPRAY_GPU_SUPPORT}
-DFIND_LIBRARY_USE_LIB64_PATHS=TRUE
-DOSPRAY_BUILD_ISA=ALL
-DOSPRAY_MODULE_BILINEAR_PATCH=OFF
-DOSPRAY_MODULE_DENOISER=ON
-DOSPRAY_MODULE_MPI=${OSPRAY_ENABLE_MODULE_MPI}
-DOSPRAY_ENABLE_APPS=OFF
-DOSPRAY_STRICT_BUILD=OFF
-DOSPRAY_INSTALL_DEPENDENCIES=OFF
DEPENDS_ON rkcommon openvkl embree oidn glfw $<$<BOOL:${OSPRAY_ENABLE_MODULE_MPI}>:snappy>
)
build_subproject(
NAME ospray_studio
URL "https://github.com/renderkit/ospray-studio/archive/refs/tags/v${_OSPRAY_STUDIO_VERSION}.zip"
BUILD_ARGS
-DTBB_ROOT=${TBB_PATH}
-DBUILD_APPS=ON
-DBUILD_PLUGINS=ON
-DBUILD_TESTING=OFF
-DENABLE_OPENIMAGEIO=OFF # These can be enabled if the dependency is pre-installed
-DENABLE_EXR=OFF
-DENABLE_OPENVDB=OFF
-DOSPRAY_INSTALL=OFF
-DUSE_PYSG=ON
DEPENDS_ON ospray rkcommon openvkl embree oidn glfw
)