Cycles: Enabled half precision textures for OpenCL devices that support the cl_khr_fp...
[blender.git] / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2006, Blender Foundation
18 # All rights reserved.
19 #
20 # The Original Code is: all of this file.
21 #
22 # Contributor(s): Jacques Beaurain.
23 #
24 # ***** END GPL LICENSE BLOCK *****
25
26 #-----------------------------------------------------------------------------
27 # We don't allow in-source builds. This causes no end of troubles because
28 # all out-of-source builds will use the CMakeCache.txt file there and even
29 # build the libs and objects in it.
30
31 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
32         if(NOT DEFINED WITH_IN_SOURCE_BUILD)
33                 message(FATAL_ERROR
34                         "CMake generation for blender is not allowed within the source directory!"
35                         "\n Remove \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" and try again from another folder, e.g.:"
36                         "\n "
37                         "\n rm CMakeCache.txt"
38                         "\n cd .."
39                         "\n mkdir cmake-make"
40                         "\n cd cmake-make"
41                         "\n cmake ../blender"
42                         "\n "
43                         "\n Alternately define WITH_IN_SOURCE_BUILD to force this option (not recommended!)"
44                 )
45         endif()
46 endif()
47
48 cmake_minimum_required(VERSION 3.5)
49
50 if(NOT EXECUTABLE_OUTPUT_PATH)
51         set(FIRST_RUN TRUE)
52 else()
53         set(FIRST_RUN FALSE)
54 endif()
55
56 # this starts out unset
57 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
58 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/platform")
59
60 # avoid having empty buildtype
61 if(NOT DEFINED CMAKE_BUILD_TYPE_INIT)
62         set(CMAKE_BUILD_TYPE_INIT "Release")
63 endif()
64
65 # quiet output for Makefiles, 'make -s' helps too
66 # set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
67
68 # global compile definitions since add_definitions() adds for all.
69 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
70         $<$<CONFIG:Debug>:DEBUG;_DEBUG>
71         $<$<CONFIG:Release>:NDEBUG>
72         $<$<CONFIG:MinSizeRel>:NDEBUG>
73         $<$<CONFIG:RelWithDebInfo>:NDEBUG>
74 )
75
76 #-----------------------------------------------------------------------------
77 # Set policy
78
79 # see "cmake --help-policy CMP0003"
80 # So library linking is more sane
81 cmake_policy(SET CMP0003 NEW)
82
83 # So BUILDINFO and BLENDERPATH strings are automatically quoted
84 cmake_policy(SET CMP0005 NEW)
85
86 # So syntax problems are errors
87 cmake_policy(SET CMP0010 NEW)
88
89 # Input directories must have CMakeLists.txt
90 cmake_policy(SET CMP0014 NEW)
91
92 #-----------------------------------------------------------------------------
93 # Load some macros.
94 include(build_files/cmake/macros.cmake)
95
96
97 #-----------------------------------------------------------------------------
98 # Initialize project.
99
100 blender_project_hack_pre()
101
102 project(Blender)
103
104 blender_project_hack_post()
105
106 enable_testing()
107
108 #-----------------------------------------------------------------------------
109 # Redirect output files
110
111 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE)
112 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE)
113 set(TESTS_OUTPUT_DIR ${EXECUTABLE_OUTPUT_PATH}/tests CACHE INTERNAL "" FORCE)
114
115 #-----------------------------------------------------------------------------
116 # Set default config options
117
118 get_blender_version()
119
120
121 #-----------------------------------------------------------------------------
122 # Platform Specific Defaults
123
124 # list of var-names
125 set(_init_vars)
126
127 # initialize to ON
128 macro(option_defaults_init)
129         foreach(_var ${ARGV})
130                 set(${_var} ON)
131                 list(APPEND _init_vars "${_var}")
132         endforeach()
133         unset(_var)
134 endmacro()
135
136 # remove from namespace
137 macro(option_defaults_clear)
138         foreach(_var ${_init_vars})
139                 unset(${_var})
140         endforeach()
141         unset(_var)
142         unset(_init_vars)
143 endmacro()
144
145
146 # values to initialize WITH_****
147 option_defaults_init(
148         _init_BUILDINFO
149         _init_CODEC_FFMPEG
150         _init_CYCLES_OSL
151         _init_CYCLES_OPENSUBDIV
152         _init_IMAGE_OPENEXR
153         _init_INPUT_NDOF
154         _init_JACK
155         _init_OPENCOLLADA
156         _init_OPENCOLORIO
157         _init_SDL
158         _init_FFTW3
159         _init_GAMEENGINE
160         _init_OPENSUBDIV
161 )
162
163 # customize...
164 if(UNIX AND NOT APPLE)
165         # some of these libraries are problematic on Linux
166         # disable less important dependencies by default
167         set(_init_CODEC_FFMPEG                   OFF)
168         set(_init_CYCLES_OSL                     OFF)
169         set(_init_CYCLES_OPENSUBDIV              OFF)
170         set(_init_IMAGE_OPENEXR                  OFF)
171         set(_init_JACK                           OFF)
172         set(_init_OPENCOLLADA                    OFF)
173         set(_init_OPENCOLORIO                    OFF)
174         set(_init_SDL                            OFF)
175         set(_init_FFTW3                          OFF)
176         set(_init_OPENSUBDIV                     OFF)
177 elseif(WIN32)
178         set(_init_JACK                           OFF)
179 elseif(APPLE)
180         set(_init_JACK                           OFF)
181         set(_init_OPENSUBDIV                     OFF)
182 endif()
183
184
185 #-----------------------------------------------------------------------------
186 # Options
187
188 # First platform specific non-cached vars
189 if(UNIX AND NOT (APPLE OR HAIKU))
190         set(WITH_X11 ON)
191 endif()
192
193 # Blender internal features
194 option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
195 mark_as_advanced(WITH_BLENDER)
196
197 option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
198
199 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
200 option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
201 mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they really know what they are doing.
202 mark_as_advanced(WITH_PYTHON_SECURITY)  # some distributions see this as a security issue, rather than have them patch it, make a build option.
203
204 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
205 mark_as_advanced(WITH_PYTHON_SAFETY)
206 option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development), installs to PYTHON_SITE_PACKAGES (or CMAKE_INSTALL_PREFIX if WITH_INSTALL_PORTABLE is enabled)." OFF)
207 if(APPLE)
208         option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
209 endif()
210
211 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ${_init_BUILDINFO})
212 if(${CMAKE_VERSION} VERSION_LESS 2.8.8)
213         # add_library OBJECT arg unsupported
214         set(WITH_BUILDINFO OFF)
215 endif()
216 set(BUILDINFO_OVERRIDE_DATE "" CACHE STRING "Use instead of the current date for reproducable builds (empty string disables this option)")
217 set(BUILDINFO_OVERRIDE_TIME "" CACHE STRING "Use instead of the current time for reproducable builds (empty string disables this option)")
218 set(CPACK_OVERRIDE_PACKAGENAME "" CACHE STRING "Use instead of the standard packagename (empty string disables this option)")
219 mark_as_advanced(CPACK_OVERRIDE_PACKAGENAME)
220 mark_as_advanced(BUILDINFO_OVERRIDE_DATE)
221 mark_as_advanced(BUILDINFO_OVERRIDE_TIME)
222
223 option(WITH_IK_ITASC      "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
224 option(WITH_IK_SOLVER     "Enable Legacy IK solver (only disable for development)" ON)
225 option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ${_init_FFTW3})
226 option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
227 option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
228 mark_as_advanced(WITH_SYSTEM_BULLET)
229 option(WITH_GAMEENGINE    "Enable Game Engine" ${_init_GAMEENGINE})
230 if(APPLE)
231         set(WITH_GAMEENGINE_DECKLINK OFF)
232 else()
233         option(WITH_GAMEENGINE_DECKLINK "Support BlackMagicDesign DeckLink cards in the Game Engine" ON)
234 endif()
235 option(WITH_PLAYER        "Build Player" OFF)
236 option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
237
238 # Compositor
239 option(WITH_COMPOSITOR         "Enable the tile based nodal compositor" ON)
240
241 option(WITH_OPENSUBDIV    "Enable OpenSubdiv for surface subdivision" _init_OPENSUBDIV)
242
243 option(WITH_OPENVDB       "Enable features relying on OpenVDB" OFF)
244 option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" OFF)
245 option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
246 mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
247
248 # GHOST Windowing Library Options
249 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
250 mark_as_advanced(WITH_GHOST_DEBUG)
251
252 option(WITH_GHOST_SDL    "Enable building Blender against SDL for windowing rather than the native APIs" OFF)
253 mark_as_advanced(WITH_GHOST_SDL)
254
255 if(WITH_X11)
256         option(WITH_GHOST_XDND    "Enable drag'n'drop support on X11 using XDND protocol" ON)
257 endif()
258
259 # Misc...
260 option(WITH_HEADLESS      "Build without graphical support (renderfarm, server mode only)" OFF)
261 mark_as_advanced(WITH_HEADLESS)
262
263 option(WITH_AUDASPACE    "Build with blenders audio library (only disable if you know what you're doing!)" ON)
264 option(WITH_SYSTEM_AUDASPACE "Build with external audaspace library installed on the system (only enable if you know what you're doing!)" OFF)
265 mark_as_advanced(WITH_AUDASPACE)
266 mark_as_advanced(WITH_SYSTEM_AUDASPACE)
267
268 if(NOT WITH_AUDASPACE)
269         set(WITH_SYSTEM_AUDASPACE OFF)
270 endif()
271
272 option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
273 if(UNIX AND NOT APPLE)
274         option(WITH_OPENMP_STATIC "Link OpenMP statically (only used by the release environment)" OFF)
275         mark_as_advanced(WITH_OPENMP_STATIC)
276 endif()
277
278 if(WITH_X11)
279         option(WITH_X11_XINPUT    "Enable X11 Xinput (tablet support and unicode input)"  ON)
280         option(WITH_X11_XF86VMODE "Enable X11 video mode switching"                       ON)
281         option(WITH_X11_XFIXES    "Enable X11 XWayland cursor warping workaround"         ON)
282         option(WITH_X11_ALPHA     "Enable X11 transparent background"                     ON)
283 endif()
284
285 if(UNIX AND NOT APPLE)
286         option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" OFF)
287         option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system"           ON)
288 else()
289         # not an option for other OS's
290         set(WITH_SYSTEM_GLEW OFF)
291         set(WITH_SYSTEM_GLES OFF)
292 endif()
293
294
295 # (unix defaults to System OpenJPEG On)
296 option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" OFF)
297
298 if(UNIX AND NOT APPLE)
299         option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
300 endif()
301
302
303 # Modifiers
304 option(WITH_MOD_FLUID           "Enable Elbeem Modifier (Fluid Simulation)" ON)
305 option(WITH_MOD_SMOKE           "Enable Smoke Modifier (Smoke Simulation)" ON)
306 option(WITH_MOD_REMESH          "Enable Remesh Modifier" ON)
307 # option(WITH_MOD_CLOTH_ELTOPO    "Enable Experimental cloth solver" OFF)  # this is now only available in a branch
308 # mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
309 option(WITH_MOD_OCEANSIM        "Enable Ocean Modifier" OFF)
310
311 # Image format support
312 option(WITH_OPENIMAGEIO         "Enable OpenImageIO Support (http://www.openimageio.org)" ON)
313 option(WITH_IMAGE_OPENEXR       "Enable OpenEXR Support (http://www.openexr.com)" ${_init_IMAGE_OPENEXR})
314 option(WITH_IMAGE_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
315 option(WITH_IMAGE_TIFF          "Enable LibTIFF Support" ON)
316 option(WITH_IMAGE_DDS           "Enable DDS Image Support" ON)
317 option(WITH_IMAGE_CINEON        "Enable CINEON and DPX Image Support" ON)
318 option(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
319 option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering" ON)
320
321 # Audio/Video format support
322 option(WITH_CODEC_AVI           "Enable Blenders own AVI file support (raw/jpeg)" ON)
323 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" ${_init_CODEC_FFMPEG})
324 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
325
326 # Alembic support
327 option(WITH_ALEMBIC             "Enable Alembic Support" OFF)
328 option(WITH_ALEMBIC_HDF5        "Enable Legacy Alembic Support (not officially supported)" OFF)
329
330 # 3D format support
331 # Disable opencollada when we don't have precompiled libs
332 option(WITH_OPENCOLLADA   "Enable OpenCollada Support (http://www.opencollada.org)" ${_init_OPENCOLLADA})
333
334 # Sound output
335 option(WITH_SDL           "Enable SDL for sound and joystick support" ${_init_SDL})
336 option(WITH_OPENAL        "Enable OpenAL Support (http://www.openal.org)" ON)
337 option(WITH_JACK          "Enable JACK Support (http://www.jackaudio.org)" ${_init_JACK})
338 if(UNIX AND NOT APPLE)
339         option(WITH_JACK_DYNLOAD  "Enable runtime dynamic JACK libraries loading" OFF)
340 endif()
341 if(UNIX AND NOT APPLE)
342         option(WITH_SDL_DYNLOAD  "Enable runtime dynamic SDL libraries loading" OFF)
343 endif()
344
345 # Compression
346 option(WITH_LZO           "Enable fast LZO compression (used for pointcache)" ON)
347 option(WITH_LZMA          "Enable best LZMA compression, (used for pointcache)" ON)
348 if(UNIX AND NOT APPLE)
349         option(WITH_SYSTEM_LZO    "Use the system LZO library" OFF)
350 endif()
351
352 # Camera/motion tracking
353 option(WITH_LIBMV         "Enable Libmv structure from motion library" ON)
354 option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." OFF)
355 mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
356
357 # Logging/unbit test libraries.
358 option(WITH_SYSTEM_GFLAGS   "Use system-wide Gflags instead of a bundled one" OFF)
359 option(WITH_SYSTEM_GLOG     "Use system-wide Glog instead of a bundled one" OFF)
360 mark_as_advanced(WITH_SYSTEM_GFLAGS)
361 mark_as_advanced(WITH_SYSTEM_GLOG)
362
363 # Freestyle
364 option(WITH_FREESTYLE     "Enable Freestyle (advanced edges rendering)" ON)
365
366 # Misc
367 if(WIN32)
368         option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
369 endif()
370 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${_init_INPUT_NDOF})
371 option(WITH_RAYOPTIMIZATION     "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
372 if(UNIX AND NOT APPLE)
373         option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
374         option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
375         if(WITH_STATIC_LIBS)
376                 option(WITH_BOOST_ICU "Boost uses ICU library (required for linking with static Boost built with libicu)." OFF)
377                 mark_as_advanced(WITH_BOOST_ICU)
378         endif()
379 endif()
380
381 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
382 if(WITH_PYTHON_INSTALL)
383         option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
384         set(PYTHON_NUMPY_PATH            "" CACHE PATH "Path to python site-packages or dist-packages containing 'numpy' module")
385         mark_as_advanced(PYTHON_NUMPY_PATH)
386
387         if(UNIX AND NOT APPLE)
388                 option(WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON)
389                 set(PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module")
390                 mark_as_advanced(PYTHON_REQUESTS_PATH)
391         endif()
392 endif()
393
394 option(WITH_CPU_SSE              "Enable SIMD instruction if they're detected on the host machine" ON)
395 mark_as_advanced(WITH_CPU_SSE)
396
397 # Cycles
398 option(WITH_CYCLES                                      "Enable Cycles Render Engine" ON)
399 option(WITH_CYCLES_STANDALONE           "Build Cycles standalone application" OFF)
400 option(WITH_CYCLES_STANDALONE_GUI       "Build Cycles standalone with GUI" OFF)
401 option(WITH_CYCLES_OSL                          "Build Cycles with OSL support" ${_init_CYCLES_OSL})
402 option(WITH_CYCLES_OPENSUBDIV           "Build Cycles with OpenSubdiv support" ${_init_CYCLES_OPENSUBDIV})
403 option(WITH_CYCLES_CUDA_BINARIES        "Build Cycles CUDA binaries" OFF)
404 option(WITH_CYCLES_CUBIN_COMPILER       "Build cubins with nvrtc based compiler instead of nvcc" OFF)
405 set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 CACHE STRING "CUDA architectures to build binaries for")
406 mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
407 unset(PLATFORM_DEFAULT)
408 option(WITH_CYCLES_LOGGING      "Build Cycles with logging support" ON)
409 option(WITH_CYCLES_DEBUG        "Build Cycles with extra debug capabilities" OFF)
410 option(WITH_CYCLES_NATIVE_ONLY  "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
411 mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
412 mark_as_advanced(WITH_CYCLES_LOGGING)
413 mark_as_advanced(WITH_CYCLES_DEBUG)
414 mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
415
416 option(WITH_CYCLES_DEVICE_CUDA                          "Enable Cycles CUDA compute support" ON)
417 option(WITH_CYCLES_DEVICE_OPENCL                        "Enable Cycles OpenCL compute support" ON)
418 option(WITH_CYCLES_NETWORK                              "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF)
419 mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
420 mark_as_advanced(WITH_CYCLES_DEVICE_OPENCL)
421 mark_as_advanced(WITH_CYCLES_NETWORK)
422
423 option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
424 mark_as_advanced(WITH_CUDA_DYNLOAD)
425
426 # LLVM
427 option(WITH_LLVM                                        "Use LLVM" OFF)
428 if(APPLE)
429         option(LLVM_STATIC                                      "Link with LLVM static libraries" ON) # we prefer static llvm build on Apple, dyn build possible though
430 else()
431         option(LLVM_STATIC                                      "Link with LLVM static libraries" OFF)
432 endif()
433 mark_as_advanced(LLVM_STATIC)
434
435 # disable for now, but plan to support on all platforms eventually
436 option(WITH_MEM_JEMALLOC   "Enable malloc replacement (http://www.canonware.com/jemalloc)" ON)
437 mark_as_advanced(WITH_MEM_JEMALLOC)
438
439 # currently only used for BLI_mempool
440 option(WITH_MEM_VALGRIND "Enable extended valgrind support for better reporting" OFF)
441 mark_as_advanced(WITH_MEM_VALGRIND)
442
443 # Debug
444 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
445 mark_as_advanced(WITH_CXX_GUARDEDALLOC)
446
447 option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
448 mark_as_advanced(WITH_ASSERT_ABORT)
449
450 option(WITH_BOOST                                       "Enable features depending on boost" ON)
451
452 # Unit testsing
453 option(WITH_GTESTS "Enable GTest unit testing" OFF)
454 option(WITH_OPENGL_RENDER_TESTS "Enable OpenGL render related unit testing (Experimental)" OFF)
455 option(WITH_OPENGL_DRAW_TESTS "Enable OpenGL UI drawing related unit testing (Experimental)" OFF)
456
457
458 # Documentation
459 if(UNIX AND NOT APPLE)
460         option(WITH_DOC_MANPAGE "Create a manual page (Unix manpage)" OFF)
461 endif()
462
463
464 # OpenGL
465
466 option(WITH_GLEW_MX             "Support multiple GLEW contexts (experimental)"                                                                     OFF )
467 option(WITH_GLEW_ES             "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
468 option(WITH_GL_EGL              "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)"       OFF)
469 option(WITH_GL_PROFILE_COMPAT   "Support using the OpenGL 'compatibility' profile. (deprecated)"                                                    ON )
470 option(WITH_GL_PROFILE_CORE     "Support using the OpenGL 3.2+ 'core' profile."                                                                     OFF)
471 option(WITH_GL_PROFILE_ES20     "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)"                                  OFF)
472
473 mark_as_advanced(
474         WITH_GLEW_MX
475         WITH_GLEW_ES
476         WITH_GL_EGL
477         WITH_GL_PROFILE_COMPAT
478         WITH_GL_PROFILE_CORE
479         WITH_GL_PROFILE_ES20
480 )
481
482 if(WITH_GL_PROFILE_COMPAT)
483         set(WITH_GLU ON)
484 else()
485         set(WITH_GLU OFF)
486 endif()
487
488 if(WIN32)
489         option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF)
490         mark_as_advanced(WITH_GL_ANGLE)
491 endif()
492
493 if(WITH_GLEW_ES AND WITH_SYSTEM_GLEW)
494         message(WARNING Ignoring WITH_SYSTEM_GLEW and using WITH_GLEW_ES)
495         set(WITH_SYSTEM_GLEW OFF)
496 endif()
497
498 if(WIN32)
499         getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
500         set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
501 endif()
502
503 # Experimental support of C11 and C++11
504 #
505 # We default options to whatever default standard in the current compiler.
506 if(APPLE)
507         set(_c11_init ON)
508         set(_cxx11_init ON)
509         set(WITH_C11 ON)
510         set(WITH_CXX11 ON)
511 elseif(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
512         set(_c11_init ON)
513         set(_cxx11_init ON)
514 else()
515         set(_c11_init OFF)
516         set(_cxx11_init OFF)
517 endif()
518
519 option(WITH_C11 "Build with C11 standard enabled, for development use only!" ${_c11_init})
520 mark_as_advanced(WITH_C11)
521 option(WITH_CXX11 "Build with C++11 standard enabled, for development use only!" ${_cxx11_init})
522 mark_as_advanced(WITH_CXX11)
523
524 # Compiler toolchain
525 if(CMAKE_COMPILER_IS_GNUCC)
526         option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
527         mark_as_advanced(WITH_LINKER_GOLD)
528 endif()
529
530 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
531         option(WITH_COMPILER_ASAN "Build and link against address sanitizer (only for Debug & RelWithDebInfo targets)." OFF)
532         mark_as_advanced(WITH_COMPILER_ASAN)
533
534         if(WITH_COMPILER_ASAN)
535                 set(_asan_defaults "\
536 -fsanitize=address \
537 -fsanitize=bool \
538 -fsanitize=bounds \
539 -fsanitize=enum \
540 -fsanitize=float-cast-overflow \
541 -fsanitize=float-divide-by-zero \
542 -fsanitize=nonnull-attribute \
543 -fsanitize=returns-nonnull-attribute \
544 -fsanitize=signed-integer-overflow \
545 -fsanitize=undefined \
546 -fsanitize=vla-bound \
547 -fno-sanitize=alignment \
548 ")
549
550                 if(NOT MSVC) # not all sanitizers are supported with clang-cl, these two however are very vocal about it
551                         set(_asan_defaults "${_asan_defaults} -fsanitize=leak -fsanitize=object-size" )
552                 endif()
553                 set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
554                 mark_as_advanced(COMPILER_ASAN_CFLAGS)
555                 set(COMPILER_ASAN_CXXFLAGS "${_asan_defaults}" CACHE STRING "C++ flags for address sanitizer")
556                 mark_as_advanced(COMPILER_ASAN_CXXFLAGS)
557
558                 unset(_asan_defaults)
559
560                 if(NOT MSVC)
561                         find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
562                 else()
563                         find_library( COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
564                                 PATHS
565                                 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
566                                 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
567                         )
568                 endif()
569                 mark_as_advanced(COMPILER_ASAN_LIBRARY)
570         endif()
571 endif()
572
573 # Dependency graph
574 option(WITH_LEGACY_DEPSGRAPH "Build Blender with legacy dependency graph" ON)
575 mark_as_advanced(WITH_LEGACY_DEPSGRAPH)
576
577 if(WIN32)
578         # Use hardcoded paths or find_package to find externals
579         option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
580         mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
581
582         option(WITH_WINDOWS_CODESIGN "Use signtool to sign the final binary." OFF)
583         mark_as_advanced(WITH_WINDOWS_CODESIGN)
584
585         set(WINDOWS_CODESIGN_PFX CACHE FILEPATH  "Path to pfx file to use for codesigning.")
586         mark_as_advanced(WINDOWS_CODESIGN_PFX)
587
588         set(WINDOWS_CODESIGN_PFX_PASSWORD CACHE STRING  "password for pfx file used for codesigning.")
589         mark_as_advanced(WINDOWS_CODESIGN_PFX_PASSWORD)
590
591         option(WINDOWS_USE_VISUAL_STUDIO_FOLDERS "Organize the visual studio project according to source folders." ON)
592         mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
593 endif()
594
595 # avoid using again
596 option_defaults_clear()
597
598 # end option(...)
599
600
601
602 # By default we want to install to the directory we are compiling our executables
603 # unless specified otherwise, which we currently do not allow
604 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
605         if(WIN32)
606                 set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "default install path" FORCE)
607         elseif(APPLE)
608                 set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "default install path" FORCE)
609         else()
610                 if(WITH_INSTALL_PORTABLE)
611                         set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH} CACHE PATH "default install path" FORCE)
612                 endif()
613         endif()
614 endif()
615
616
617
618 # Apple
619
620 if(APPLE)
621         include(platform_apple_xcode)
622 endif()
623
624
625 #-----------------------------------------------------------------------------
626 # Check for conflicting/unsupported configurations
627
628 if(NOT WITH_BLENDER AND NOT WITH_PLAYER AND NOT WITH_CYCLES_STANDALONE)
629         message(FATAL_ERROR
630                 "At least one of WITH_BLENDER or WITH_PLAYER or "
631                 "WITH_CYCLES_STANDALONE must be enabled, nothing to do!"
632         )
633 endif()
634
635 if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
636         message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
637 endif()
638
639 if(NOT WITH_AUDASPACE)
640         if(WITH_OPENAL)
641                 message(FATAL_ERROR "WITH_OPENAL requires WITH_AUDASPACE")
642         endif()
643         if(WITH_JACK)
644                 message(FATAL_ERROR "WITH_JACK requires WITH_AUDASPACE")
645         endif()
646         if(WITH_GAMEENGINE)
647                 message(FATAL_ERROR "WITH_GAMEENGINE requires WITH_AUDASPACE")
648         endif()
649 endif()
650
651 if(NOT WITH_SDL AND WITH_GHOST_SDL)
652         message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL")
653 endif()
654
655 # python module, needs some different options
656 if(WITH_PYTHON_MODULE AND WITH_PLAYER)
657         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PLAYER to be OFF")
658 endif()
659
660 if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
661         message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
662 endif()
663
664
665 # may as well build python module without a UI
666 if(WITH_PYTHON_MODULE)
667         set(WITH_HEADLESS ON)
668 endif()
669
670 if(NOT WITH_PYTHON)
671         set(WITH_CYCLES OFF)
672 endif()
673
674 # enable boost for cycles, audaspace or i18n
675 # otherwise if the user disabled
676 if(NOT WITH_BOOST)
677         # Explicitly disabled. so disable all deps.
678         macro(set_and_warn
679                 _setting _val)
680                 if(${${_setting}})
681                         message(STATUS "'WITH_BOOST' is disabled: forcing 'set(${_setting} ${_val})'")
682                 endif()
683                 set(${_setting} ${_val})
684         endmacro()
685
686         set_and_warn(WITH_CYCLES         OFF)
687         set_and_warn(WITH_AUDASPACE      OFF)
688         set_and_warn(WITH_INTERNATIONAL  OFF)
689         set_and_warn(WITH_OPENVDB        OFF)
690         set_and_warn(WITH_OPENCOLORIO    OFF)
691
692         set_and_warn(WITH_OPENAL         OFF)  # depends on AUDASPACE
693         set_and_warn(WITH_GAMEENGINE     OFF)  # depends on AUDASPACE
694         set_and_warn(WITH_PLAYER         OFF)  # depends on GAMEENGINE
695 elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL OR
696        WITH_OPENVDB OR WITH_OPENCOLORIO)
697         # Keep enabled
698 else()
699         # New dependency graph needs either Boost or C++11 for function bindings.
700         if(NOT WITH_CXX11)
701                 # Enabled but we don't need it
702                 set(WITH_BOOST OFF)
703         endif()
704 endif()
705
706 # auto enable openimageio for cycles
707 if(WITH_CYCLES)
708         set(WITH_OPENIMAGEIO ON)
709
710         # auto enable llvm for cycles_osl
711         if(WITH_CYCLES_OSL)
712                 set(WITH_LLVM ON CACHE BOOL "" FORCE)
713         endif()
714 else()
715         set(WITH_CYCLES_OSL OFF)
716 endif()
717
718 # auto enable openimageio linking dependencies
719 if(WITH_OPENIMAGEIO)
720         set(WITH_IMAGE_OPENEXR ON)
721         set(WITH_IMAGE_TIFF ON)
722 endif()
723
724 # auto enable alembic linking dependencies
725 if(WITH_ALEMBIC)
726         set(WITH_IMAGE_OPENEXR ON)
727 endif()
728
729 # don't store paths to libs for portable distribution
730 if(WITH_INSTALL_PORTABLE)
731         set(CMAKE_SKIP_BUILD_RPATH TRUE)
732 endif()
733
734 if(WITH_GHOST_SDL OR WITH_HEADLESS)
735         set(WITH_X11           OFF)
736         set(WITH_X11_XINPUT    OFF)
737         set(WITH_X11_XF86VMODE OFF)
738         set(WITH_X11_XFIXES    OFF)
739         set(WITH_X11_ALPHA     OFF)
740         set(WITH_GHOST_XDND    OFF)
741         set(WITH_INPUT_IME     OFF)
742 endif()
743
744 if(WITH_CPU_SSE)
745         TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
746 else()
747         message(STATUS "SSE and SSE2 optimizations are DISABLED!")
748         set(COMPILER_SSE_FLAG)
749         set(COMPILER_SSE2_FLAG)
750 endif()
751
752 if(WITH_BUILDINFO)
753         find_package(Git)
754         if(NOT GIT_FOUND)
755                 message(WARNING "Git was not found, disabling WITH_BUILDINFO")
756                 set(WITH_BUILDINFO OFF)
757         endif()
758 endif()
759
760 TEST_SHARED_PTR_SUPPORT()
761 TEST_UNORDERED_MAP_SUPPORT()
762
763 if(WITH_AUDASPACE)
764         if(WITH_SYSTEM_AUDASPACE)
765                 set(AUDASPACE_DEFINITIONS
766                         -DWITH_AUDASPACE
767                         -DWITH_SYSTEM_AUDASPACE
768                         "-DAUD_DEVICE_H=<AUD_Device.h>"
769                         "-DAUD_SPECIAL_H=<AUD_Special.h>"
770                         "-DAUD_SOUND_H=<AUD_Sound.h>"
771                         "-DAUD_HANDLE_H=<AUD_Handle.h>"
772                         "-DAUD_SEQUENCE_H=<AUD_Sequence.h>"
773                         "-DAUD_TYPES_H=<AUD_Types.h>"
774                         "-DAUD_PYTHON_H=<python/PyAPI.h>"
775                 )
776         else()
777                 set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
778                 set(AUDASPACE_PY_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
779                 set(AUDASPACE_DEFINITIONS
780                         -DWITH_AUDASPACE
781                         "-DAUD_DEVICE_H=<AUD_C-API.h>"
782                         "-DAUD_SPECIAL_H=<AUD_C-API.h>"
783                         "-DAUD_SOUND_H=<AUD_C-API.h>"
784                         "-DAUD_HANDLE_H=<AUD_C-API.h>"
785                         "-DAUD_SEQUENCE_H=<AUD_C-API.h>"
786                         "-DAUD_TYPES_H=<AUD_Space.h>"
787                 )
788         endif()
789 endif()
790
791 # Auto-enable CUDA dynload if toolkit is not found.
792 if(NOT WITH_CUDA_DYNLOAD)
793         find_package(CUDA)
794         if (NOT CUDA_FOUND)
795                 message("CUDA toolkit not found, using dynamic runtime loading of libraries instead")
796                 set(WITH_CUDA_DYNLOAD ON)
797         endif()
798 endif()
799
800 #-----------------------------------------------------------------------------
801 # Check for valid directories
802 # ... a partial checkout may cause this.
803 #
804 # note: we need to check for a known subdir in both cases.
805 #       since uninitialized git submodules will give blank dirs
806
807 if(WITH_INTERNATIONAL)
808         if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/datafiles/locale/languages")
809                 message(WARNING
810                         "Translation path '${CMAKE_SOURCE_DIR}/release/datafiles/locale' is missing, "
811                         "This is a 'git submodule', which are known not to work with bridges to other version "
812                         "control systems, disabling 'WITH_INTERNATIONAL'."
813                 )
814                 set(WITH_INTERNATIONAL OFF)
815         endif()
816 endif()
817
818 if(WITH_PYTHON)
819         # While we have this as an '#error' in 'bpy_capi_utils.h',
820         # upgrading Python tends to cause confusion for users who build.
821         # Give the error message early to make this more obvious.
822         #
823         # Do this before main 'platform_*' checks,
824         # because UNIX will search for the old Python paths which may not exist.
825         # giving errors about missing paths before this case is met.
826         if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.6")
827                 message(FATAL_ERROR "At least Python 3.6 is required to build")
828         endif()
829
830         if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/scripts/addons/modules")
831                 message(WARNING
832                         "Addons path '${CMAKE_SOURCE_DIR}/release/scripts/addons' is missing, "
833                         "This is a 'git submodule', which are known not to work with bridges to other version "
834                         "control systems: * CONTINUING WITHOUT ADDONS *"
835                 )
836         endif()
837 endif()
838
839 #-----------------------------------------------------------------------------
840 # Initialize un-cached vars, avoid unused warning
841
842 # linux only, not cached
843 set(WITH_BINRELOC OFF)
844
845 # MACOSX only, set to avoid uninitialized
846 set(EXETYPE "")
847
848 # C/C++ flags
849 set(PLATFORM_CFLAGS)
850
851 # these are added to later on.
852 set(C_WARNINGS)
853 set(CXX_WARNINGS)
854
855 # for gcc -Wno-blah-blah
856 set(C_REMOVE_STRICT_FLAGS)
857 set(CXX_REMOVE_STRICT_FLAGS)
858
859 # libraries to link the binary with passed to target_link_libraries()
860 # known as LLIBS to scons
861 set(PLATFORM_LINKLIBS "")
862
863 # Added to linker flags in setup_liblinks
864 # - CMAKE_EXE_LINKER_FLAGS
865 # - CMAKE_EXE_LINKER_FLAGS_DEBUG
866 set(PLATFORM_LINKFLAGS "")
867 set(PLATFORM_LINKFLAGS_DEBUG "")
868
869 if (NOT CMAKE_BUILD_TYPE MATCHES "Release")
870         if(WITH_COMPILER_ASAN)
871                 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
872                 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
873
874                 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
875                 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
876                 if(MSVC)
877                         set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
878                 endif()
879                 set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
880                 set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
881                 set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
882         endif()
883 endif()
884
885 #-----------------------------------------------------------------------------
886 #Platform specifics
887
888 if(WITH_X11)
889         find_package(X11 REQUIRED)
890
891         find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
892         mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
893
894         list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
895
896         if(WITH_X11_XINPUT)
897                 if(X11_Xinput_LIB)
898                         list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
899                 else()
900                         set(WITH_X11_XINPUT OFF)
901                 endif()
902         endif()
903
904         if(WITH_X11_XF86VMODE)
905                 # XXX, why dont cmake make this available?
906                 find_library(X11_Xxf86vmode_LIB Xxf86vm   ${X11_LIB_SEARCH_PATH})
907                 mark_as_advanced(X11_Xxf86vmode_LIB)
908                 if(X11_Xxf86vmode_LIB)
909                         list(APPEND PLATFORM_LINKLIBS ${X11_Xxf86vmode_LIB})
910                 else()
911                         set(WITH_X11_XF86VMODE OFF)
912                 endif()
913         endif()
914
915         if(WITH_X11_XFIXES)
916                 if(X11_Xfixes_LIB)
917                         list(APPEND PLATFORM_LINKLIBS ${X11_Xfixes_LIB})
918                 else()
919                         set(WITH_X11_XFIXES OFF)
920                 endif()
921         endif()
922
923         if(WITH_X11_ALPHA)
924                 find_library(X11_Xrender_LIB Xrender  ${X11_LIB_SEARCH_PATH})
925                 mark_as_advanced(X11_Xrender_LIB)
926                 if(X11_Xrender_LIB)
927                         list(APPEND PLATFORM_LINKLIBS ${X11_Xrender_LIB})
928                 else()
929                         set(WITH_X11_ALPHA OFF)
930                 endif()
931         endif()
932
933 endif()
934
935
936 # ----------------------------------------------------------------------------
937 # Main Platform Checks
938 #
939 # - UNIX
940 # - WIN32
941 # - APPLE
942
943 if(UNIX AND NOT APPLE)
944         include(platform_unix)
945 elseif(WIN32)
946         include(platform_win32)
947 elseif(APPLE)
948         include(platform_apple)
949 endif()
950
951 #-----------------------------------------------------------------------------
952 # Common.
953
954 if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
955         message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
956 endif()
957
958 if(WITH_CYCLES)
959         if(NOT WITH_OPENIMAGEIO)
960                 message(FATAL_ERROR
961                         "Cycles requires WITH_OPENIMAGEIO, the library may not have been found. "
962                         "Configure OIIO or disable WITH_CYCLES"
963                 )
964         endif()
965         if(NOT WITH_BOOST)
966                 message(FATAL_ERROR
967                         "Cycles requires WITH_BOOST, the library may not have been found. "
968                         "Configure BOOST or disable WITH_CYCLES"
969                 )
970         endif()
971
972         if(WITH_CYCLES_OSL)
973                 if(NOT WITH_LLVM)
974                         message(FATAL_ERROR
975                                 "Cycles OSL requires WITH_LLVM, the library may not have been found. "
976                                 "Configure LLVM or disable WITH_CYCLES_OSL"
977                         )
978                 endif()
979         endif()
980 endif()
981
982 if(WITH_INTERNATIONAL)
983         if(NOT WITH_BOOST)
984                 message(FATAL_ERROR
985                         "Internationalization requires WITH_BOOST, the library may not have been found. "
986                         "Configure BOOST or disable WITH_INTERNATIONAL"
987                 )
988         endif()
989 endif()
990
991 # See TEST_SSE_SUPPORT() for how this is defined.
992
993 # Do it globally, SSE2 is required for quite some time now.
994 # Doing it now allows to use SSE/SSE2 in inline headers.
995 if(SUPPORT_SSE_BUILD)
996         set(PLATFORM_CFLAGS " ${COMPILER_SSE_FLAG} ${PLATFORM_CFLAGS}")
997         add_definitions(-D__SSE__ -D__MMX__)
998 endif()
999 if(SUPPORT_SSE2_BUILD)
1000         set(PLATFORM_CFLAGS " ${PLATFORM_CFLAGS} ${COMPILER_SSE2_FLAG}")
1001         add_definitions(-D__SSE2__)
1002         if(NOT SUPPORT_SSE_BUILD) # dont double up
1003                 add_definitions(-D__MMX__)
1004         endif()
1005 endif()
1006
1007
1008 # set the endian define
1009 if(MSVC)
1010         # for some reason this fails on msvc
1011         add_definitions(-D__LITTLE_ENDIAN__)
1012
1013 # OSX-Note: as we do cross-compiling with specific set architecture,
1014 # endianess-detection and auto-setting is counterproductive
1015 # so we just set endianess according CMAKE_OSX_ARCHITECTURES
1016
1017 elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
1018         add_definitions(-D__LITTLE_ENDIAN__)
1019 elseif(CMAKE_OSX_ARCHITECTURES MATCHES ppc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc64)
1020         add_definitions(-D__BIG_ENDIAN__)
1021
1022 else()
1023         include(TestBigEndian)
1024         test_big_endian(_SYSTEM_BIG_ENDIAN)
1025         if(_SYSTEM_BIG_ENDIAN)
1026                 add_definitions(-D__BIG_ENDIAN__)
1027         else()
1028                 add_definitions(-D__LITTLE_ENDIAN__)
1029         endif()
1030         unset(_SYSTEM_BIG_ENDIAN)
1031 endif()
1032 if(WITH_IMAGE_OPENJPEG)
1033         if(WITH_SYSTEM_OPENJPEG)
1034                 # dealt with above
1035                 set(OPENJPEG_DEFINES "")
1036         else()
1037                 set(OPENJPEG_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/libopenjpeg")
1038                 set(OPENJPEG_DEFINES "-DOPJ_STATIC")
1039         endif()
1040         # Special handling of Windows platform where openjpeg is always static.
1041         if(WIN32)
1042                 set(OPENJPEG_DEFINES "-DOPJ_STATIC")
1043         endif()
1044 endif()
1045
1046 if(NOT WITH_SYSTEM_EIGEN3)
1047         set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3)
1048 endif()
1049
1050 #-----------------------------------------------------------------------------
1051 # Configure OpenGL.
1052
1053 find_package(OpenGL)
1054 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
1055
1056 if(WITH_GLU)
1057         list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_glu_LIBRARY}")
1058         list(APPEND GL_DEFINITIONS -DWITH_GLU)
1059 endif()
1060
1061 if(WITH_SYSTEM_GLES)
1062         find_package_wrapper(OpenGLES)
1063 endif()
1064
1065 if(WITH_GL_PROFILE_COMPAT OR WITH_GL_PROFILE_CORE)
1066         list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_gl_LIBRARY}")
1067
1068 elseif(WITH_GL_PROFILE_ES20)
1069         if(WITH_SYSTEM_GLES)
1070                 if(NOT OPENGLES_LIBRARY)
1071                         message(FATAL_ERROR
1072                                 "Unable to find OpenGL ES libraries. "
1073                                 "Install them or disable WITH_SYSTEM_GLES."
1074                         )
1075                 endif()
1076
1077                 list(APPEND BLENDER_GL_LIBRARIES OPENGLES_LIBRARY)
1078
1079         else()
1080                 set(OPENGLES_LIBRARY "" CACHE FILEPATH "OpenGL ES 2.0 library file")
1081                 mark_as_advanced(OPENGLES_LIBRARY)
1082
1083                 list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}")
1084
1085                 if(NOT OPENGLES_LIBRARY)
1086                         message(FATAL_ERROR
1087                                 "To compile WITH_GL_EGL you need to set OPENGLES_LIBRARY "
1088                                 "to the file path of an OpenGL ES 2.0 library."
1089                         )
1090                 endif()
1091
1092         endif()
1093
1094         if(WIN32)
1095                 # Setup paths to files needed to install and redistribute Windows Blender with OpenGL ES
1096
1097                 set(OPENGLES_DLL "" CACHE FILEPATH "OpenGL ES 2.0 redistributable DLL file")
1098                 mark_as_advanced(OPENGLES_DLL)
1099
1100                 if(NOT OPENGLES_DLL)
1101                         message(FATAL_ERROR
1102                                 "To compile WITH_GL_PROFILE_ES20 you need to set OPENGLES_DLL to the file "
1103                                 "path of an OpenGL ES 2.0 runtime dynamic link library (DLL)."
1104                         )
1105                 endif()
1106
1107                 if(WITH_GL_ANGLE)
1108                         list(APPEND GL_DEFINITIONS -DWITH_ANGLE)
1109
1110                         set(D3DCOMPILER_DLL "" CACHE FILEPATH "Direct3D Compiler redistributable DLL file (needed by ANGLE)")
1111
1112                         get_filename_component(D3DCOMPILER_FILENAME "${D3DCOMPILER_DLL}" NAME)
1113                         list(APPEND GL_DEFINITIONS "-DD3DCOMPILER=\"\\\"${D3DCOMPILER_FILENAME}\\\"\"")
1114
1115                         mark_as_advanced(D3DCOMPILER_DLL)
1116
1117                         if(D3DCOMPILER_DLL STREQUAL "")
1118                                 message(FATAL_ERROR
1119                                         "To compile WITH_GL_ANGLE you need to set D3DCOMPILER_DLL to the file "
1120                                         "path of a copy of the DirectX redistributable DLL file: D3DCompiler_46.dll"
1121                                 )
1122                         endif()
1123
1124                 endif()
1125
1126         endif()
1127
1128 endif()
1129
1130 if(WITH_GL_EGL)
1131         list(APPEND GL_DEFINITIONS -DWITH_GL_EGL)
1132
1133         if(WITH_SYSTEM_GLES)
1134                 if(NOT OPENGLES_EGL_LIBRARY)
1135                         message(FATAL_ERROR
1136                                 "Unable to find OpenGL ES libraries. "
1137                                 "Install them or disable WITH_SYSTEM_GLES."
1138                         )
1139                 endif()
1140
1141                 list(APPEND BLENDER_GL_LIBRARIES OPENGLES_EGL_LIBRARY)
1142
1143         else()
1144                 set(OPENGLES_EGL_LIBRARY "" CACHE FILEPATH "EGL library file")
1145                 mark_as_advanced(OPENGLES_EGL_LIBRARY)
1146
1147                 list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}" "${OPENGLES_EGL_LIBRARY}")
1148
1149                 if(NOT OPENGLES_EGL_LIBRARY)
1150                         message(FATAL_ERROR
1151                                 "To compile WITH_GL_EGL you need to set OPENGLES_EGL_LIBRARY "
1152                                 "to the file path of an EGL library."
1153                         )
1154                 endif()
1155
1156         endif()
1157
1158         if(WIN32)
1159                 # Setup paths to files needed to install and redistribute Windows Blender with OpenGL ES
1160
1161                 set(OPENGLES_EGL_DLL "" CACHE FILEPATH "EGL redistributable DLL file")
1162                 mark_as_advanced(OPENGLES_EGL_DLL)
1163
1164                 if(NOT OPENGLES_EGL_DLL)
1165                         message(FATAL_ERROR
1166                                 "To compile WITH_GL_EGL you need to set OPENGLES_EGL_DLL "
1167                                 "to the file path of an EGL runtime dynamic link library (DLL)."
1168                         )
1169                 endif()
1170
1171         endif()
1172
1173 endif()
1174
1175 if(WITH_GL_PROFILE_COMPAT)
1176         list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_COMPAT)
1177 endif()
1178
1179 if(WITH_GL_PROFILE_CORE)
1180         list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE)
1181 endif()
1182
1183 if(WITH_GL_PROFILE_ES20)
1184         list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_ES20)
1185 endif()
1186
1187 if(WITH_GL_EGL)
1188         list(APPEND GL_DEFINITIONS -DWITH_EGL)
1189 endif()
1190
1191 #-----------------------------------------------------------------------------
1192 # Configure OpenMP.
1193 if(WITH_OPENMP)
1194         find_package(OpenMP)
1195         if(OPENMP_FOUND)
1196                 if(NOT WITH_OPENMP_STATIC)
1197                         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
1198                         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
1199                 else()
1200                         # Typically avoid adding flags as defines but we can't
1201                         # pass OpenMP flags to the linker for static builds, meaning
1202                         # we can't add any OpenMP related flags to CFLAGS variables
1203                         # since they're passed to the linker as well.
1204                         add_definitions("${OpenMP_C_FLAGS}")
1205
1206                         find_library_static(OpenMP_LIBRARIES gomp ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
1207                 endif()
1208         else()
1209                 set(WITH_OPENMP OFF)
1210         endif()
1211
1212         mark_as_advanced(
1213                 OpenMP_C_FLAGS
1214                 OpenMP_CXX_FLAGS
1215         )
1216 endif()
1217
1218 #-----------------------------------------------------------------------------
1219 # Configure GLEW
1220
1221 if(WITH_GLEW_MX)
1222         list(APPEND GL_DEFINITIONS -DWITH_GLEW_MX)
1223 endif()
1224
1225 if(WITH_SYSTEM_GLEW)
1226         find_package(GLEW)
1227
1228         # Note: There is an assumption here that the system GLEW is not a static library.
1229
1230         if(NOT GLEW_FOUND)
1231                 message(FATAL_ERROR "GLEW is required to build Blender. Install it or disable WITH_SYSTEM_GLEW.")
1232         endif()
1233
1234         if(WITH_GLEW_MX)
1235                 set(BLENDER_GLEW_LIBRARIES ${GLEW_MX_LIBRARY})
1236         else()
1237                 set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
1238         endif()
1239 else()
1240         if(WITH_GLEW_ES)
1241                 set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include")
1242
1243                 list(APPEND GL_DEFINITIONS -DGLEW_STATIC -DWITH_GLEW_ES)
1244
1245                 # These definitions remove APIs from glew.h, making GLEW smaller, and catching unguarded API usage
1246                 if(NOT WITH_GL_PROFILE_ES20)
1247                         # No ES functions are needed
1248                         list(APPEND GL_DEFINITIONS -DGLEW_NO_ES)
1249                 elseif(NOT (WITH_GL_PROFILE_CORE OR WITH_GL_PROFILE_COMPAT))
1250                         # ES is enabled, but the other functions are all disabled
1251                         list(APPEND GL_DEFINITIONS -DGLEW_ES_ONLY)
1252                 endif()
1253
1254                 if(WITH_GL_PROFILE_ES20)
1255                         if(WITH_GL_EGL)
1256                                 list(APPEND GL_DEFINITIONS -DGLEW_USE_LIB_ES20)
1257                         endif()
1258
1259                         # ToDo: This is an experiment to eliminate ES 1 symbols,
1260                         # GLEW doesn't really properly provide this level of control
1261                         # (for example, without modification it eliminates too many symbols)
1262                         # so there are lots of modifications to GLEW to make this work,
1263                         # and no attempt to make it work beyond Blender at this point.
1264                         list(APPEND GL_DEFINITIONS -DGL_ES_VERSION_1_0=0 -DGL_ES_VERSION_CL_1_1=0 -DGL_ES_VERSION_CM_1_1=0)
1265                 endif()
1266
1267                 if(WITH_GL_EGL)
1268                         list(APPEND GL_DEFINITIONS -DGLEW_INC_EGL)
1269                 endif()
1270
1271                 set(BLENDER_GLEW_LIBRARIES extern_glew_es bf_intern_glew_mx)
1272
1273         else()
1274                 set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
1275
1276                 list(APPEND GL_DEFINITIONS -DGLEW_STATIC)
1277
1278                 # This won't affect the non-experimental glew library,
1279                 # but is used for conditional compilation elsewhere.
1280                 list(APPEND GL_DEFINITIONS -DGLEW_NO_ES)
1281
1282                 set(BLENDER_GLEW_LIBRARIES extern_glew)
1283
1284         endif()
1285
1286 endif()
1287
1288 if(NOT WITH_GLU)
1289         list(APPEND GL_DEFINITIONS -DGLEW_NO_GLU)
1290 endif()
1291
1292 #-----------------------------------------------------------------------------
1293 # Configure Bullet
1294
1295 if(WITH_BULLET AND WITH_SYSTEM_BULLET)
1296         find_package(Bullet)
1297         if(NOT BULLET_FOUND)
1298                 set(WITH_BULLET OFF)
1299         endif()
1300 else()
1301         set(BULLET_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/bullet2/src")
1302         # set(BULLET_LIBRARIES "")
1303 endif()
1304
1305 #-----------------------------------------------------------------------------
1306 # Configure Python.
1307
1308 if(WITH_PYTHON_MODULE)
1309         add_definitions(-DPy_ENABLE_SHARED)
1310 endif()
1311
1312 #-----------------------------------------------------------------------------
1313 # Configure GLog/GFlags
1314
1315 if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
1316         if(WITH_SYSTEM_GFLAGS)
1317                 find_package(Gflags)
1318                 if(NOT GFLAGS_FOUND)
1319                         message(FATAL_ERROR "System wide Gflags is requested but was not found")
1320                 endif()
1321                 # FindGflags does not define this, and we are not even sure what to use here.
1322                 set(GFLAGS_DEFINES)
1323         else()
1324                 set(GFLAGS_DEFINES
1325                         -DGFLAGS_DLL_DEFINE_FLAG=
1326                         -DGFLAGS_DLL_DECLARE_FLAG=
1327                         -DGFLAGS_DLL_DECL=
1328                 )
1329                 set(GFLAGS_NAMESPACE "gflags")
1330                 set(GFLAGS_LIBRARIES extern_gflags)
1331                 set(GFLAGS_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/extern/gflags/src")
1332         endif()
1333
1334         if(WITH_SYSTEM_GLOG)
1335                 find_package(Glog)
1336                 if(NOT GLOG_FOUND)
1337                         message(FATAL_ERROR "System wide Glog is requested but was not found")
1338                 endif()
1339                 # FindGlog does not define this, and we are not even sure what to use here.
1340                 set(GLOG_DEFINES)
1341         else()
1342                 set(GLOG_DEFINES
1343                         -DGOOGLE_GLOG_DLL_DECL=
1344                 )
1345                 set(GLOG_LIBRARIES extern_glog)
1346                 if(WIN32)
1347                         set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src/windows)
1348                 else()
1349                         set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/include)
1350                 endif()
1351         endif()
1352 endif()
1353
1354 #-----------------------------------------------------------------------------
1355 # Configure Ceres
1356
1357 if(WITH_LIBMV)
1358         set(CERES_DEFINES)
1359
1360         if(WITH_CXX11)
1361                 # nothing to be done
1362         elseif(SHARED_PTR_FOUND)
1363                 if(SHARED_PTR_TR1_MEMORY_HEADER)
1364                         list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
1365                 endif()
1366                 if(SHARED_PTR_TR1_NAMESPACE)
1367                         list(APPEND CERES_DEFINES -DCERES_TR1_SHARED_PTR)
1368                 endif()
1369         else()
1370                 message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
1371         endif()
1372
1373         if(WITH_CXX11)
1374                 list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
1375         elseif(HAVE_STD_UNORDERED_MAP_HEADER)
1376                 if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
1377                         list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
1378                 else()
1379                         if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
1380                                 list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
1381                         else()
1382                                 list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
1383                                 message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
1384                         endif()
1385                 endif()
1386         else()
1387                 if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
1388                         list(APPEND CERES_DEFINES -DCERES_TR1_UNORDERED_MAP)
1389                 else()
1390                         list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
1391                         message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
1392                 endif()
1393         endif()
1394 endif()
1395
1396 #-----------------------------------------------------------------------------
1397 # Extra compile flags
1398
1399 if(CMAKE_COMPILER_IS_GNUCC)
1400
1401         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1402         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align)
1403         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1404         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE  -Werror=return-type)
1405         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_VLA -Werror=vla)
1406         # system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
1407         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES  -Wstrict-prototypes)
1408         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
1409         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1410         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1411         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1412         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
1413         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
1414         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op)
1415         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef)
1416         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
1417         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull)  # C only
1418         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
1419         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
1420         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits)
1421         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_FORMAT_SIGN -Wformat-signedness)
1422         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_RESTRICT -Wrestrict)
1423
1424         # gcc 4.2 gives annoying warnings on every file with this
1425         if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
1426                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
1427         endif()
1428
1429         # versions before gcc4.6 give many BLI_math warnings
1430         if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.6")
1431                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_REDUNDANT_DECLS       -Wredundant-decls)
1432                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls)
1433         endif()
1434
1435         # versions before gcc4.8 include global name-space.
1436         if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.8")
1437                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_SHADOW -Wshadow)
1438         endif()
1439
1440         # disable because it gives warnings for printf() & friends.
1441         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
1442
1443         if(NOT APPLE)
1444                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1445         endif()
1446
1447         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1448         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1449         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1450         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op)
1451         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
1452         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
1453         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
1454         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
1455         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_RETURN_TYPE  -Werror=return-type)
1456         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1457         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1458         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1459         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_POINTER_ARITH -Wpointer-arith)
1460         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_PARAMETER -Wunused-parameter)
1461         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings)
1462         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
1463         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_FORMAT_SIGN -Wformat-signedness)
1464         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_RESTRICT -Wrestrict)
1465
1466         # gcc 4.2 gives annoying warnings on every file with this
1467         if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
1468                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
1469         endif()
1470
1471         # causes too many warnings
1472         if(NOT APPLE)
1473                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
1474                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
1475         endif()
1476
1477         # Use 'ATTR_FALLTHROUGH' macro to suppress.
1478         if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
1479                 ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
1480                 ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
1481         endif()
1482
1483         # flags to undo strict flags
1484         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
1485         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER        -Wno-unused-parameter)
1486         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION         -Wno-unused-function)
1487         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS             -Wno-type-limits)
1488         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT     -Wno-int-in-bool-context)
1489         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT                  -Wno-format)
1490         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH                  -Wno-switch)
1491
1492         ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS     -Wno-class-memaccess)
1493
1494         if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
1495                 ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH    -Wno-implicit-fallthrough)
1496         endif()
1497
1498         if(NOT APPLE)
1499                 ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
1500         endif()
1501
1502 elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
1503
1504         # strange, clang complains these are not supported, but then uses them.
1505         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1506         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
1507         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE  -Werror=return-type)
1508         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
1509         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1510         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
1511         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES  -Wstrict-prototypes)
1512         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
1513         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
1514
1515         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1516         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
1517         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS     -Wno-unknown-pragmas)
1518         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS     -Wno-char-subscripts)
1519         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_OVERLOADED_VIRTUAL  -Wno-overloaded-virtual)  # we get a lot of these, if its a problem a dev needs to look into it.
1520         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE        -Wno-sign-compare)
1521         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF    -Wno-invalid-offsetof)
1522
1523         # gives too many unfixable warnings
1524         # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS      -Wunused-macros)
1525         # ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS          -Wunused-macros)
1526
1527         # flags to undo strict flags
1528         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
1529         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS    -Wno-unused-macros)
1530
1531         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
1532         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
1533         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
1534         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
1535         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
1536         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
1537         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
1538         ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
1539
1540         ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
1541         ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
1542         ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
1543         ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
1544         ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
1545
1546 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
1547
1548         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
1549         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
1550         ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
1551
1552         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
1553         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
1554         ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
1555
1556         # disable numbered, false positives
1557         set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
1558         set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
1559 elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
1560         # most msvc warnings are C & C++
1561         set(_WARNINGS
1562                 # warning level:
1563                 "/W3"
1564                 "/w34062"  # switch statement contains 'default' but no 'case' labels
1565                 # disable:
1566                 "/wd4018"  # signed/unsigned mismatch
1567                 "/wd4146"  # unary minus operator applied to unsigned type, result still unsigned
1568                 "/wd4065"  # switch statement contains 'default' but no 'case' labels
1569                 "/wd4127"  # conditional expression is constant
1570                 "/wd4181"  # qualifier applied to reference type; ignored
1571                 "/wd4200"  # zero-sized array in struct/union
1572                 "/wd4244"  # conversion from 'type1' to 'type2', possible loss of data
1573                 "/wd4267"  # conversion from 'size_t' to 'type', possible loss of data
1574                 "/wd4305"  # truncation from 'type1' to 'type2'
1575                 "/wd4800"  # forcing value to bool 'true' or 'false'
1576                 "/wd4828"  # The file contains a character that is illegal
1577                 # errors:
1578                 "/we4013"  # 'function' undefined; assuming extern returning int
1579                 "/we4133"  # incompatible pointer types
1580                 "/we4431"  # missing type specifier - int assumed
1581         )
1582
1583         string(REPLACE ";" " " _WARNINGS "${_WARNINGS}")
1584         set(C_WARNINGS "${_WARNINGS}")
1585         set(CXX_WARNINGS "${_WARNINGS}")
1586         unset(_WARNINGS)
1587 endif()
1588
1589 # ensure python header is found since detection can fail, this could happen
1590 # with _any_ library but since we used a fixed python version this tends to
1591 # be most problematic.
1592 if(WITH_PYTHON)
1593         if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
1594                 message(FATAL_ERROR
1595                         "Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
1596                         "Set the cache entry 'PYTHON_INCLUDE_DIR' to point "
1597                         "to a valid python include path. Containing "
1598                         "Python.h for python version \"${PYTHON_VERSION}\""
1599                 )
1600         endif()
1601
1602         if(WIN32 OR APPLE)
1603                 # pass, we have this in an archive to extract
1604         elseif(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
1605                 find_python_package(numpy)
1606         endif()
1607
1608         if(WIN32 OR APPLE)
1609                 # pass, we have this in lib/python/site-packages
1610         elseif(WITH_PYTHON_INSTALL_REQUESTS)
1611                 find_python_package(requests)
1612         endif()
1613 endif()
1614
1615 if(WITH_CXX11)
1616         if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
1617                 # TODO(sergey): Do we want c++11 or gnu-c++11 here?
1618                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
1619         elseif(MSVC)
1620                 # Nothing special is needed, C++11 features are available by default.
1621         else()
1622                 message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")
1623         endif()
1624 else()
1625         # GCC-6 switched to C++11 by default, which would break linking with existing libraries
1626         # by default. So we explicitly disable C++11 for a new GCC so no linking issues happens.
1627         if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0"))
1628                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
1629                 # We also disable any of C++11 ABI from usage, so we wouldn't even try to
1630                 # link to stuff from std::__cxx11 namespace.
1631                 add_definitions("-D_GLIBCXX_USE_CXX11_ABI=0")
1632         endif()
1633 endif()
1634
1635 # Visual Studio has all standards it supports available by default
1636 # Clang on windows copies this behavior and does not support these switches
1637 if(
1638         CMAKE_COMPILER_IS_GNUCC OR
1639         (CMAKE_C_COMPILER_ID MATCHES "Clang" AND (NOT MSVC)) OR
1640         (CMAKE_C_COMPILER_ID MATCHES "Intel")
1641 )
1642         # Use C99 + GNU extensions, works with GCC, Clang, ICC
1643         if(WITH_C11)
1644                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
1645         else()
1646                 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
1647         endif()
1648 endif()
1649
1650 # Include warnings first, so its possible to disable them with user defined flags
1651 # eg: -Wno-uninitialized
1652 set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
1653 set(CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS}")
1654
1655 # defined above, platform specific but shared names
1656 mark_as_advanced(
1657         CYCLES_OSL
1658         OSL_LIB_EXEC
1659         OSL_COMPILER
1660         OSL_LIB_COMP
1661         OSL_LIB_QUERY
1662         OSL_INCLUDE_DIR
1663 )
1664
1665 mark_as_advanced(
1666         LLVM_CONFIG
1667         LLVM_ROOT_DIR
1668         LLVM_LIBRARY
1669         LLVM_VERSION
1670 )
1671
1672 #-------------------------------------------------------------------------------
1673 # Global Defines
1674
1675 # better not set includes here but this debugging option is off by default.
1676 if(WITH_CXX_GUARDEDALLOC)
1677         include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
1678         add_definitions(-DWITH_CXX_GUARDEDALLOC)
1679 endif()
1680
1681 if(WITH_ASSERT_ABORT)
1682         add_definitions(-DWITH_ASSERT_ABORT)
1683 endif()
1684
1685 # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
1686 # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
1687
1688 #-----------------------------------------------------------------------------
1689 # Libraries
1690
1691 if(WITH_GTESTS)
1692         include(GTestTesting)
1693 endif()
1694
1695 if(WITH_BLENDER OR WITH_PLAYER)
1696         add_subdirectory(intern)
1697         add_subdirectory(extern)
1698
1699         # source after intern and extern to gather all
1700         # internal and external library information first, for test linking
1701         add_subdirectory(source)
1702 elseif(WITH_CYCLES_STANDALONE)
1703         add_subdirectory(intern/cycles)
1704         add_subdirectory(extern/clew)
1705         if(WITH_CUDA_DYNLOAD)
1706                 add_subdirectory(extern/cuew)
1707         endif()
1708         if(NOT WITH_SYSTEM_GLEW)
1709                 add_subdirectory(extern/glew)
1710         endif()
1711 endif()
1712
1713 #-----------------------------------------------------------------------------
1714 # Blender Application
1715 if(WITH_BLENDER)
1716         add_subdirectory(source/creator)
1717 endif()
1718
1719
1720 #-----------------------------------------------------------------------------
1721 # Blender Player
1722 if(WITH_PLAYER)
1723         add_subdirectory(source/blenderplayer)
1724 endif()
1725
1726
1727 #-----------------------------------------------------------------------------
1728 # Testing
1729 add_subdirectory(tests)
1730
1731
1732 #-----------------------------------------------------------------------------
1733 # CPack for generating packages
1734 include(build_files/cmake/packaging.cmake)
1735
1736 #-----------------------------------------------------------------------------
1737 # Use dynamic loading for OpenMP
1738 if(WITH_BLENDER)
1739         openmp_delayload(blender)
1740 endif()
1741 if(WITH_PLAYER)
1742         openmp_delayload(blenderplayer)
1743 endif()
1744
1745 #-----------------------------------------------------------------------------
1746 # Print Final Configuration
1747
1748 if(FIRST_RUN)
1749
1750         set(_config_msg "\nBlender Configuration\n=====================")
1751
1752         function(info_cfg_option
1753                 _setting
1754                 )
1755
1756                 set(_msg "  - ${_setting}")
1757                 string(LENGTH "${_msg}" _len)
1758                 while("32" GREATER "${_len}")
1759                         set(_msg "${_msg} ")
1760                         math(EXPR _len "${_len} + 1")
1761                 endwhile()
1762
1763                 set(_config_msg "${_config_msg}\n${_msg}${${_setting}}" PARENT_SCOPE)
1764         endfunction()
1765
1766         function(info_cfg_text
1767                 _text
1768                 )
1769
1770                 set(_config_msg "${_config_msg}\n\n  ${_text}" PARENT_SCOPE)
1771         endfunction()
1772
1773         message(STATUS "C Compiler:   \"${CMAKE_C_COMPILER_ID}\"")
1774         message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
1775
1776         info_cfg_text("Build Options:")
1777         info_cfg_option(WITH_GAMEENGINE)
1778         info_cfg_option(WITH_PLAYER)
1779         info_cfg_option(WITH_BULLET)
1780         info_cfg_option(WITH_IK_SOLVER)
1781         info_cfg_option(WITH_IK_ITASC)
1782         info_cfg_option(WITH_OPENCOLLADA)
1783         info_cfg_option(WITH_FFTW3)
1784         info_cfg_option(WITH_INTERNATIONAL)
1785         info_cfg_option(WITH_INPUT_NDOF)
1786         info_cfg_option(WITH_CYCLES)
1787         info_cfg_option(WITH_FREESTYLE)
1788         info_cfg_option(WITH_OPENCOLORIO)
1789         info_cfg_option(WITH_OPENVDB)
1790         info_cfg_option(WITH_ALEMBIC)
1791
1792         info_cfg_text("Compiler Options:")
1793         info_cfg_option(WITH_BUILDINFO)
1794         info_cfg_option(WITH_OPENMP)
1795         info_cfg_option(WITH_RAYOPTIMIZATION)
1796
1797         info_cfg_text("System Options:")
1798         info_cfg_option(WITH_INSTALL_PORTABLE)
1799         info_cfg_option(WITH_X11_ALPHA)
1800         info_cfg_option(WITH_X11_XF86VMODE)
1801         info_cfg_option(WITH_X11_XFIXES)
1802         info_cfg_option(WITH_X11_XINPUT)
1803         info_cfg_option(WITH_MEM_JEMALLOC)
1804         info_cfg_option(WITH_MEM_VALGRIND)
1805         info_cfg_option(WITH_SYSTEM_GLEW)
1806         info_cfg_option(WITH_SYSTEM_OPENJPEG)
1807
1808         info_cfg_text("Image Formats:")
1809         info_cfg_option(WITH_OPENIMAGEIO)
1810         info_cfg_option(WITH_IMAGE_CINEON)
1811         info_cfg_option(WITH_IMAGE_DDS)
1812         info_cfg_option(WITH_IMAGE_HDR)
1813         info_cfg_option(WITH_IMAGE_OPENEXR)
1814         info_cfg_option(WITH_IMAGE_OPENJPEG)
1815         info_cfg_option(WITH_IMAGE_TIFF)
1816
1817         info_cfg_text("Audio:")
1818         info_cfg_option(WITH_OPENAL)
1819         info_cfg_option(WITH_SDL)
1820         info_cfg_option(WITH_SDL_DYNLOAD)
1821         info_cfg_option(WITH_JACK)
1822         info_cfg_option(WITH_JACK_DYNLOAD)
1823         info_cfg_option(WITH_CODEC_AVI)
1824         info_cfg_option(WITH_CODEC_FFMPEG)
1825         info_cfg_option(WITH_CODEC_SNDFILE)
1826
1827         info_cfg_text("Compression:")
1828         info_cfg_option(WITH_LZMA)
1829         info_cfg_option(WITH_LZO)
1830
1831         info_cfg_text("Python:")
1832         info_cfg_option(WITH_PYTHON_INSTALL)
1833         info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
1834         info_cfg_option(WITH_PYTHON_MODULE)
1835         info_cfg_option(WITH_PYTHON_SAFETY)
1836         if(APPLE)
1837                 info_cfg_option(WITH_PYTHON_FRAMEWORK)
1838         endif()
1839
1840         info_cfg_text("Modifiers:")
1841         info_cfg_option(WITH_MOD_REMESH)
1842         info_cfg_option(WITH_MOD_FLUID)
1843         info_cfg_option(WITH_MOD_OCEANSIM)
1844
1845         info_cfg_text("OpenGL:")
1846         info_cfg_option(WITH_GLEW_ES)
1847         info_cfg_option(WITH_GLU)
1848         info_cfg_option(WITH_GL_EGL)
1849         info_cfg_option(WITH_GL_PROFILE_COMPAT)
1850         info_cfg_option(WITH_GL_PROFILE_CORE)
1851         info_cfg_option(WITH_GL_PROFILE_ES20)
1852         if(WIN32)
1853                 info_cfg_option(WITH_GL_ANGLE)
1854         endif()
1855
1856         info_cfg_text("")
1857
1858         message("${_config_msg}")
1859 endif()
1860
1861 if(0)
1862         print_all_vars()
1863 endif()