forked from BlueBrain/Brayns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
225 lines (193 loc) · 6.9 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
219
220
221
222
223
224
225
# Copyright (c) 2015-2018, EPFL/Blue Brain Project
# All rights reserved. Do not distribute without permission.
# Responsible Author: Cyrille Favreau <[email protected]>
# Grigori Chevtchenko <[email protected]>
#
# This file is part of Brayns <https://github.com/BlueBrain/Brayns>
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(Brayns VERSION 0.7.0)
set(Brayns_VERSION_ABI 1)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake
${CMAKE_SOURCE_DIR}/CMake/common)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/CMake/common/Common.cmake)
message(FATAL_ERROR "CMake/common missing, run: git submodule update --init")
endif()
set(BRAYNS_LICENSE LGPL)
set(BRAYNS_DESCRIPTION "Hardware Agnostic Ray-Tracer")
set(BRAYNS_PORT_DEPEND "assimp boost freeimage glew tbb")
# Enable cloning of all optional subprojects for CI builds
if($ENV{TRAVIS})
if(NOT DEFINED BRAYNS_NETWORKING_ENABLED)
set(BRAYNS_NETWORKING_ENABLED ON)
endif()
if(NOT DEFINED BRAYNS_DEFLECT_ENABLED)
set(BRAYNS_DEFLECT_ENABLED ON)
endif()
if(NOT DEFINED BRAYNS_BRION_ENABLED)
set(BRAYNS_BRION_ENABLED ON)
endif()
endif()
include(Common)
# Core dependencies
common_find_package(Boost REQUIRED COMPONENTS
filesystem system program_options unit_test_framework)
common_find_package(vmmlib REQUIRED)
common_find_package(OpenMP)
common_find_package(LibArchive)
common_find_package(libuv 1.8)
if(libuv_FOUND)
# The libuv version of Ubuntu 16.04 is too old to have this definition that is
# required by uvw (in fact, it uses an old enough version as well to make
# things work, but couldn't go further).
if(libuv_VERSION VERSION_LESS 1.9.0)
add_definitions(-DUV_DISCONNECT=4)
endif()
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/uvw)
message(FATAL_ERROR "uvw missing, run: git submodule update --init")
endif()
include_directories(SYSTEM uvw/src)
list(APPEND LCOV_EXCLUDE '${PROJECT_SOURCE_DIR}/uvw/*')
# TODO: use tag v1.6.0_libuv-v1.18 for Docker
endif()
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Async++ as a shared library" FORCE)
add_subdirectory(async++)
list(APPEND LCOV_EXCLUDE '${PROJECT_SOURCE_DIR}/async++/include/async++/*'
'${PROJECT_SOURCE_DIR}/async++/src/*')
# HTTP messaging
common_find_package(LibJpegTurbo)
common_find_package(Rockets)
if(TARGET Rockets)
option(BRAYNS_NETWORKING_ENABLED "Activate networking interfaces" ON)
if(BRAYNS_NETWORKING_ENABLED)
list(APPEND COMMON_FIND_PACKAGE_DEFINES BRAYNS_USE_NETWORKING)
endif()
else()
unset(BRAYNS_NETWORKING_ENABLED)
endif()
# Streaming to display walls
common_find_package(Deflect)
if(TARGET Deflect)
option(BRAYNS_DEFLECT_ENABLED "Activate streaming to display wall" ON)
else()
unset(BRAYNS_DEFLECT_ENABLED)
endif()
# Data access
common_find_package(Brion)
common_find_package(Servus)
common_find_package(HDF5 SYSTEM COMPONENTS C CXX)
if(TARGET Brion AND TARGET Servus AND HDF5_FOUND)
option(BRAYNS_BRION_ENABLED "Activate Brion" ON)
else()
unset(BRAYNS_BRION_ENABLED)
endif()
# Data access unit tests
common_find_package(BBPTestData)
common_find_package(Lunchbox)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/perceptualdiff)
common_find_package(FreeImage)
if(FreeImage_FOUND)
add_subdirectory(perceptualdiff)
endif()
list(APPEND LCOV_EXCLUDE '${PROJECT_SOURCE_DIR}/perceptualdiff/*')
# OSPRay rendering engine
common_find_package(ospray 1.5 SYSTEM)
set(_ospray_unsupported_version 1.6)
if(OSPRAY_FOUND AND OSPRAY_VERSION VERSION_LESS _ospray_unsupported_version)
option(BRAYNS_OSPRAY_ENABLED "Activate OSPRay rendering engine" ON)
else()
unset(BRAYNS_OSPRAY_ENABLED)
if(OSPRAY_FOUND)
message(WARNING "OSPRay version >= ${_ospray_unsupported_version} not supported")
endif()
endif()
# Mesh loading
common_find_package(assimp SYSTEM)
if(ASSIMP_FOUND)
option(BRAYNS_ASSIMP_ENABLED "Activate assimp library for standard 3D file format management" ON)
else()
unset(BRAYNS_ASSIMP_ENABLED)
endif()
# Brayns viewer application
common_find_package(GLUT SYSTEM)
common_find_package(GLEW SYSTEM)
common_find_package(OpenGL)
if(GLUT_FOUND AND GLEW_FOUND AND OPENGL_FOUND)
option(BRAYNS_VIEWER_ENABLED "Brayns Viewer" ON)
else()
unset(BRAYNS_VIEWER_ENABLED)
endif()
common_find_package_post()
list(APPEND BRAYNS_DEPENDENT_LIBRARIES Async++ vmmlib)
# ------------------------------------------------------------------------------
# BRAYNS applications and libraries
# ------------------------------------------------------------------------------
if(NOT OSPRAY_FOUND)
message(WARNING "OSPRay not found. Brayns cannot work without an engine" )
endif()
if(BRAYNS_OSPRAY_ENABLED)
# ------------------------------------------------------------------------------
# OSPRAY specific settings
# ------------------------------------------------------------------------------
# compiler selection for the non-MIC part
if(APPLE)
set(OSPRAY_COMPILER "CLANG" CACHE STRING "compiler to use (ICC,GCC, or CLANG)")
set_property(CACHE OSPRAY_COMPILER PROPERTY STRINGS ICC GCC CLANG)
else(APPLE)
set(OSPRAY_COMPILER "GCC" CACHE STRING "compiler to use (ICC or GCC)")
set_property(CACHE OSPRAY_COMPILER PROPERTY STRINGS ICC GCC)
endif()
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework OpenGL -Wno-narrowing -Wno-deprecated-declarations")
endif()
if(BRAYNS_VIEWER_ENABLED)
add_subdirectory(apps/ui)
add_subdirectory(apps/BraynsViewer)
endif()
if(libuv_FOUND)
option(BRAYNS_SERVICE_ENABLED "Brayns Service" ON)
if(BRAYNS_SERVICE_ENABLED)
add_subdirectory(apps/BraynsService)
endif()
else()
unset(BRAYNS_SERVICE_ENABLED)
endif()
option(BRAYNS_BENCHMARK_ENABLED "Brayns Benchmark" ON)
if(BRAYNS_BENCHMARK_ENABLED)
add_subdirectory(apps/BraynsBenchmark)
endif()
add_subdirectory(plugins)
add_subdirectory(brayns)
add_subdirectory(tests)
# OSPRay modules
if(BRAYNS_OSPRAY_ENABLED)
# Optix module
option(BRAYNS_OPTIX_ENABLED "Activate OptiX module" ON)
if(BRAYNS_OPTIX_ENABLED)
add_subdirectory(ospray_modules/optix)
if(TARGET ospray_module_optix)
add_dependencies(braynsOSPRayEnginePlugin ospray_module_optix)
endif()
endif()
# OpenDeck module
option(BRAYNS_OPENDECK_ENABLED "Activate OpenDeck module" OFF)
if(BRAYNS_OPENDECK_ENABLED)
add_subdirectory(ospray_modules/opendeck)
if(TARGET ospray_module_opendeck)
add_dependencies(braynsOSPRayEnginePlugin ospray_module_opendeck)
endif()
endif()
# Stereoscopy module
option(BRAYNS_STEREOSCOPY_ENABLED "Activate Stereoscopy module" OFF)
if(BRAYNS_STEREOSCOPY_ENABLED)
add_subdirectory(ospray_modules/stereoscopy)
if(TARGET ospray_module_stereoscopy)
add_dependencies(braynsOSPRayEnginePlugin ospray_module_stereoscopy)
endif()
endif()
endif()
include(CommonCPack)
set(DOXYGEN_MAINPAGE_MD README.md)
set(DOXYGEN_EXTRA_INPUT "${PROJECT_SOURCE_DIR}/README.md ${PROJECT_SOURCE_DIR}/Changelog.md")
set(COMMON_PROJECT_DOMAIN ch.epfl.bluebrain)
include(DoxygenRule)