forked from surf-visualization/blospray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
161 lines (128 loc) · 5.58 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
# ======================================================================== #
# BLOSPRAY - OSPRay as a Blender render engine #
# Paul Melis, SURFsara <[email protected]> #
# ======================================================================== #
# Copyright 2018-2019 SURFsara #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ======================================================================== #
# https://stackoverflow.com/a/45843676/9296788 has a nice overview of
# setting up a cmake project
# Might be able to lower this, but e.g.
# 3.9 does not have a cmake module to find protobuf
cmake_minimum_required(VERSION 3.12)
cmake_policy(SET CMP0048 NEW) # Project version
set(BLOSPRAY_VERSION_MAJOR 0)
set(BLOSPRAY_VERSION_MINOR 1)
project(blospray
VERSION "${BLOSPRAY_VERSION_MAJOR}.${BLOSPRAY_VERSION_MINOR}"
DESCRIPTION "Blender external rendering engine using Intel OSPRay")
option(BUILD_FAKER "Build faker shared library" ON)
option(PLUGIN_COSMOGRID "Build cosmogrid scene plugin (needs uhdf5 and HDF5)" OFF)
option(PLUGIN_PLY "Build PLY geometry plugin (needs rply 1.1.4 sources)" OFF)
option(PLUGIN_ASSIMP "Build Assimp geometry plugin (needs Assimp)" OFF)
option(PLUGIN_VOLUME_HDF5 "Build PLY geometry plugin (needs uhdf5 and HDF5)" OFF)
option(PLUGIN_DISNEY_CLOUD "Build disney cloud volume plugin (needs OpenVDB)" OFF)
option(PLUGIN_VTK_STREAMLINES "Build VTK streamlines geometry plugin" OFF)
option(ADDRESS_SANITIZER "Compile with GCC's AddressSanitizer" OFF)
option(VTK_QC_BOUND "Add support to generate a simplified bound using VTK" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmakemodules")
list(APPEND CMAKE_MODULE_PATH "/usr/lib/cmake/OpenVDB")
include(FindOpenEXR)
include(FindOpenImageIO)
if(PLUGIN_DISNEY_CLOUD)
find_package(OpenVDB REQUIRED)
endif(PLUGIN_DISNEY_CLOUD)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(PkgConfig)
find_package(ospray CONFIG 2.0.0 REQUIRED)
find_package(Boost COMPONENTS program_options REQUIRED)
find_package(glm REQUIRED)
if(NOT Boost_FOUND)
message (FATAL_ERROR "Cannot find Boost library")
endif()
# XXX check for glm
find_package(Protobuf REQUIRED)
if(NOT Protobuf_FOUND)
# Screw it, cmake's FindProtobuf module can not find protobuf in
# a non-standard place. Use pkg-config instead.
pkg_check_modules(PROTOBUF REQUIRED protobuf)
if(NOT PROTOBUF_FOUND)
message (FATAL_ERROR "Cannot find Protobuf")
endif()
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wunused")
# ASAN_OPTIONS=halt_on_error=0
if (ADDRESS_SANITIZER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize-recover=address -O0 -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-recover=address -O0 -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer")
endif(ADDRESS_SANITIZER)
# Plugin dependencies
if(PLUGIN_COSMOGRID OR PLUGIN_VOLUME_HDF5)
FIND_PACKAGE(HDF5)
IF (HDF5_IS_PARALLEL)
FIND_PACKAGE(MPI)
ENDIF()
INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIRS})
IF (HDF5_IS_PARALLEL)
INCLUDE_DIRECTORIES (${MPI_CXX_INCLUDE_PATH})
SET(HDF5LIBS "${HDF5_LIBRARIES}" "${MPI_CXX_LIBRARIES}")
ELSE()
SET(HDF5LIBS "${HDF5_LIBRARIES}")
ENDIF()
endif(PLUGIN_COSMOGRID OR PLUGIN_VOLUME_HDF5)
if(PLUGIN_ASSIMP)
FIND_PACKAGE(assimp)
endif(PLUGIN_ASSIMP)
if(VTK_QC_BOUND OR PLUGIN_VTK_STREAMLINES)
# https://lorensen.github.io/VTKExamples/site/Cxx/Meshes/QuadricClustering/
FIND_PACKAGE(VTK
COMPONENTS
vtkCommonCore
vtkCommonDataModel
vtkFiltersCore
vtkIOCore
vtkIOLegacy # vtkDataSetReader
vtkRenderingCore # vtkColorTransferFunction
)
if(NOT VTK_FOUND)
message (FATAL_ERROR "Cannot find VTK: ${VTK_NOT_FOUND_MESSAGE}")
endif()
message (STATUS "VTK_VERSION: ${VTK_VERSION}")
endif(VTK_QC_BOUND OR PLUGIN_VTK_STREAMLINES)
include_directories("${CMAKE_SOURCE_DIR}/core") # json.hpp in faker
include_directories(${OSPRAY_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIR})
include_directories(${GLM_INCLUDE_DIRS})
# Config file
configure_file (
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
include_directories("${PROJECT_BINARY_DIR}")
# Library
add_subdirectory(core)
# Server
add_subdirectory(server)
# Plugins
add_subdirectory(plugins)
# Tests
add_subdirectory(tests)
# Faker
if(BUILD_FAKER)
add_subdirectory(faker)
endif(BUILD_FAKER)