2008-04-16 22:40:48 +00:00
# ***** BEGIN GPL LICENSE BLOCK *****
2006-11-17 02:27:12 +00:00
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
2008-04-16 22:40:48 +00:00
# of the License, or (at your option) any later version.
2006-11-17 02:27:12 +00:00
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
2010-02-12 13:34:04 +00:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2006-11-17 02:27:12 +00:00
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
2008-04-16 22:40:48 +00:00
# ***** END GPL LICENSE BLOCK *****
2006-11-17 02:27:12 +00:00
2006-12-13 02:57:57 +00:00
#-----------------------------------------------------------------------------
2011-09-30 15:51:58 +00:00
# We don't allow in-source builds. This causes no end of troubles because
# all out-of-source builds will use the CMakeCache.txt file there and even
2011-02-19 12:05:20 +00:00
# build the libs and objects in it.
2006-12-13 02:57:57 +00:00
2010-12-08 08:43:06 +00:00
if ( ${ CMAKE_SOURCE_DIR } STREQUAL ${ CMAKE_BINARY_DIR } )
2019-04-17 04:35:54 +00:00
if ( NOT DEFINED WITH_IN_SOURCE_BUILD )
message ( FATAL_ERROR
" C M a k e g e n e r a t i o n f o r b l e n d e r i s n o t a l l o w e d w i t h i n t h e s o u r c e d i r e c t o r y ! "
" \ n R e m o v e \ " $ { C M A K E _ S O U R C E _ D I R } / C M a k e C a c h e . t x t \ " a n d t r y a g a i n f r o m a n o t h e r f o l d e r , e . g . : "
" \ n "
" \ n r m C M a k e C a c h e . t x t "
" \ n c d . . "
" \ n m k d i r c m a k e - m a k e "
" \ n c d c m a k e - m a k e "
" \ n c m a k e . . / b l e n d e r "
" \ n "
" \ n A l t e r n a t e l y d e f i n e W I T H _ I N _ S O U R C E _ B U I L D t o f o r c e t h i s option ( not recommended! ) "
)
endif ( )
2010-12-08 08:43:06 +00:00
endif ( )
2006-12-13 02:57:57 +00:00
2017-08-20 15:01:27 +00:00
cmake_minimum_required ( VERSION 3.5 )
2015-11-09 15:52:29 +00:00
2018-12-14 13:48:05 +00:00
# Prever LEGACY OpenGL to eb compatible with all the existing releases and
# platforms which don't hare GLVND yet. Only do it if preference was not set
# externally.
if ( NOT DEFINED OpenGL_GL_PREFERENCE )
2019-04-17 04:35:54 +00:00
set ( OpenGL_GL_PREFERENCE "LEGACY" )
2018-12-14 13:48:05 +00:00
endif ( )
2011-06-19 13:49:20 +00:00
if ( NOT EXECUTABLE_OUTPUT_PATH )
2019-04-17 04:35:54 +00:00
set ( FIRST_RUN TRUE )
2015-06-16 23:16:17 +00:00
else ( )
2019-04-17 04:35:54 +00:00
set ( FIRST_RUN FALSE )
2011-06-19 13:49:20 +00:00
endif ( )
2011-04-05 23:31:01 +00:00
# this starts out unset
2011-06-17 02:22:38 +00:00
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules" )
2016-08-09 13:19:11 +00:00
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/platform" )
2011-04-05 23:31:01 +00:00
2011-06-27 13:18:08 +00:00
# avoid having empty buildtype
2017-06-26 23:50:35 +00:00
if ( NOT DEFINED CMAKE_BUILD_TYPE_INIT )
2019-04-17 04:35:54 +00:00
set ( CMAKE_BUILD_TYPE_INIT "Release" )
2017-06-26 23:50:35 +00:00
endif ( )
2011-06-27 13:18:08 +00:00
2018-07-30 05:20:34 +00:00
# Omit superfluous "Up-to-date" messages.
if ( NOT DEFINED CMAKE_INSTALL_MESSAGE )
2019-04-17 04:35:54 +00:00
set ( CMAKE_INSTALL_MESSAGE "LAZY" )
2018-07-30 05:20:34 +00:00
endif ( )
2010-06-07 14:28:37 +00:00
# quiet output for Makefiles, 'make -s' helps too
2010-12-08 08:43:06 +00:00
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
2010-06-07 14:28:37 +00:00
2011-10-26 00:51:29 +00:00
# global compile definitions since add_definitions() adds for all.
2018-05-18 12:26:02 +00:00
set_property ( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
2019-04-17 04:35:54 +00:00
$ < $ < C O N F I G : D e b u g > : D E B U G ; _ D E B U G >
$ < $ < C O N F I G : R e l e a s e > : N D E B U G >
$ < $ < C O N F I G : M i n S i z e R e l > : N D E B U G >
$ < $ < C O N F I G : R e l W i t h D e b I n f o > : N D E B U G >
2018-05-18 12:26:02 +00:00
)
2011-10-26 00:51:29 +00:00
2011-08-22 12:24:14 +00:00
#-----------------------------------------------------------------------------
# Set policy
2015-11-09 15:52:29 +00:00
# see "cmake --help-policy CMP0003"
# So library linking is more sane
cmake_policy ( SET CMP0003 NEW )
# So BUILDINFO and BLENDERPATH strings are automatically quoted
cmake_policy ( SET CMP0005 NEW )
# So syntax problems are errors
cmake_policy ( SET CMP0010 NEW )
# Input directories must have CMakeLists.txt
cmake_policy ( SET CMP0014 NEW )
2011-08-22 12:24:14 +00:00
2011-05-23 14:56:14 +00:00
#-----------------------------------------------------------------------------
# Load some macros.
include ( build_files/cmake/macros.cmake )
2011-04-09 11:16:37 +00:00
2011-05-23 14:56:14 +00:00
#-----------------------------------------------------------------------------
# Initialize project.
2006-11-17 02:27:12 +00:00
2011-05-23 14:56:14 +00:00
blender_project_hack_pre ( )
2011-04-09 11:16:37 +00:00
2011-05-23 14:56:14 +00:00
project ( Blender )
2011-04-09 11:16:37 +00:00
2011-05-23 14:56:14 +00:00
blender_project_hack_post ( )
2011-04-09 11:16:37 +00:00
2011-01-21 00:06:30 +00:00
enable_testing ( )
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
# Redirect output files
2012-05-19 13:55:54 +00:00
set ( EXECUTABLE_OUTPUT_PATH ${ CMAKE_BINARY_DIR } /bin CACHE INTERNAL "" FORCE )
set ( LIBRARY_OUTPUT_PATH ${ CMAKE_BINARY_DIR } /lib CACHE INTERNAL "" FORCE )
2018-08-17 16:04:55 +00:00
if ( MSVC )
2019-04-17 04:35:54 +00:00
set ( TESTS_OUTPUT_DIR ${ EXECUTABLE_OUTPUT_PATH } /tests/ $< CONFIG > / CACHE INTERNAL "" FORCE )
2018-08-17 20:14:26 +00:00
else ( )
2019-04-17 04:35:54 +00:00
set ( TESTS_OUTPUT_DIR ${ EXECUTABLE_OUTPUT_PATH } /tests/ CACHE INTERNAL "" FORCE )
2018-08-17 16:04:55 +00:00
endif ( )
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
# Set default config options
2010-06-06 13:32:58 +00:00
2010-12-08 08:43:06 +00:00
get_blender_version ( )
2010-07-14 20:26:46 +00:00
2014-11-13 22:32:01 +00:00
#-----------------------------------------------------------------------------
# Platform Specific Defaults
# list of var-names
set ( _init_vars )
# initialize to ON
macro ( option_defaults_init )
2019-04-17 04:35:54 +00:00
foreach ( _var ${ ARGV } )
set ( ${ _var } ON )
list ( APPEND _init_vars "${_var}" )
endforeach ( )
unset ( _var )
2014-11-13 22:32:01 +00:00
endmacro ( )
# remove from namespace
macro ( option_defaults_clear )
2019-04-17 04:35:54 +00:00
foreach ( _var ${ _init_vars } )
unset ( ${ _var } )
endforeach ( )
unset ( _var )
unset ( _init_vars )
2014-11-13 22:32:01 +00:00
endmacro ( )
# values to initialize WITH_****
option_defaults_init (
2019-04-17 04:35:54 +00:00
_ i n i t _ B U I L D I N F O
_ i n i t _ C O D E C _ F F M P E G
_ i n i t _ C Y C L E S _ O S L
_ i n i t _ I M A G E _ O P E N E X R
_ i n i t _ I N P U T _ N D O F
_ i n i t _ J A C K
_ i n i t _ O P E N C O L L A D A
_ i n i t _ O P E N C O L O R I O
_ i n i t _ S D L
_ i n i t _ F F T W 3
_ i n i t _ O P E N S U B D I V
2014-11-13 22:32:01 +00:00
)
# customize...
2016-04-23 14:16:15 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
# some of these libraries are problematic on Linux
# disable less important dependencies by default
set ( _init_CODEC_FFMPEG OFF )
set ( _init_CYCLES_OSL OFF )
set ( _init_IMAGE_OPENEXR OFF )
set ( _init_JACK OFF )
set ( _init_OPENCOLLADA OFF )
set ( _init_OPENCOLORIO OFF )
set ( _init_SDL OFF )
set ( _init_FFTW3 OFF )
set ( _init_OPENSUBDIV OFF )
2019-08-15 16:09:58 +00:00
set ( _init_OPENVDB OFF )
set ( _init_OPENIMAGEDENOISE OFF )
2015-07-28 07:47:21 +00:00
elseif ( WIN32 )
2019-04-17 04:35:54 +00:00
set ( _init_JACK OFF )
2015-07-28 07:47:21 +00:00
elseif ( APPLE )
2019-04-17 04:35:54 +00:00
set ( _init_JACK OFF )
2014-11-13 22:32:01 +00:00
endif ( )
2014-11-26 12:24:56 +00:00
#-----------------------------------------------------------------------------
# Options
2017-04-27 11:40:18 +00:00
# First platform specific non-cached vars
2017-11-30 06:56:01 +00:00
if ( UNIX AND NOT ( APPLE OR HAIKU ) )
2019-04-17 04:35:54 +00:00
set ( WITH_X11 ON )
2014-11-26 12:24:56 +00:00
endif ( )
2010-06-06 13:32:58 +00:00
# Blender internal features
2011-07-13 08:15:06 +00:00
option ( WITH_BLENDER "Build blender (disable to build only the blender player)" ON )
mark_as_advanced ( WITH_BLENDER )
2011-03-11 01:24:16 +00:00
option ( WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON )
2011-04-28 06:20:47 +00:00
2011-03-11 01:24:16 +00:00
option ( WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON )
2018-06-10 06:12:13 +00:00
option ( WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON )
2018-09-03 14:49:08 +00:00
mark_as_advanced ( WITH_PYTHON ) # don't want people disabling this unless they really know what they are doing.
2012-09-28 06:45:20 +00:00
mark_as_advanced ( WITH_PYTHON_SECURITY ) # some distributions see this as a security issue, rather than have them patch it, make a build option.
2011-04-28 06:20:47 +00:00
2018-09-03 14:49:08 +00:00
option ( WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some efficiency, only enable for development)." OFF )
2015-03-05 04:23:22 +00:00
mark_as_advanced ( WITH_PYTHON_SAFETY )
2015-03-24 08:09:51 +00:00
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 )
2013-03-24 12:13:13 +00:00
if ( APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF )
2013-02-22 22:24:38 +00:00
endif ( )
2014-11-13 22:32:01 +00:00
option ( WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ${ _init_BUILDINFO } )
2014-08-01 17:07:41 +00:00
if ( ${ CMAKE_VERSION } VERSION_LESS 2.8.8 )
2019-04-17 04:35:54 +00:00
# add_library OBJECT arg unsupported
set ( WITH_BUILDINFO OFF )
2014-08-01 17:07:41 +00:00
endif ( )
2018-09-03 14:49:08 +00:00
set ( BUILDINFO_OVERRIDE_DATE "" CACHE STRING "Use instead of the current date for reproducible builds (empty string disables this option)" )
set ( BUILDINFO_OVERRIDE_TIME "" CACHE STRING "Use instead of the current time for reproducible builds (empty string disables this option)" )
2016-09-06 13:21:23 +00:00
set ( CPACK_OVERRIDE_PACKAGENAME "" CACHE STRING "Use instead of the standard packagename (empty string disables this option)" )
mark_as_advanced ( CPACK_OVERRIDE_PACKAGENAME )
2016-05-10 16:43:58 +00:00
mark_as_advanced ( BUILDINFO_OVERRIDE_DATE )
mark_as_advanced ( BUILDINFO_OVERRIDE_TIME )
2014-08-01 17:07:41 +00:00
2011-03-11 01:24:16 +00:00
option ( WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON )
2012-08-18 13:36:29 +00:00
option ( WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON )
2017-05-24 09:36:41 +00:00
option ( WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ${ _init_FFTW3 } )
2010-12-08 08:43:06 +00:00
option ( WITH_BULLET "Enable Bullet (Physics Engine)" ON )
2013-01-03 00:23:52 +00:00
option ( WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced ( WITH_SYSTEM_BULLET )
2014-11-13 22:32:01 +00:00
option ( WITH_OPENCOLORIO "Enable OpenColorIO color management" ${ _init_OPENCOLORIO } )
2015-07-18 08:35:03 +00:00
# Compositor
option ( WITH_COMPOSITOR "Enable the tile based nodal compositor" ON )
2019-08-15 16:09:58 +00:00
option ( WITH_OPENIMAGEDENOISE "Enable the OpenImageDenoise compositing node" ${ _init_OPENIMAGEDENOISE } )
2011-06-04 14:12:55 +00:00
2018-11-30 10:50:23 +00:00
option ( WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" ${ _init_OPENSUBDIV } )
2015-07-20 14:08:06 +00:00
2019-08-15 16:09:58 +00:00
option ( WITH_OPENVDB "Enable features relying on OpenVDB" ${ _init_OPENVDB } )
option ( WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" ${ _init_OPENVDB } )
2018-04-02 16:55:10 +00:00
option ( WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF )
mark_as_advanced ( WITH_OPENVDB_3_ABI_COMPATIBLE )
Implementation of OpenVDB as a possible cache format for smoke
simulations.
This commits implements OpenVDB as an extra cache format in the Point
Cache system for smoke simulations. Compilation with the library is
turned off by default for now, and shall be enabled when the library is
present.
A documentation of its doings is available here: http://
wiki.blender.org/index.php/User:Kevindietrich/OpenVDBSmokeExport.
A guide to compile OpenVDB can be found here (Linux): http://
wiki.blender.org/index.php?title=Dev:Doc/Building_Blender/Linux/
Dependencies_From_Source#OpenVDB
Reviewers: sergey, lukastoenne, brecht, campbellbarton
Reviewed By: brecht, campbellbarton
Subscribers: galenb, Blendify, robocyte, Lapineige, bliblubli,
jtheninja, lukasstockner97, dingto, brecht
Differential Revision: https://developer.blender.org/D1721
2016-01-23 07:39:29 +00:00
2011-07-13 06:04:54 +00:00
# GHOST Windowing Library Options
option ( WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF )
mark_as_advanced ( WITH_GHOST_DEBUG )
2011-06-23 09:27:56 +00:00
2016-01-18 09:20:08 +00:00
option ( WITH_GHOST_SDL "Enable building Blender against SDL for windowing rather than the native APIs" OFF )
2011-07-13 06:04:54 +00:00
mark_as_advanced ( WITH_GHOST_SDL )
2011-07-12 13:17:54 +00:00
2014-11-13 18:43:15 +00:00
if ( WITH_X11 )
2019-04-17 04:35:54 +00:00
option ( WITH_GHOST_XDND "Enable drag'n'drop support on X11 using XDND protocol" ON )
2014-11-13 18:43:15 +00:00
endif ( )
2011-07-13 06:04:54 +00:00
# Misc...
2011-06-04 14:12:55 +00:00
option ( WITH_HEADLESS "Build without graphical support (renderfarm, server mode only)" OFF )
mark_as_advanced ( WITH_HEADLESS )
2019-08-26 16:34:11 +00:00
option ( WITH_QUADRIFLOW "Build with quadriflow remesher support" ON )
2011-10-23 15:43:12 +00:00
option ( WITH_AUDASPACE "Build with blenders audio library (only disable if you know what you're doing!)" ON )
2015-06-16 08:03:35 +00:00
option ( WITH_SYSTEM_AUDASPACE "Build with external audaspace library installed on the system (only enable if you know what you're doing!)" OFF )
2011-07-13 06:04:54 +00:00
mark_as_advanced ( WITH_AUDASPACE )
2015-06-16 08:03:35 +00:00
mark_as_advanced ( WITH_SYSTEM_AUDASPACE )
if ( NOT WITH_AUDASPACE )
2019-04-17 04:35:54 +00:00
set ( WITH_SYSTEM_AUDASPACE OFF )
2015-06-16 08:03:35 +00:00
endif ( )
2011-07-13 06:04:54 +00:00
2014-04-14 09:38:34 +00:00
option ( WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" ON )
2015-12-02 13:09:06 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_OPENMP_STATIC "Link OpenMP statically (only used by the release environment)" OFF )
mark_as_advanced ( WITH_OPENMP_STATIC )
2015-12-02 13:09:06 +00:00
endif ( )
2010-06-06 13:32:58 +00:00
2014-10-07 20:46:19 +00:00
if ( WITH_X11 )
2019-04-17 04:35:54 +00:00
option ( WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON )
option ( WITH_X11_XF86VMODE "Enable X11 video mode switching" ON )
option ( WITH_X11_XFIXES "Enable X11 XWayland cursor warping workaround" ON )
option ( WITH_X11_ALPHA "Enable X11 transparent background" ON )
2014-10-07 20:46:19 +00:00
endif ( )
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" OFF )
option ( WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON )
2011-04-06 01:51:43 +00:00
else ( )
2019-04-17 04:35:54 +00:00
# not an option for other OS's
set ( WITH_SYSTEM_GLEW OFF )
set ( WITH_SYSTEM_GLES OFF )
2011-03-25 04:56:48 +00:00
endif ( )
2012-06-23 14:23:44 +00:00
2015-03-19 04:41:41 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF )
2015-03-19 04:41:41 +00:00
endif ( )
2012-06-23 14:23:44 +00:00
2010-10-23 15:40:13 +00:00
# Modifiers
2012-10-29 15:43:54 +00:00
option ( WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON )
option ( WITH_MOD_SMOKE "Enable Smoke Modifier (Smoke Simulation)" ON )
option ( WITH_MOD_REMESH "Enable Remesh Modifier" ON )
2012-11-27 09:52:20 +00:00
# option(WITH_MOD_CLOTH_ELTOPO "Enable Experimental cloth solver" OFF) # this is now only available in a branch
# mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
2011-11-13 14:16:43 +00:00
option ( WITH_MOD_OCEANSIM "Enable Ocean Modifier" OFF )
2010-10-23 15:40:13 +00:00
2010-06-06 13:32:58 +00:00
# Image format support
2014-11-13 22:32:01 +00:00
option ( WITH_OPENIMAGEIO "Enable OpenImageIO Support (http://www.openimageio.org)" ON )
option ( WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ${ _init_IMAGE_OPENEXR } )
2010-12-08 08:43:06 +00:00
option ( WITH_IMAGE_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org)" ON )
2012-04-12 08:36:07 +00:00
option ( WITH_IMAGE_TIFF "Enable LibTIFF Support" ON )
2010-12-08 08:43:06 +00:00
option ( WITH_IMAGE_DDS "Enable DDS Image Support" ON )
option ( WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON )
option ( WITH_IMAGE_HDR "Enable HDR Image Support" ON )
2010-06-06 13:32:58 +00:00
2010-11-30 18:52:39 +00:00
# Audio/Video format support
2012-10-08 02:51:42 +00:00
option ( WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)" ON )
2014-11-13 22:32:01 +00:00
option ( WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" ${ _init_CODEC_FFMPEG } )
2010-12-08 08:43:06 +00:00
option ( WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF )
2013-11-17 08:23:18 +00:00
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 04:20:37 +00:00
# Alembic support
option ( WITH_ALEMBIC "Enable Alembic Support" OFF )
option ( WITH_ALEMBIC_HDF5 "Enable Legacy Alembic Support (not officially supported)" OFF )
2010-06-06 13:32:58 +00:00
# 3D format support
2013-11-18 16:12:19 +00:00
# Disable opencollada when we don't have precompiled libs
2014-11-13 22:32:01 +00:00
option ( WITH_OPENCOLLADA "Enable OpenCollada Support (http://www.opencollada.org)" ${ _init_OPENCOLLADA } )
2009-11-19 11:49:42 +00:00
2010-06-06 13:32:58 +00:00
# Sound output
2014-11-13 22:32:01 +00:00
option ( WITH_SDL "Enable SDL for sound and joystick support" ${ _init_SDL } )
2010-12-08 08:43:06 +00:00
option ( WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON )
2016-10-22 12:20:47 +00:00
option ( WITH_JACK "Enable JACK Support (http://www.jackaudio.org)" ${ _init_JACK } )
2013-03-27 07:19:54 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_JACK_DYNLOAD "Enable runtime dynamic JACK libraries loading" OFF )
2013-03-27 07:19:54 +00:00
endif ( )
2014-11-17 11:35:36 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_SDL_DYNLOAD "Enable runtime dynamic SDL libraries loading" OFF )
2014-11-17 11:35:36 +00:00
endif ( )
2010-06-06 13:32:58 +00:00
# Compression
2010-12-08 08:43:06 +00:00
option ( WITH_LZO "Enable fast LZO compression (used for pointcache)" ON )
option ( WITH_LZMA "Enable best LZMA compression, (used for pointcache)" ON )
2015-03-13 11:33:31 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_SYSTEM_LZO "Use the system LZO library" OFF )
2015-03-13 11:33:31 +00:00
endif ( )
2019-04-11 09:26:23 +00:00
option ( WITH_DRACO "Enable Draco mesh compression Python module (used for glTF)" ON )
2010-06-06 13:32:58 +00:00
2011-11-07 12:55:18 +00:00
# Camera/motion tracking
2015-07-18 08:35:03 +00:00
option ( WITH_LIBMV "Enable Libmv structure from motion library" ON )
2016-01-26 10:47:53 +00:00
option ( WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." OFF )
2014-11-13 22:32:01 +00:00
mark_as_advanced ( WITH_LIBMV_SCHUR_SPECIALIZATIONS )
2011-11-07 12:55:18 +00:00
2017-04-21 08:58:01 +00:00
# Logging/unbit test libraries.
option ( WITH_SYSTEM_GFLAGS "Use system-wide Gflags instead of a bundled one" OFF )
2017-04-30 16:52:38 +00:00
option ( WITH_SYSTEM_GLOG "Use system-wide Glog instead of a bundled one" OFF )
2017-04-21 08:58:01 +00:00
mark_as_advanced ( WITH_SYSTEM_GFLAGS )
2017-04-21 12:26:25 +00:00
mark_as_advanced ( WITH_SYSTEM_GLOG )
2017-04-21 08:58:01 +00:00
2012-12-20 07:57:26 +00:00
# Freestyle
option ( WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON )
2010-06-06 13:32:58 +00:00
# Misc
2014-12-06 23:58:17 +00:00
if ( WIN32 )
2019-04-17 04:35:54 +00:00
option ( WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON )
2014-12-06 23:58:17 +00:00
endif ( )
2014-11-13 22:32:01 +00:00
option ( WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${ _init_INPUT_NDOF } )
2019-04-17 04:35:54 +00:00
option ( WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON )
2011-03-06 11:41:30 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON )
option ( WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF )
if ( WITH_STATIC_LIBS )
option ( WITH_BOOST_ICU "Boost uses ICU library (required for linking with static Boost built with libicu)." OFF )
mark_as_advanced ( WITH_BOOST_ICU )
endif ( )
2011-03-06 11:41:30 +00:00
endif ( )
2016-03-15 12:50:44 +00:00
2010-12-08 08:43:06 +00:00
option ( WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON )
2018-09-17 09:10:45 +00:00
if ( WIN32 OR APPLE )
2019-04-17 04:35:54 +00:00
# Windows and macOS have this bundled with Python libraries.
2018-09-17 09:10:45 +00:00
elseif ( WITH_PYTHON_INSTALL OR ( WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE ) )
2019-04-17 04:35:54 +00:00
set ( PYTHON_NUMPY_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'numpy' module" )
mark_as_advanced ( PYTHON_NUMPY_PATH )
set ( PYTHON_NUMPY_INCLUDE_DIRS ${ PYTHON_NUMPY_PATH } /numpy/core/include CACHE PATH "Path to the include directory of the numpy module" )
mark_as_advanced ( PYTHON_NUMPY_INCLUDE_DIRS )
2017-08-18 06:24:12 +00:00
endif ( )
if ( WITH_PYTHON_INSTALL )
2019-04-17 04:35:54 +00:00
option ( WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON )
2016-03-15 12:50:44 +00:00
2019-04-17 04:35:54 +00:00
if ( UNIX AND NOT APPLE )
option ( WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON )
set ( PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module" )
mark_as_advanced ( PYTHON_REQUESTS_PATH )
endif ( )
2016-03-15 12:50:44 +00:00
endif ( )
2014-10-15 08:53:12 +00:00
option ( WITH_CPU_SSE "Enable SIMD instruction if they're detected on the host machine" ON )
mark_as_advanced ( WITH_CPU_SSE )
2012-05-01 23:22:58 +00:00
2011-04-28 13:47:27 +00:00
# Cycles
2019-04-17 04:35:54 +00:00
option ( WITH_CYCLES "Enable Cycles Render Engine" ON )
option ( WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF )
option ( WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF )
option ( WITH_CYCLES_OSL "Build Cycles with OSL support" ${ _init_CYCLES_OSL } )
option ( WITH_CYCLES_EMBREE "Build Cycles with Embree support" OFF )
option ( WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF )
option ( WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF )
2018-08-20 08:17:34 +00:00
option ( WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF )
mark_as_advanced ( WITH_CYCLES_CUDA_BUILD_SERIAL )
2019-01-18 11:38:19 +00:00
set ( CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 CACHE STRING "CUDA architectures to build binaries for" )
2011-11-13 14:16:43 +00:00
mark_as_advanced ( CYCLES_CUDA_BINARIES_ARCH )
2012-05-22 12:30:37 +00:00
unset ( PLATFORM_DEFAULT )
2019-04-17 04:35:54 +00:00
option ( WITH_CYCLES_LOGGING "Build Cycles with logging support" ON )
option ( WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF )
option ( WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF )
2019-07-11 17:29:29 +00:00
option ( WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF )
mark_as_advanced ( WITH_CYCLES_KERNEL_ASAN )
2018-02-03 17:59:09 +00:00
mark_as_advanced ( WITH_CYCLES_CUBIN_COMPILER )
2014-10-04 13:00:26 +00:00
mark_as_advanced ( WITH_CYCLES_LOGGING )
mark_as_advanced ( WITH_CYCLES_DEBUG )
2016-03-25 15:09:05 +00:00
mark_as_advanced ( WITH_CYCLES_NATIVE_ONLY )
2011-04-28 13:47:27 +00:00
2019-04-17 04:35:54 +00:00
option ( WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON )
2019-09-12 12:50:06 +00:00
option ( WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" OFF )
2019-04-17 04:35:54 +00:00
option ( WITH_CYCLES_DEVICE_OPENCL "Enable Cycles OpenCL compute support" ON )
option ( WITH_CYCLES_NETWORK "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF )
2018-02-14 09:31:04 +00:00
mark_as_advanced ( WITH_CYCLES_DEVICE_CUDA )
mark_as_advanced ( WITH_CYCLES_DEVICE_OPENCL )
mark_as_advanced ( WITH_CYCLES_NETWORK )
2016-01-14 07:24:09 +00:00
option ( WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON )
mark_as_advanced ( WITH_CUDA_DYNLOAD )
2012-10-06 11:00:45 +00:00
# LLVM
2019-04-17 04:35:54 +00:00
option ( WITH_LLVM "Use LLVM" OFF )
2014-08-06 10:48:06 +00:00
if ( APPLE )
2019-04-17 04:35:54 +00:00
option ( LLVM_STATIC "Link with LLVM static libraries" ON ) # we prefer static llvm build on Apple, dyn build possible though
2014-08-06 10:48:06 +00:00
else ( )
2019-04-17 04:35:54 +00:00
option ( LLVM_STATIC "Link with LLVM static libraries" OFF )
2014-08-06 10:48:06 +00:00
endif ( )
2013-04-15 16:18:35 +00:00
mark_as_advanced ( LLVM_STATIC )
2012-10-06 11:00:45 +00:00
2011-05-12 11:16:32 +00:00
# disable for now, but plan to support on all platforms eventually
2015-02-14 10:13:48 +00:00
option ( WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" ON )
2011-05-12 11:16:32 +00:00
mark_as_advanced ( WITH_MEM_JEMALLOC )
2013-10-03 12:22:44 +00:00
# currently only used for BLI_mempool
option ( WITH_MEM_VALGRIND "Enable extended valgrind support for better reporting" OFF )
mark_as_advanced ( WITH_MEM_VALGRIND )
2010-12-08 09:02:08 +00:00
# Debug
2011-03-11 01:24:16 +00:00
option ( WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF )
2010-12-08 09:02:08 +00:00
mark_as_advanced ( WITH_CXX_GUARDEDALLOC )
2018-06-28 08:48:06 +00:00
option ( WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON )
2010-12-15 10:22:26 +00:00
mark_as_advanced ( WITH_ASSERT_ABORT )
2019-04-17 04:35:54 +00:00
option ( WITH_BOOST "Enable features depending on boost" ON )
2013-01-31 23:25:06 +00:00
2014-06-18 12:49:17 +00:00
# Unit testsing
option ( WITH_GTESTS "Enable GTest unit testing" OFF )
2018-02-14 19:33:33 +00:00
option ( WITH_OPENGL_RENDER_TESTS "Enable OpenGL render related unit testing (Experimental)" OFF )
option ( WITH_OPENGL_DRAW_TESTS "Enable OpenGL UI drawing related unit testing (Experimental)" OFF )
2014-06-18 12:49:17 +00:00
2014-11-13 13:07:34 +00:00
# Documentation
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
option ( WITH_DOC_MANPAGE "Create a manual page (Unix manpage)" OFF )
2014-11-13 13:07:34 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
# OpenGL
2018-06-16 02:17:16 +00:00
option ( WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON )
2014-10-07 20:46:19 +00:00
option ( WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF )
option ( WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF )
2019-08-01 03:53:25 +00:00
option ( WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)" OFF )
2014-10-07 20:46:19 +00:00
mark_as_advanced (
2019-04-17 04:35:54 +00:00
W I T H _ O P E N G L
W I T H _ G L E W _ E S
W I T H _ G L _ E G L
W I T H _ G L _ P R O F I L E _ E S 2 0
2014-10-07 20:46:19 +00:00
)
if ( WIN32 )
2019-04-17 04:35:54 +00:00
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 )
mark_as_advanced ( WITH_GL_ANGLE )
2014-10-07 20:46:19 +00:00
endif ( )
if ( WITH_GLEW_ES AND WITH_SYSTEM_GLEW )
2019-04-17 04:35:54 +00:00
message ( WARNING Ignoring WITH_SYSTEM_GLEW and using WITH_GLEW_ES )
set ( WITH_SYSTEM_GLEW OFF )
2014-10-07 20:46:19 +00:00
endif ( )
2015-12-27 15:57:31 +00:00
if ( WIN32 )
2019-04-17 04:35:54 +00:00
getDefaultWindowsPrefixBase ( CMAKE_GENERIC_PROGRAM_FILES )
set ( CPACK_INSTALL_PREFIX ${ CMAKE_GENERIC_PROGRAM_FILES } / $ {} )
2014-11-08 10:32:32 +00:00
endif ( )
2016-11-02 09:42:15 +00:00
# Compiler toolchain
if ( CMAKE_COMPILER_IS_GNUCC )
2019-04-17 04:35:54 +00:00
option ( WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON )
mark_as_advanced ( WITH_LINKER_GOLD )
2016-11-02 09:42:15 +00:00
endif ( )
2018-05-18 13:21:18 +00:00
if ( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" )
2019-04-17 04:35:54 +00:00
option ( WITH_COMPILER_ASAN "Build and link against address sanitizer (only for Debug & RelWithDebInfo targets)." OFF )
mark_as_advanced ( WITH_COMPILER_ASAN )
2018-05-18 13:21:18 +00:00
2019-04-17 04:35:54 +00:00
if ( WITH_COMPILER_ASAN )
set ( _asan_defaults " \
2018-05-18 13:21:18 +00:00
- f s a n i t i z e = a d d r e s s \
- f s a n i t i z e = b o o l \
- f s a n i t i z e = b o u n d s \
- f s a n i t i z e = e n u m \
- f s a n i t i z e = f l o a t - c a s t - o v e r f l o w \
- f s a n i t i z e = f l o a t - d i v i d e - b y - z e r o \
- f s a n i t i z e = n o n n u l l - a t t r i b u t e \
- f s a n i t i z e = r e t u r n s - n o n n u l l - a t t r i b u t e \
- f s a n i t i z e = s i g n e d - i n t e g e r - o v e r f l o w \
- f s a n i t i z e = u n d e f i n e d \
- f s a n i t i z e = v l a - b o u n d \
- f n o - s a n i t i z e = a l i g n m e n t \
" )
2019-04-17 04:35:54 +00:00
if ( NOT MSVC ) # not all sanitizers are supported with clang-cl, these two however are very vocal about it
set ( _asan_defaults "${_asan_defaults} -fsanitize=leak -fsanitize=object-size" )
endif ( )
set ( COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer" )
mark_as_advanced ( COMPILER_ASAN_CFLAGS )
set ( COMPILER_ASAN_CXXFLAGS "${_asan_defaults}" CACHE STRING "C++ flags for address sanitizer" )
mark_as_advanced ( COMPILER_ASAN_CXXFLAGS )
unset ( _asan_defaults )
if ( NOT MSVC )
find_library ( COMPILER_ASAN_LIBRARY asan ${ CMAKE_C_IMPLICIT_LINK_DIRECTORIES } )
else ( )
find_library ( COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
P A T H S
[ H K E Y _ L O C A L _ M A C H I N E \ \ S O F T W A R E \ \ W o w 6 4 3 2 N o d e \ \ L L V M \ \ L L V M ; ] / l i b / c l a n g / 7 . 0 . 0 / l i b / w i n d o w s
[ H K E Y _ L O C A L _ M A C H I N E \ \ S O F T W A R E \ \ W o w 6 4 3 2 N o d e \ \ L L V M \ \ L L V M ; ] / l i b / c l a n g / 6 . 0 . 0 / l i b / w i n d o w s
)
endif ( )
mark_as_advanced ( COMPILER_ASAN_LIBRARY )
endif ( )
2018-05-18 13:21:18 +00:00
endif ( )
2017-03-05 17:05:00 +00:00
if ( WIN32 )
2019-04-17 04:35:54 +00:00
# Use hardcoded paths or find_package to find externals
option ( WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF )
mark_as_advanced ( WITH_WINDOWS_FIND_MODULES )
2016-08-23 14:47:23 +00:00
2019-04-17 04:35:54 +00:00
option ( WITH_WINDOWS_CODESIGN "Use signtool to sign the final binary." OFF )
mark_as_advanced ( WITH_WINDOWS_CODESIGN )
2016-08-31 12:26:05 +00:00
2019-04-17 04:35:54 +00:00
set ( WINDOWS_CODESIGN_PFX CACHE FILEPATH "Path to pfx file to use for codesigning." )
mark_as_advanced ( WINDOWS_CODESIGN_PFX )
2016-08-31 12:26:05 +00:00
2019-04-17 04:35:54 +00:00
set ( WINDOWS_CODESIGN_PFX_PASSWORD CACHE STRING "password for pfx file used for codesigning." )
mark_as_advanced ( WINDOWS_CODESIGN_PFX_PASSWORD )
2018-02-03 23:38:27 +00:00
2019-06-15 18:35:36 +00:00
option ( WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON )
mark_as_advanced ( WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS )
2018-10-22 16:17:08 +00:00
2019-06-15 18:44:47 +00:00
option ( WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON )
mark_as_advanced ( WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS )
2019-04-17 04:35:54 +00:00
option ( WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF )
mark_as_advanced ( WINDOWS_PYTHON_DEBUG )
2017-03-05 17:05:00 +00:00
endif ( )
2016-08-31 12:26:05 +00:00
CMake: Add support of Ninja's pools to ease building on limited amount of RAM.
Many modern computers support a lot of threads (parrallel building
jobs), but are somewhat restricted in memory, when some building jobs
can require several GB each.
Ninja builder has pools, which extend the usual `-j X` make
parallelizing option, by allowing to specify different numbers of
parallel jobs for different targets.
This commit defines three pools, one for linking, one for usual compile,
and one for compiling some 'heavy' cpp libs, when a single file can
require GB of RAM in full debug builds.
Simply enabling WITH_NINJA_POOL_JOBS will try to set default sensible
values for those three pools based on your machine specifications, you
can then tweak further the values of NINJA_MAX_NUM_PARALLEL_ settings,
if you like.
On my system (8 cores, 16GB RAM), it allows to build a full debug with
all ASAN options build with roughly 7GB of RAM used at most, pretty much
as quickly as without that option (which would require up to 11GB of
available RAM at some points).
Review task: D4780.
2019-05-07 18:32:14 +00:00
# The following only works with the Ninja generator in CMake >= 3.0.
if ( "${CMAKE_GENERATOR}" MATCHES "Ninja" )
option ( WITH_NINJA_POOL_JOBS
" E n a b l e N i n j a p o o l s o f j o b s , t o t r y t o e a s e b u i l d i n g o n m a c h i n e s w i t h 1 6 G B o f R A M o r less ( if not yet defined, will try to set best values based on detected machine specifications ) . "
O F F )
mark_as_advanced ( WITH_NINJA_POOL_JOBS )
endif ( )
2014-11-13 22:32:01 +00:00
# avoid using again
option_defaults_clear ( )
# end option(...)
2014-11-11 20:44:26 +00:00
2014-11-08 10:32:32 +00:00
# By default we want to install to the directory we are compiling our executables
# unless specified otherwise, which we currently do not allow
2014-11-13 14:03:30 +00:00
if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
2019-04-17 04:35:54 +00:00
if ( WIN32 )
set ( CMAKE_INSTALL_PREFIX ${ EXECUTABLE_OUTPUT_PATH } /\ ${ BUILD_TYPE } CACHE PATH "default install path" FORCE )
elseif ( APPLE )
set ( CMAKE_INSTALL_PREFIX ${ EXECUTABLE_OUTPUT_PATH } /\ ${ BUILD_TYPE } CACHE PATH "default install path" FORCE )
else ( )
if ( WITH_INSTALL_PORTABLE )
set ( CMAKE_INSTALL_PREFIX ${ EXECUTABLE_OUTPUT_PATH } CACHE PATH "default install path" FORCE )
endif ( )
endif ( )
2014-11-08 10:32:32 +00:00
endif ( )
2014-11-11 20:44:26 +00:00
2014-11-08 10:32:32 +00:00
2014-10-07 20:46:19 +00:00
# Apple
2010-12-08 08:43:06 +00:00
if ( APPLE )
2019-04-17 04:35:54 +00:00
include ( platform_apple_xcode )
2010-12-08 08:43:06 +00:00
endif ( )
2010-06-06 13:32:58 +00:00
2012-03-13 22:27:21 +00:00
2011-06-08 01:53:12 +00:00
#-----------------------------------------------------------------------------
# Check for conflicting/unsupported configurations
2018-04-16 13:54:36 +00:00
if ( NOT WITH_BLENDER AND NOT WITH_CYCLES_STANDALONE )
2019-04-17 04:35:54 +00:00
message ( FATAL_ERROR
" A t l e a s t o n e o f W I T H _ B L E N D E R o r W I T H _ C Y C L E S _ S T A N D A L O N E "
" m u s t b e e n a b l e d , n o t h i n g t o d o ! "
)
2011-07-13 08:15:06 +00:00
endif ( )
2012-11-12 04:50:45 +00:00
if ( NOT WITH_AUDASPACE )
2019-04-17 04:35:54 +00:00
if ( WITH_OPENAL )
message ( WARNING "WITH_OPENAL requires WITH_AUDASPACE which is disabled" )
set ( WITH_OPENAL OFF )
endif ( )
if ( WITH_JACK )
message ( WARNING "WITH_JACK requires WITH_AUDASPACE which is disabled" )
set ( WITH_JACK OFF )
endif ( )
2011-06-23 09:27:56 +00:00
endif ( )
2011-07-13 06:04:54 +00:00
if ( NOT WITH_SDL AND WITH_GHOST_SDL )
2019-04-17 04:35:54 +00:00
message ( FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL" )
2011-07-12 13:17:54 +00:00
endif ( )
2018-04-16 12:07:42 +00:00
# python module, needs some different options
2011-02-22 14:27:46 +00:00
if ( WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL )
2019-04-17 04:35:54 +00:00
message ( FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF" )
2011-02-22 14:27:46 +00:00
endif ( )
2012-04-12 05:34:17 +00:00
2011-06-04 14:12:55 +00:00
# may as well build python module without a UI
if ( WITH_PYTHON_MODULE )
2019-04-17 04:35:54 +00:00
set ( WITH_HEADLESS ON )
2011-06-04 14:12:55 +00:00
endif ( )
2013-08-07 22:40:03 +00:00
if ( NOT WITH_PYTHON )
2019-04-17 04:35:54 +00:00
set ( WITH_CYCLES OFF )
set ( WITH_DRACO OFF )
2013-08-07 22:40:03 +00:00
endif ( )
2019-04-12 12:26:17 +00:00
if ( WITH_DRACO AND NOT WITH_PYTHON_INSTALL )
2019-04-17 04:35:54 +00:00
message ( STATUS "WITH_DRACO requires WITH_PYTHON_INSTALL to be ON, disabling WITH_DRACO for now" )
set ( WITH_DRACO OFF )
2019-04-12 12:26:17 +00:00
endif ( )
2014-11-13 12:36:33 +00:00
# enable boost for cycles, audaspace or i18n
2013-01-31 23:25:06 +00:00
# otherwise if the user disabled
if ( NOT WITH_BOOST )
2019-04-17 04:35:54 +00:00
# Explicitly disabled. so disable all deps.
macro ( set_and_warn
_ s e t t i n g _ v a l )
if ( ${ ${_setting } } )
message ( STATUS "'WITH_BOOST' is disabled: forcing 'set(${_setting} ${_val})'" )
endif ( )
set ( ${ _setting } ${ _val } )
endmacro ( )
set_and_warn ( WITH_CYCLES OFF )
set_and_warn ( WITH_INTERNATIONAL OFF )
set_and_warn ( WITH_OPENVDB OFF )
set_and_warn ( WITH_OPENCOLORIO OFF )
2019-08-26 16:34:11 +00:00
set_and_warn ( WITH_QUADRIFLOW OFF )
2017-08-18 08:16:39 +00:00
elseif ( WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
2018-02-07 13:44:59 +00:00
W I T H _ O P E N V D B O R W I T H _ O P E N C O L O R I O )
2019-04-17 04:35:54 +00:00
# Keep enabled
2013-01-31 23:25:06 +00:00
else ( )
2019-04-17 04:35:54 +00:00
# Disable boost if not needed.
set ( WITH_BOOST OFF )
2011-08-16 16:15:34 +00:00
endif ( )
2013-03-27 18:44:46 +00:00
# auto enable openimageio for cycles
if ( WITH_CYCLES )
2019-04-17 04:35:54 +00:00
set ( WITH_OPENIMAGEIO ON )
2015-06-13 23:34:42 +00:00
2019-04-17 04:35:54 +00:00
# auto enable llvm for cycles_osl
if ( WITH_CYCLES_OSL )
set ( WITH_LLVM ON CACHE BOOL "" FORCE )
endif ( )
2015-06-13 23:50:33 +00:00
else ( )
2019-04-17 04:35:54 +00:00
set ( WITH_CYCLES_OSL OFF )
2013-03-27 18:44:46 +00:00
endif ( )
# auto enable openimageio linking dependencies
if ( WITH_OPENIMAGEIO )
2019-04-17 04:35:54 +00:00
set ( WITH_IMAGE_OPENEXR ON )
set ( WITH_IMAGE_TIFF ON )
2013-03-27 18:44:46 +00:00
endif ( )
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 04:20:37 +00:00
# auto enable alembic linking dependencies
if ( WITH_ALEMBIC )
2019-04-17 04:35:54 +00:00
set ( WITH_IMAGE_OPENEXR ON )
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 04:20:37 +00:00
endif ( )
2012-09-28 06:45:20 +00:00
# don't store paths to libs for portable distribution
2011-08-23 20:19:08 +00:00
if ( WITH_INSTALL_PORTABLE )
2019-04-17 04:35:54 +00:00
set ( CMAKE_SKIP_BUILD_RPATH TRUE )
2011-08-23 20:19:08 +00:00
endif ( )
2012-03-13 14:28:58 +00:00
if ( WITH_GHOST_SDL OR WITH_HEADLESS )
2019-04-17 04:35:54 +00:00
set ( WITH_X11 OFF )
set ( WITH_X11_XINPUT OFF )
set ( WITH_X11_XF86VMODE OFF )
set ( WITH_X11_XFIXES OFF )
set ( WITH_X11_ALPHA OFF )
set ( WITH_GHOST_XDND OFF )
set ( WITH_INPUT_IME OFF )
2012-03-13 14:28:58 +00:00
endif ( )
2014-10-15 08:53:12 +00:00
if ( WITH_CPU_SSE )
2019-04-17 04:35:54 +00:00
TEST_SSE_SUPPORT ( COMPILER_SSE_FLAG COMPILER_SSE2_FLAG )
2014-10-15 08:53:12 +00:00
else ( )
2019-04-17 04:35:54 +00:00
message ( STATUS "SSE and SSE2 optimizations are DISABLED!" )
set ( COMPILER_SSE_FLAG )
set ( COMPILER_SSE2_FLAG )
2014-10-15 08:53:12 +00:00
endif ( )
2012-03-13 22:27:21 +00:00
2016-03-11 08:05:44 +00:00
if ( WITH_BUILDINFO )
2019-04-17 04:35:54 +00:00
find_package ( Git )
if ( NOT GIT_FOUND )
message ( WARNING "Git was not found, disabling WITH_BUILDINFO" )
set ( WITH_BUILDINFO OFF )
endif ( )
2016-03-11 08:05:44 +00:00
endif ( )
2015-06-16 08:03:35 +00:00
if ( WITH_AUDASPACE )
2019-04-17 04:35:54 +00:00
if ( NOT WITH_SYSTEM_AUDASPACE )
set ( AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/audaspace/bindings/C" "${CMAKE_BINARY_DIR}/extern/audaspace" )
set ( AUDASPACE_PY_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/audaspace/bindings" )
endif ( )
2015-06-16 08:03:35 +00:00
endif ( )
2018-02-14 09:20:26 +00:00
# Auto-enable CUDA dynload if toolkit is not found.
if ( NOT WITH_CUDA_DYNLOAD )
2019-04-17 04:35:54 +00:00
find_package ( CUDA )
2019-06-18 21:24:55 +00:00
if ( NOT CUDA_FOUND )
2019-04-17 04:35:54 +00:00
message ( "CUDA toolkit not found, using dynamic runtime loading of libraries instead" )
set ( WITH_CUDA_DYNLOAD ON )
endif ( )
2018-02-14 09:20:26 +00:00
endif ( )
2012-03-14 00:30:20 +00:00
#-----------------------------------------------------------------------------
2019-09-05 18:22:52 +00:00
# Check check if submodules are cloned
2012-03-14 00:30:20 +00:00
if ( WITH_INTERNATIONAL )
2019-09-05 18:22:52 +00:00
file ( GLOB RESULT "${CMAKE_SOURCE_DIR}/release/datafiles/locale" )
list ( LENGTH RESULT DIR_LEN )
if ( DIR_LEN EQUAL 0 )
2019-04-17 04:35:54 +00:00
message ( WARNING
" T r a n s l a t i o n p a t h ' $ { C M A K E _ S O U R C E _ D I R } / r e l e a s e / d a t a f i l e s / l o c a l e ' i s m i s s i n g , "
" T h i s i s a ' g i t s u b m o d u l e ' , w h i c h a r e k n o w n n o t t o w o r k w i t h b r i d g e s t o o t h e r v e r s i o n "
" c o n t r o l s y s t e m s , d i s a b l i n g ' W I T H _ I N T E R N A T I O N A L ' . "
)
set ( WITH_INTERNATIONAL OFF )
endif ( )
2012-03-14 00:30:20 +00:00
endif ( )
if ( WITH_PYTHON )
2019-04-17 04:35:54 +00:00
# While we have this as an '#error' in 'bpy_capi_utils.h',
# upgrading Python tends to cause confusion for users who build.
# Give the error message early to make this more obvious.
#
# Do this before main 'platform_*' checks,
# because UNIX will search for the old Python paths which may not exist.
# giving errors about missing paths before this case is met.
if ( DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.7" )
message ( FATAL_ERROR "At least Python 3.7 is required to build" )
endif ( )
2019-09-05 18:22:52 +00:00
file ( GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons" )
list ( LENGTH RESULT DIR_LEN )
if ( DIR_LEN EQUAL 0 )
2019-04-17 04:35:54 +00:00
message ( WARNING
" A d d o n s p a t h ' $ { C M A K E _ S O U R C E _ D I R } / r e l e a s e / s c r i p t s / a d d o n s ' i s m i s s i n g , "
" T h i s i s a ' g i t s u b m o d u l e ' , w h i c h a r e k n o w n n o t t o w o r k w i t h b r i d g e s t o o t h e r v e r s i o n "
" c o n t r o l s y s t e m s : * C O N T I N U I N G W I T H O U T A D D O N S * "
)
endif ( )
2012-03-14 00:30:20 +00:00
endif ( )
2011-02-22 06:23:07 +00:00
#-----------------------------------------------------------------------------
# Initialize un-cached vars, avoid unused warning
2011-02-21 13:13:08 +00:00
# linux only, not cached
set ( WITH_BINRELOC OFF )
2016-12-29 06:09:11 +00:00
# MACOSX only, set to avoid uninitialized
2011-10-01 19:52:33 +00:00
set ( EXETYPE "" )
2011-06-28 02:49:49 +00:00
# C/C++ flags
set ( PLATFORM_CFLAGS )
2011-06-14 00:24:50 +00:00
2011-02-22 06:23:07 +00:00
# these are added to later on.
2011-06-28 02:49:49 +00:00
set ( C_WARNINGS )
set ( CXX_WARNINGS )
2011-10-30 04:48:00 +00:00
# for gcc -Wno-blah-blah
2018-06-22 12:17:55 +00:00
set ( C_REMOVE_STRICT_FLAGS )
2018-06-22 12:07:55 +00:00
set ( CXX_REMOVE_STRICT_FLAGS )
2011-10-30 04:48:00 +00:00
2011-06-28 02:49:49 +00:00
# libraries to link the binary with passed to target_link_libraries()
# known as LLIBS to scons
2011-10-01 19:52:33 +00:00
set ( PLATFORM_LINKLIBS "" )
2011-06-28 02:49:49 +00:00
# Added to linker flags in setup_liblinks
# - CMAKE_EXE_LINKER_FLAGS
# - CMAKE_EXE_LINKER_FLAGS_DEBUG
2011-10-01 19:52:33 +00:00
set ( PLATFORM_LINKFLAGS "" )
set ( PLATFORM_LINKFLAGS_DEBUG "" )
2011-02-22 06:23:07 +00:00
2019-06-18 21:24:55 +00:00
if ( NOT CMAKE_BUILD_TYPE MATCHES "Release" )
2019-04-17 04:35:54 +00:00
if ( WITH_COMPILER_ASAN )
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}" )
2018-06-08 09:45:05 +00:00
2019-04-17 04:35:54 +00:00
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}" )
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}" )
if ( MSVC )
set ( COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6" )
endif ( )
set ( PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}" )
set ( PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}" )
set ( PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}" )
endif ( )
2018-05-18 13:21:18 +00:00
endif ( )
2011-02-22 06:23:07 +00:00
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
#Platform specifics
2014-10-07 20:46:19 +00:00
if ( WITH_X11 )
2019-04-17 04:35:54 +00:00
find_package ( X11 REQUIRED )
find_path ( X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${ X11_INC_SEARCH_PATH } )
mark_as_advanced ( X11_XF86keysym_INCLUDE_PATH )
list ( APPEND PLATFORM_LINKLIBS ${ X11_X11_LIB } )
if ( WITH_X11_XINPUT )
if ( X11_Xinput_LIB )
list ( APPEND PLATFORM_LINKLIBS ${ X11_Xinput_LIB } )
else ( )
2019-07-31 14:15:38 +00:00
message ( FATAL_ERROR " LibXi not found. Disable WITH_X11_XINPUT if you
w a n t t o b u i l d w i t h o u t t a b l e t s u p p o r t " )
2019-04-17 04:35:54 +00:00
endif ( )
endif ( )
if ( WITH_X11_XF86VMODE )
# XXX, why doesn't cmake make this available?
find_library ( X11_Xxf86vmode_LIB Xxf86vm ${ X11_LIB_SEARCH_PATH } )
mark_as_advanced ( X11_Xxf86vmode_LIB )
if ( X11_Xxf86vmode_LIB )
list ( APPEND PLATFORM_LINKLIBS ${ X11_Xxf86vmode_LIB } )
else ( )
2019-07-31 14:15:38 +00:00
message ( FATAL_ERROR " libXxf86vm not found. Disable WITH_X11_XF86VMODE if you
w a n t t o b u i l d w i t h o u t " )
2019-04-17 04:35:54 +00:00
endif ( )
endif ( )
if ( WITH_X11_XFIXES )
if ( X11_Xfixes_LIB )
list ( APPEND PLATFORM_LINKLIBS ${ X11_Xfixes_LIB } )
else ( )
2019-07-31 14:15:38 +00:00
message ( FATAL_ERROR " libXfixes not found. Disable WITH_X11_XFIXES if you
w a n t t o b u i l d w i t h o u t " )
2019-04-17 04:35:54 +00:00
endif ( )
endif ( )
if ( WITH_X11_ALPHA )
find_library ( X11_Xrender_LIB Xrender ${ X11_LIB_SEARCH_PATH } )
mark_as_advanced ( X11_Xrender_LIB )
if ( X11_Xrender_LIB )
list ( APPEND PLATFORM_LINKLIBS ${ X11_Xrender_LIB } )
else ( )
2019-07-31 14:15:38 +00:00
message ( FATAL_ERROR " libXrender not found. Disable WITH_X11_ALPHA if you
w a n t t o b u i l d w i t h o u t " )
2019-04-17 04:35:54 +00:00
endif ( )
endif ( )
2016-06-09 19:07:58 +00:00
2014-10-07 20:46:19 +00:00
endif ( )
2015-07-28 07:47:21 +00:00
# ----------------------------------------------------------------------------
# Main Platform Checks
#
# - UNIX
# - WIN32
# - APPLE
2010-12-08 08:43:06 +00:00
if ( UNIX AND NOT APPLE )
2019-04-17 04:35:54 +00:00
include ( platform_unix )
2010-12-08 08:43:06 +00:00
elseif ( WIN32 )
2019-04-17 04:35:54 +00:00
include ( platform_win32 )
2010-12-08 08:43:06 +00:00
elseif ( APPLE )
2019-04-17 04:35:54 +00:00
include ( platform_apple )
2010-12-08 08:43:06 +00:00
endif ( )
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
# Common.
2010-08-11 08:23:48 +00:00
2012-12-05 15:46:31 +00:00
if ( NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM )
2019-04-17 04:35:54 +00:00
message ( FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON" )
2012-12-05 15:46:31 +00:00
endif ( )
2012-07-01 15:26:25 +00:00
if ( WITH_CYCLES )
2019-04-17 04:35:54 +00:00
if ( NOT WITH_OPENIMAGEIO )
message ( FATAL_ERROR
" C y c l e s r e q u i r e s W I T H _ O P E N I M A G E I O , t h e l i b r a r y m a y n o t h a v e b e e n f o u n d . "
" C o n f i g u r e O I I O o r d i s a b l e W I T H _ C Y C L E S "
)
endif ( )
if ( NOT WITH_BOOST )
message ( FATAL_ERROR
" C y c l e s r e q u i r e s W I T H _ B O O S T , t h e l i b r a r y m a y n o t h a v e b e e n f o u n d . "
" C o n f i g u r e B O O S T o r d i s a b l e W I T H _ C Y C L E S "
)
endif ( )
if ( WITH_CYCLES_OSL )
if ( NOT WITH_LLVM )
message ( FATAL_ERROR
" C y c l e s O S L r e q u i r e s W I T H _ L L V M , t h e l i b r a r y m a y n o t h a v e b e e n f o u n d . "
" C o n f i g u r e L L V M o r d i s a b l e W I T H _ C Y C L E S _ O S L "
)
endif ( )
endif ( )
2012-07-01 15:26:25 +00:00
endif ( )
2012-11-11 16:54:26 +00:00
if ( WITH_INTERNATIONAL )
2019-04-17 04:35:54 +00:00
if ( NOT WITH_BOOST )
message ( FATAL_ERROR
" I n t e r n a t i o n a l i z a t i o n r e q u i r e s W I T H _ B O O S T , t h e l i b r a r y m a y n o t h a v e b e e n f o u n d . "
" C o n f i g u r e B O O S T o r d i s a b l e W I T H _ I N T E R N A T I O N A L "
)
endif ( )
2012-11-11 16:54:26 +00:00
endif ( )
2012-07-01 15:26:25 +00:00
2011-08-01 06:11:41 +00:00
# See TEST_SSE_SUPPORT() for how this is defined.
2016-05-05 17:25:08 +00:00
# Do it globally, SSE2 is required for quite some time now.
# Doing it now allows to use SSE/SSE2 in inline headers.
if ( SUPPORT_SSE_BUILD )
2019-04-17 04:35:54 +00:00
set ( PLATFORM_CFLAGS " ${COMPILER_SSE_FLAG} ${PLATFORM_CFLAGS}" )
add_definitions ( -D__SSE__ -D__MMX__ )
2016-05-05 17:25:08 +00:00
endif ( )
if ( SUPPORT_SSE2_BUILD )
2019-04-17 04:35:54 +00:00
set ( PLATFORM_CFLAGS " ${PLATFORM_CFLAGS} ${COMPILER_SSE2_FLAG}" )
add_definitions ( -D__SSE2__ )
if ( NOT SUPPORT_SSE_BUILD ) # don't double up
add_definitions ( -D__MMX__ )
endif ( )
2010-12-08 08:43:06 +00:00
endif ( )
2011-09-19 08:02:17 +00:00
# set the endian define
2012-08-07 12:03:43 +00:00
if ( MSVC )
2019-04-17 04:35:54 +00:00
# for some reason this fails on msvc
add_definitions ( -D__LITTLE_ENDIAN__ )
2017-04-27 11:40:18 +00:00
2019-06-18 21:24:55 +00:00
# OSX-Note: as we do cross-compiling with specific set architecture,
# endianess-detection and auto-setting is counterproductive
# so we just set endianness according CMAKE_OSX_ARCHITECTURES
2012-08-07 13:51:19 +00:00
elseif ( CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64 )
2019-04-17 04:35:54 +00:00
add_definitions ( -D__LITTLE_ENDIAN__ )
2017-04-27 11:40:18 +00:00
elseif ( CMAKE_OSX_ARCHITECTURES MATCHES ppc OR CMAKE_OSX_ARCHITECTURES MATCHES ppc64 )
2019-04-17 04:35:54 +00:00
add_definitions ( -D__BIG_ENDIAN__ )
2017-04-27 11:40:18 +00:00
2011-09-27 01:32:27 +00:00
else ( )
2019-04-17 04:35:54 +00:00
include ( TestBigEndian )
test_big_endian ( _SYSTEM_BIG_ENDIAN )
if ( _SYSTEM_BIG_ENDIAN )
add_definitions ( -D__BIG_ENDIAN__ )
else ( )
add_definitions ( -D__LITTLE_ENDIAN__ )
endif ( )
unset ( _SYSTEM_BIG_ENDIAN )
2011-09-19 08:02:17 +00:00
endif ( )
2010-12-08 08:43:06 +00:00
if ( WITH_IMAGE_OPENJPEG )
2019-04-17 04:35:54 +00:00
# Special handling of Windows platform where openjpeg is always static.
if ( WIN32 )
set ( OPENJPEG_DEFINES "-DOPJ_STATIC" )
else ( )
set ( OPENJPEG_DEFINES "" )
endif ( )
2010-12-08 08:43:06 +00:00
endif ( )
2006-11-17 02:27:12 +00:00
2015-03-19 04:41:41 +00:00
if ( NOT WITH_SYSTEM_EIGEN3 )
2019-04-17 04:35:54 +00:00
set ( EIGEN3_INCLUDE_DIRS ${ CMAKE_SOURCE_DIR } /extern/Eigen3 )
2015-03-19 04:41:41 +00:00
endif ( )
2008-10-07 17:13:35 +00:00
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
# Configure OpenGL.
2014-10-07 20:46:19 +00:00
2010-12-08 08:43:06 +00:00
find_package ( OpenGL )
2011-06-08 05:39:58 +00:00
blender_include_dirs_sys ( "${OPENGL_INCLUDE_DIR}" )
2014-10-07 20:46:19 +00:00
2018-06-16 02:17:16 +00:00
if ( WITH_OPENGL )
2019-04-17 04:35:54 +00:00
add_definitions ( -DWITH_OPENGL )
2018-06-16 02:17:16 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
if ( WITH_SYSTEM_GLES )
2019-04-17 04:35:54 +00:00
find_package_wrapper ( OpenGLES )
2014-10-07 20:46:19 +00:00
endif ( )
2017-05-11 14:38:05 +00:00
if ( WITH_GL_PROFILE_ES20 )
2019-04-17 04:35:54 +00:00
if ( WITH_SYSTEM_GLES )
if ( NOT OPENGLES_LIBRARY )
message ( FATAL_ERROR
" U n a b l e t o f i n d O p e n G L E S l i b r a r i e s . "
" I n s t a l l t h e m o r d i s a b l e W I T H _ S Y S T E M _ G L E S . "
)
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
list ( APPEND BLENDER_GL_LIBRARIES OPENGLES_LIBRARY )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
else ( )
set ( OPENGLES_LIBRARY "" CACHE FILEPATH "OpenGL ES 2.0 library file" )
mark_as_advanced ( OPENGLES_LIBRARY )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
list ( APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}" )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( NOT OPENGLES_LIBRARY )
message ( FATAL_ERROR
" T o c o m p i l e W I T H _ G L _ E G L y o u n e e d t o s e t O P E N G L E S _ L I B R A R Y "
" t o t h e f i l e p a t h o f a n O p e n G L E S 2 . 0 l i b r a r y . "
)
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( WIN32 )
# Setup paths to files needed to install and redistribute Windows Blender with OpenGL ES
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
set ( OPENGLES_DLL "" CACHE FILEPATH "OpenGL ES 2.0 redistributable DLL file" )
mark_as_advanced ( OPENGLES_DLL )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( NOT OPENGLES_DLL )
message ( FATAL_ERROR
" T o c o m p i l e W I T H _ G L _ P R O F I L E _ E S 2 0 y o u n e e d t o s e t O P E N G L E S _ D L L t o t h e f i l e "
" p a t h o f a n O p e n G L E S 2 . 0 r u n t i m e d y n a m i c l i n k library ( DLL ) . "
)
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( WITH_GL_ANGLE )
list ( APPEND GL_DEFINITIONS -DWITH_ANGLE )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
set ( D3DCOMPILER_DLL "" CACHE FILEPATH "Direct3D Compiler redistributable DLL file (needed by ANGLE)" )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
get_filename_component ( D3DCOMPILER_FILENAME "${D3DCOMPILER_DLL}" NAME )
list ( APPEND GL_DEFINITIONS "-DD3DCOMPILER=\" \\\"${D3DCOMPILER_FILENAME}\\\"\"")
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
mark_as_advanced ( D3DCOMPILER_DLL )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( D3DCOMPILER_DLL STREQUAL "" )
message ( FATAL_ERROR
" T o c o m p i l e W I T H _ G L _ A N G L E y o u n e e d t o s e t D 3 D C O M P I L E R _ D L L t o t h e f i l e "
" p a t h o f a c o p y o f t h e D i r e c t X r e d i s t r i b u t a b l e D L L f i l e : D 3 D C o m p i l e r _ 4 6 . d l l "
)
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
2017-05-11 14:38:05 +00:00
else ( )
2019-04-17 04:35:54 +00:00
if ( OpenGL_GL_PREFERENCE STREQUAL "LEGACY" AND OPENGL_gl_LIBRARY )
list ( APPEND BLENDER_GL_LIBRARIES ${ OPENGL_gl_LIBRARY } )
else ( )
list ( APPEND BLENDER_GL_LIBRARIES ${ OPENGL_opengl_LIBRARY } ${ OPENGL_glx_LIBRARY } )
endif ( )
2014-10-07 20:46:19 +00:00
endif ( )
if ( WITH_GL_EGL )
2019-04-17 04:35:54 +00:00
list ( APPEND GL_DEFINITIONS -DWITH_GL_EGL )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( WITH_SYSTEM_GLES )
if ( NOT OPENGLES_EGL_LIBRARY )
message ( FATAL_ERROR
" U n a b l e t o f i n d O p e n G L E S l i b r a r i e s . "
" I n s t a l l t h e m o r d i s a b l e W I T H _ S Y S T E M _ G L E S . "
)
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
list ( APPEND BLENDER_GL_LIBRARIES OPENGLES_EGL_LIBRARY )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
else ( )
set ( OPENGLES_EGL_LIBRARY "" CACHE FILEPATH "EGL library file" )
mark_as_advanced ( OPENGLES_EGL_LIBRARY )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
list ( APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}" "${OPENGLES_EGL_LIBRARY}" )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( NOT OPENGLES_EGL_LIBRARY )
message ( FATAL_ERROR
" T o c o m p i l e W I T H _ G L _ E G L y o u n e e d t o s e t O P E N G L E S _ E G L _ L I B R A R Y "
" t o t h e f i l e p a t h o f a n E G L l i b r a r y . "
)
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( WIN32 )
# Setup paths to files needed to install and redistribute Windows Blender with OpenGL ES
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
set ( OPENGLES_EGL_DLL "" CACHE FILEPATH "EGL redistributable DLL file" )
mark_as_advanced ( OPENGLES_EGL_DLL )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( NOT OPENGLES_EGL_DLL )
message ( FATAL_ERROR
" T o c o m p i l e W I T H _ G L _ E G L y o u n e e d t o s e t O P E N G L E S _ E G L _ D L L "
" t o t h e f i l e p a t h o f a n E G L r u n t i m e d y n a m i c l i n k library ( DLL ) . "
)
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
endif ( )
if ( WITH_GL_PROFILE_ES20 )
2019-04-17 04:35:54 +00:00
list ( APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_ES20 )
2017-05-11 14:38:05 +00:00
else ( )
2019-04-17 04:35:54 +00:00
list ( APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE )
2014-10-07 20:46:19 +00:00
endif ( )
if ( WITH_GL_EGL )
2019-04-17 04:35:54 +00:00
list ( APPEND GL_DEFINITIONS -DWITH_EGL )
2014-10-07 20:46:19 +00:00
endif ( )
2009-10-19 16:20:12 +00:00
2010-11-19 11:33:12 +00:00
#-----------------------------------------------------------------------------
# Configure OpenMP.
2014-07-07 22:29:53 +00:00
if ( WITH_OPENMP )
2019-04-17 04:35:54 +00:00
if ( NOT OPENMP_CUSTOM )
find_package ( OpenMP )
endif ( )
if ( OPENMP_FOUND )
if ( NOT WITH_OPENMP_STATIC )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
else ( )
# Typically avoid adding flags as defines but we can't
# pass OpenMP flags to the linker for static builds, meaning
# we can't add any OpenMP related flags to CFLAGS variables
# since they're passed to the linker as well.
add_definitions ( "${OpenMP_C_FLAGS}" )
find_library_static ( OpenMP_LIBRARIES gomp ${ CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES } )
endif ( )
else ( )
set ( WITH_OPENMP OFF )
endif ( )
mark_as_advanced (
O p e n M P _ C _ F L A G S
O p e n M P _ C X X _ F L A G S
)
2011-09-30 15:51:58 +00:00
endif ( )
2010-11-19 11:33:12 +00:00
2011-04-05 23:31:01 +00:00
#-----------------------------------------------------------------------------
# Configure GLEW
2012-06-23 13:42:14 +00:00
if ( WITH_SYSTEM_GLEW )
2019-04-17 04:35:54 +00:00
find_package ( GLEW )
2011-04-05 23:31:01 +00:00
2019-04-17 04:35:54 +00:00
# Note: There is an assumption here that the system GLEW is not a static library.
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( NOT GLEW_FOUND )
message ( FATAL_ERROR "GLEW is required to build Blender. Install it or disable WITH_SYSTEM_GLEW." )
endif ( )
2011-04-05 23:31:01 +00:00
2019-04-17 04:35:54 +00:00
set ( BLENDER_GLEW_LIBRARIES ${ GLEW_LIBRARY } )
2012-06-23 13:42:14 +00:00
else ( )
2019-04-17 04:35:54 +00:00
if ( WITH_GLEW_ES )
set ( GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include" )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
list ( APPEND GL_DEFINITIONS -DGLEW_STATIC -DWITH_GLEW_ES )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
# These definitions remove APIs from glew.h, making GLEW smaller, and catching unguarded API usage
if ( WITH_GL_PROFILE_ES20 )
list ( APPEND GL_DEFINITIONS -DGLEW_ES_ONLY )
else ( )
# No ES functions are needed
list ( APPEND GL_DEFINITIONS -DGLEW_NO_ES )
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( WITH_GL_PROFILE_ES20 )
if ( WITH_GL_EGL )
list ( APPEND GL_DEFINITIONS -DGLEW_USE_LIB_ES20 )
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
# ToDo: This is an experiment to eliminate ES 1 symbols,
# GLEW doesn't really properly provide this level of control
# (for example, without modification it eliminates too many symbols)
# so there are lots of modifications to GLEW to make this work,
# and no attempt to make it work beyond Blender at this point.
list ( APPEND GL_DEFINITIONS -DGL_ES_VERSION_1_0=0 -DGL_ES_VERSION_CL_1_1=0 -DGL_ES_VERSION_CM_1_1=0 )
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
if ( WITH_GL_EGL )
list ( APPEND GL_DEFINITIONS -DGLEW_INC_EGL )
endif ( )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
set ( BLENDER_GLEW_LIBRARIES extern_glew_es bf_intern_glew_mx )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
else ( )
set ( GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include" )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
list ( APPEND GL_DEFINITIONS -DGLEW_STATIC )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
# This won't affect the non-experimental glew library,
# but is used for conditional compilation elsewhere.
list ( APPEND GL_DEFINITIONS -DGLEW_NO_ES )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
set ( BLENDER_GLEW_LIBRARIES extern_glew )
2014-10-07 20:46:19 +00:00
2019-04-17 04:35:54 +00:00
endif ( )
2014-10-07 20:46:19 +00:00
2011-04-05 23:31:01 +00:00
endif ( )
2017-03-23 01:33:19 +00:00
list ( APPEND GL_DEFINITIONS -DGLEW_NO_GLU )
2013-01-03 00:23:52 +00:00
#-----------------------------------------------------------------------------
# Configure Bullet
if ( WITH_BULLET AND WITH_SYSTEM_BULLET )
2019-04-17 04:35:54 +00:00
find_package ( Bullet )
if ( NOT BULLET_FOUND )
set ( WITH_BULLET OFF )
endif ( )
2013-01-03 00:23:52 +00:00
else ( )
2019-04-17 04:35:54 +00:00
set ( BULLET_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/bullet2/src" )
# set(BULLET_LIBRARIES "")
2013-01-03 00:23:52 +00:00
endif ( )
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
2011-03-24 00:14:49 +00:00
# Configure Python.
if ( WITH_PYTHON_MODULE )
2019-04-17 04:35:54 +00:00
add_definitions ( -DPy_ENABLE_SHARED )
2011-09-30 15:51:58 +00:00
endif ( )
2011-03-24 00:14:49 +00:00
2016-01-04 11:47:36 +00:00
#-----------------------------------------------------------------------------
# Configure GLog/GFlags
if ( WITH_LIBMV OR WITH_GTESTS OR ( WITH_CYCLES AND WITH_CYCLES_LOGGING ) )
2019-04-17 04:35:54 +00:00
if ( WITH_SYSTEM_GFLAGS )
find_package ( Gflags )
if ( NOT GFLAGS_FOUND )
message ( FATAL_ERROR "System wide Gflags is requested but was not found" )
endif ( )
# FindGflags does not define this, and we are not even sure what to use here.
set ( GFLAGS_DEFINES )
else ( )
set ( GFLAGS_DEFINES
- D G F L A G S _ D L L _ D E F I N E _ F L A G =
- D G F L A G S _ D L L _ D E C L A R E _ F L A G =
- D G F L A G S _ D L L _ D E C L =
)
set ( GFLAGS_NAMESPACE "gflags" )
set ( GFLAGS_LIBRARIES extern_gflags )
set ( GFLAGS_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/extern/gflags/src" )
endif ( )
if ( WITH_SYSTEM_GLOG )
find_package ( Glog )
if ( NOT GLOG_FOUND )
message ( FATAL_ERROR "System wide Glog is requested but was not found" )
endif ( )
# FindGlog does not define this, and we are not even sure what to use here.
set ( GLOG_DEFINES )
else ( )
set ( GLOG_DEFINES
- D G O O G L E _ G L O G _ D L L _ D E C L =
)
set ( GLOG_LIBRARIES extern_glog )
if ( WIN32 )
set ( GLOG_INCLUDE_DIRS ${ CMAKE_SOURCE_DIR } /extern/glog/src/windows )
else ( )
set ( GLOG_INCLUDE_DIRS ${ CMAKE_SOURCE_DIR } /extern/glog/include )
endif ( )
endif ( )
2016-01-04 11:47:36 +00:00
endif ( )
2016-01-04 13:11:12 +00:00
#-----------------------------------------------------------------------------
# Configure Ceres
if ( WITH_LIBMV )
2019-04-17 04:35:54 +00:00
# We always have C++11 which includes unordered_map.
set ( CERES_DEFINES -DCERES_STD_UNORDERED_MAP )
2016-01-04 13:11:12 +00:00
endif ( )
CMake: Add support of Ninja's pools to ease building on limited amount of RAM.
Many modern computers support a lot of threads (parrallel building
jobs), but are somewhat restricted in memory, when some building jobs
can require several GB each.
Ninja builder has pools, which extend the usual `-j X` make
parallelizing option, by allowing to specify different numbers of
parallel jobs for different targets.
This commit defines three pools, one for linking, one for usual compile,
and one for compiling some 'heavy' cpp libs, when a single file can
require GB of RAM in full debug builds.
Simply enabling WITH_NINJA_POOL_JOBS will try to set default sensible
values for those three pools based on your machine specifications, you
can then tweak further the values of NINJA_MAX_NUM_PARALLEL_ settings,
if you like.
On my system (8 cores, 16GB RAM), it allows to build a full debug with
all ASAN options build with roughly 7GB of RAM used at most, pretty much
as quickly as without that option (which would require up to 11GB of
available RAM at some points).
Review task: D4780.
2019-05-07 18:32:14 +00:00
#-----------------------------------------------------------------------------
# Extra limits to number of jobs running in parallel for some kind os tasks.
# Only supported by Ninja build system currently.
if ( "${CMAKE_GENERATOR}" MATCHES "Ninja" AND WITH_NINJA_POOL_JOBS )
if ( NOT NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS AND
N O T N I N J A _ M A X _ N U M _ P A R A L L E L _ C O M P I L E _ H E A V Y _ J O B S A N D
N O T N I N J A _ M A X _ N U M _ P A R A L L E L _ L I N K _ J O B S )
# Try to define good default values.
# Max mem of heavy cpp files compilation: about 2.5GB
# Max mem during linking: about 3.3GB
cmake_host_system_information ( RESULT _NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES )
# Note: this gives mem in MB.
cmake_host_system_information ( RESULT _TOT_MEM QUERY TOTAL_PHYSICAL_MEMORY )
# Heuristics... the more cores we have, the more free mem we have to keep for the non-heavy tasks too.
if ( ${ _TOT_MEM } LESS 8000 AND ${ _NUM_CORES } GREATER 2 )
set ( _compile_heavy_jobs "1" )
elseif ( ${ _TOT_MEM } LESS 16000 AND ${ _NUM_CORES } GREATER 4 )
set ( _compile_heavy_jobs "2" )
elseif ( ${ _TOT_MEM } LESS 24000 AND ${ _NUM_CORES } GREATER 8 )
set ( _compile_heavy_jobs "3" )
elseif ( ${ _TOT_MEM } LESS 32000 AND ${ _NUM_CORES } GREATER 16 )
set ( _compile_heavy_jobs "4" )
elseif ( ${ _TOT_MEM } LESS 64000 AND ${ _NUM_CORES } GREATER 32 )
set ( _compile_heavy_jobs "8" )
else ( )
set ( _compile_heavy_jobs "" )
endif ( )
set ( NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS "${_compile_heavy_jobs}" CACHE STRING
" D e f i n e t h e m a x i m u m n u m b e r o f c o n c u r r e n t h e a v y c o m p i l a t i o n j o b s , f o r n i n j a b u i l d system ( used for some targets which cpp files can take several GB each during compilation ) . " F O R C E )
mark_as_advanced ( NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS )
set ( _compile_heavy_jobs )
# Only set regular compile jobs if we set heavy jobs, otherwise default (using all cores) if fine.
if ( NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS )
math ( EXPR _compile_jobs "${_NUM_CORES} - 1" )
else ( )
set ( _compile_jobs "" )
endif ( )
set ( NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS "${_compile_jobs}" CACHE STRING
" D e f i n e t h e m a x i m u m n u m b e r o f c o n c u r r e n t c o m p i l a t i o n j o b s , f o r n i n j a b u i l d s y s t e m . " F O R C E )
mark_as_advanced ( NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS )
set ( _compile_jobs )
# In practice, even when there is RAM available, this proves to be quicker than running in parallel
# (due to slow disks accesses).
set ( NINJA_MAX_NUM_PARALLEL_LINK_JOBS "1" CACHE STRING
" D e f i n e t h e m a x i m u m n u m b e r o f c o n c u r r e n t l i n k j o b s , f o r n i n j a b u i l d s y s t e m . " F O R C E )
mark_as_advanced ( NINJA_MAX_NUM_PARALLEL_LINK_JOBS )
set ( _NUM_CORES )
set ( _TOT_MEM )
endif ( )
if ( NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS )
set_property ( GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool= ${ NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS } )
set ( CMAKE_JOB_POOL_COMPILE compile_job_pool )
endif ( )
if ( NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS )
set_property ( GLOBAL APPEND PROPERTY JOB_POOLS compile_heavy_job_pool= ${ NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS } )
endif ( )
if ( NINJA_MAX_NUM_PARALLEL_LINK_JOBS )
set_property ( GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool= ${ NINJA_MAX_NUM_PARALLEL_LINK_JOBS } )
set ( CMAKE_JOB_POOL_LINK link_job_pool )
endif ( )
endif ( )
2011-03-24 00:14:49 +00:00
#-----------------------------------------------------------------------------
2006-11-17 02:27:12 +00:00
# Extra compile flags
2010-10-18 12:35:40 +00:00
2010-12-08 08:43:06 +00:00
if ( CMAKE_COMPILER_IS_GNUCC )
2010-12-16 09:55:35 +00:00
2019-04-17 04:35:54 +00:00
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ALL -Wall )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_CAST_ALIGN -Wcast-align )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ERROR_VLA -Werror=vla )
# system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_UNDEF -Wundef )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_INIT_SELF -Winit-self ) # needs -Wuninitialized
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_FORMAT_SIGN -Wformat-signedness )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_RESTRICT -Wrestrict )
2019-10-07 01:20:49 +00:00
# C-only.
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_NULL -Wnonnull )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ABSOLUTE_VALUE -Wabsolute-value )
2019-04-17 04:35:54 +00:00
# gcc 4.2 gives annoying warnings on every file with this
if ( NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3" )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized )
endif ( )
# versions before gcc4.6 give many BLI_math warnings
if ( NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.6" )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_REDUNDANT_DECLS -Wredundant-decls )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls )
endif ( )
# versions before gcc4.8 include global name-space.
if ( NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.8" )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_SHADOW -Wshadow )
endif ( )
# disable because it gives warnings for printf() & friends.
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
if ( NOT APPLE )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable )
endif ( )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_ALL -Wall )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self ) # needs -Wuninitialized
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_ERROR_RETURN_TYPE -Werror=return-type )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_POINTER_ARITH -Wpointer-arith )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_UNUSED_PARAMETER -Wunused-parameter )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_UNDEF -Wundef )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_FORMAT_SIGN -Wformat-signedness )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_RESTRICT -Wrestrict )
# gcc 4.2 gives annoying warnings on every file with this
if ( NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3" )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized )
endif ( )
# causes too many warnings
if ( NOT APPLE )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_UNDEF -Wundef )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations )
endif ( )
# Use 'ATTR_FALLTHROUGH' macro to suppress.
if ( CMAKE_COMPILER_IS_GNUCC AND ( NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0" ) )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5 )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5 )
endif ( )
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS -Wno-type-limits )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT -Wno-format )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH -Wno-switch )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs )
if ( CMAKE_COMPILER_IS_GNUCC AND ( NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0" ) )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough )
endif ( )
if ( NOT APPLE )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable )
endif ( )
2011-10-30 04:48:00 +00:00
2013-12-02 00:36:33 +00:00
elseif ( CMAKE_C_COMPILER_ID MATCHES "Clang" )
2012-06-11 12:13:41 +00:00
2019-04-17 04:35:54 +00:00
# strange, clang complains these are not supported, but then uses them.
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ALL -Wall )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_ALL -Wall )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts )
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.
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof )
# gives too many unfixable warnings
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS -Wunused-macros)
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef )
ADD_CHECK_C_COMPILER_FLAG ( C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs )
2013-07-15 08:26:16 +00:00
2010-12-16 09:55:35 +00:00
elseif ( CMAKE_C_COMPILER_ID MATCHES "Intel" )
2019-04-17 04:35:54 +00:00
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_ALL -Wall )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith )
ADD_CHECK_C_COMPILER_FLAG ( C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas )
2010-12-16 09:55:35 +00:00
2019-04-17 04:35:54 +00:00
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_ALL -Wall )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof )
ADD_CHECK_CXX_COMPILER_FLAG ( CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare )
2010-12-16 09:55:35 +00:00
2019-04-17 04:35:54 +00:00
# disable numbered, false positives
set ( C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199" )
set ( CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199" )
2014-11-08 20:17:04 +00:00
elseif ( CMAKE_C_COMPILER_ID MATCHES "MSVC" )
2019-04-17 04:35:54 +00:00
# most msvc warnings are C & C++
set ( _WARNINGS
# warning level:
" / W 3 "
" / w 3 4 0 6 2 " # switch statement contains 'default' but no 'case' labels
" / w 3 4 1 1 5 " # 'type' : named type definition in parentheses
" / w 3 4 1 8 9 " # local variable is initialized but not referenced
# disable:
" / w d 4 0 1 8 " # signed/unsigned mismatch
" / w d 4 1 4 6 " # unary minus operator applied to unsigned type, result still unsigned
" / w d 4 0 6 5 " # switch statement contains 'default' but no 'case' labels
" / w d 4 1 2 7 " # conditional expression is constant
" / w d 4 1 8 1 " # qualifier applied to reference type; ignored
" / w d 4 2 0 0 " # zero-sized array in struct/union
" / w d 4 2 4 4 " # conversion from 'type1' to 'type2', possible loss of data
" / w d 4 2 6 7 " # conversion from 'size_t' to 'type', possible loss of data
" / w d 4 3 0 5 " # truncation from 'type1' to 'type2'
" / w d 4 8 0 0 " # forcing value to bool 'true' or 'false'
" / w d 4 8 2 8 " # The file contains a character that is illegal
" / w d 4 9 9 6 " # identifier was declared deprecated
2019-05-26 22:13:31 +00:00
" / w d 4 6 6 1 " # no suitable definition provided for explicit template instantiation request
2019-04-17 04:35:54 +00:00
# errors:
" / w e 4 0 1 3 " # 'function' undefined; assuming extern returning int
" / w e 4 1 3 3 " # incompatible pointer types
" / w e 4 4 3 1 " # missing type specifier - int assumed
)
if ( MSVC_VERSION GREATER_EQUAL 1911 )
# see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017
set ( _WARNINGS "${_WARNINGS} /w35038" ) #order of initialisation in c++ constructors
endif ( )
string ( REPLACE ";" " " _WARNINGS "${_WARNINGS}" )
set ( C_WARNINGS "${_WARNINGS}" )
set ( CXX_WARNINGS "${_WARNINGS}" )
unset ( _WARNINGS )
2010-12-08 08:43:06 +00:00
endif ( )
2010-10-17 06:38:56 +00:00
2011-07-16 06:55:45 +00:00
# ensure python header is found since detection can fail, this could happen
# with _any_ library but since we used a fixed python version this tends to
# be most problematic.
if ( WITH_PYTHON )
2019-04-17 04:35:54 +00:00
if ( NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h" )
message ( FATAL_ERROR
" M i s s i n g : \ " $ { P Y T H O N _ I N C L U D E _ D I R } / P y t h o n . h \ " , \ n "
" S e t t h e c a c h e e n t r y ' P Y T H O N _ I N C L U D E _ D I R ' t o p o i n t "
" t o a v a l i d p y t h o n i n c l u d e p a t h . C o n t a i n i n g "
" P y t h o n . h f o r p y t h o n v e r s i o n \ " $ { P Y T H O N _ V E R S I O N } \ " "
)
endif ( )
if ( WIN32 OR APPLE )
# Windows and macOS have this bundled with Python libraries.
elseif ( ( WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY ) OR ( WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE ) )
if ( ( "${PYTHON_NUMPY_PATH}" STREQUAL "" ) OR ( ${ PYTHON_NUMPY_PATH } MATCHES NOTFOUND ) )
find_python_package ( numpy )
unset ( PYTHON_NUMPY_INCLUDE_DIRS CACHE )
set ( PYTHON_NUMPY_INCLUDE_DIRS ${ PYTHON_NUMPY_PATH } /numpy/core/include CACHE PATH "Path to the include directory of the numpy module" )
mark_as_advanced ( PYTHON_NUMPY_INCLUDE_DIRS )
endif ( )
endif ( )
if ( WIN32 OR APPLE )
# pass, we have this in lib/python/site-packages
elseif ( WITH_PYTHON_INSTALL_REQUESTS )
find_python_package ( requests )
endif ( )
2011-07-16 06:55:45 +00:00
endif ( )
2019-10-01 18:36:11 +00:00
if ( MSVC )
# MSVC needs to be tested first, since clang on windows will
# match the compiler test below but clang-cl does not accept -std=c++11
# since it is on by default and cannot be turned off.
#
# Nothing special is needed, C++11 features are available by default.
elseif (
2019-04-17 04:35:54 +00:00
C M A K E _ C O M P I L E R _ I S _ G N U C C O R
C M A K E _ C _ C O M P I L E R _ I D M A T C H E S " C l a n g " O R
C M A K E _ C _ C O M P I L E R _ I D M A T C H E S " I n t e l "
2018-07-25 14:59:46 +00:00
)
2019-04-17 04:35:54 +00:00
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
2016-05-22 11:41:55 +00:00
else ( )
2019-04-17 04:35:54 +00:00
message ( FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build" )
2015-02-09 17:23:21 +00:00
endif ( )
2015-11-22 21:31:29 +00:00
# Visual Studio has all standards it supports available by default
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 20:34:47 +00:00
# Clang on windows copies this behavior and does not support these switches
if (
2019-04-17 04:35:54 +00:00
C M A K E _ C O M P I L E R _ I S _ G N U C C O R
( C M A K E _ C _ C O M P I L E R _ I D M A T C H E S " C l a n g " AND ( NOT MSVC ) ) O R
( C M A K E _ C _ C O M P I L E R _ I D M A T C H E S " I n t e l " )
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 20:34:47 +00:00
)
2019-04-17 04:35:54 +00:00
# Use C11 + GNU extensions, works with GCC, Clang, ICC
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11" )
2015-11-22 16:12:54 +00:00
endif ( )
2012-10-20 13:08:51 +00:00
# Include warnings first, so its possible to disable them with user defined flags
# eg: -Wno-uninitialized
set ( CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}" )
set ( CMAKE_CXX_FLAGS "${CXX_WARNINGS} ${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS}" )
2009-10-19 16:20:12 +00:00
2017-04-27 11:40:18 +00:00
# defined above, platform specific but shared names
2013-08-28 04:32:39 +00:00
mark_as_advanced (
2019-04-17 04:35:54 +00:00
C Y C L E S _ O S L
O S L _ L I B _ E X E C
O S L _ C O M P I L E R
O S L _ L I B _ C O M P
O S L _ L I B _ Q U E R Y
O S L _ I N C L U D E _ D I R
2013-08-28 04:32:39 +00:00
)
mark_as_advanced (
2019-04-17 04:35:54 +00:00
L L V M _ C O N F I G
L L V M _ R O O T _ D I R
L L V M _ L I B R A R Y
L L V M _ V E R S I O N
2013-08-28 04:32:39 +00:00
)
2011-02-20 23:39:29 +00:00
#-------------------------------------------------------------------------------
# Global Defines
2011-05-24 06:44:39 +00:00
# better not set includes here but this debugging option is off by default.
2010-12-08 08:43:06 +00:00
if ( WITH_CXX_GUARDEDALLOC )
2019-04-17 04:35:54 +00:00
include_directories ( ${ CMAKE_SOURCE_DIR } /intern/guardedalloc )
add_definitions ( -DWITH_CXX_GUARDEDALLOC )
2010-12-08 08:43:06 +00:00
endif ( )
2006-11-17 02:27:12 +00:00
2010-12-15 10:22:26 +00:00
if ( WITH_ASSERT_ABORT )
2019-04-17 04:35:54 +00:00
add_definitions ( -DWITH_ASSERT_ABORT )
2010-12-15 10:22:26 +00:00
endif ( )
2010-12-16 12:48:30 +00:00
# message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
# message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
# Libraries
2010-12-06 10:56:37 +00:00
2014-06-18 16:28:27 +00:00
if ( WITH_GTESTS )
2019-04-17 04:35:54 +00:00
include ( GTestTesting )
2014-06-18 12:49:17 +00:00
endif ( )
2018-04-16 13:54:36 +00:00
if ( WITH_BLENDER )
2019-04-17 04:35:54 +00:00
add_subdirectory ( intern )
add_subdirectory ( extern )
2014-06-18 12:49:17 +00:00
2019-04-17 04:35:54 +00:00
# source after intern and extern to gather all
# internal and external library information first, for test linking
add_subdirectory ( source )
2014-01-20 19:41:54 +00:00
elseif ( WITH_CYCLES_STANDALONE )
2019-04-17 04:35:54 +00:00
add_subdirectory ( intern/cycles )
add_subdirectory ( extern/clew )
if ( WITH_CUDA_DYNLOAD )
add_subdirectory ( extern/cuew )
endif ( )
if ( NOT WITH_SYSTEM_GLEW )
add_subdirectory ( extern/glew )
endif ( )
2014-01-20 19:41:54 +00:00
endif ( )
2006-11-17 02:27:12 +00:00
#-----------------------------------------------------------------------------
# Blender Application
2011-07-13 08:15:06 +00:00
if ( WITH_BLENDER )
2019-04-17 04:35:54 +00:00
add_subdirectory ( source/creator )
2011-07-13 08:15:06 +00:00
endif ( )
2006-11-17 02:27:12 +00:00
2008-09-09 21:15:30 +00:00
2014-06-18 11:44:40 +00:00
#-----------------------------------------------------------------------------
# Testing
add_subdirectory ( tests )
CMake: Add support of Ninja's pools to ease building on limited amount of RAM.
Many modern computers support a lot of threads (parrallel building
jobs), but are somewhat restricted in memory, when some building jobs
can require several GB each.
Ninja builder has pools, which extend the usual `-j X` make
parallelizing option, by allowing to specify different numbers of
parallel jobs for different targets.
This commit defines three pools, one for linking, one for usual compile,
and one for compiling some 'heavy' cpp libs, when a single file can
require GB of RAM in full debug builds.
Simply enabling WITH_NINJA_POOL_JOBS will try to set default sensible
values for those three pools based on your machine specifications, you
can then tweak further the values of NINJA_MAX_NUM_PARALLEL_ settings,
if you like.
On my system (8 cores, 16GB RAM), it allows to build a full debug with
all ASAN options build with roughly 7GB of RAM used at most, pretty much
as quickly as without that option (which would require up to 11GB of
available RAM at some points).
Review task: D4780.
2019-05-07 18:32:14 +00:00
#-----------------------------------------------------------------------------
# Define 'heavy' submodules (for Ninja builder when using pools).
setup_heavy_lib_pool ( )
2011-02-15 18:33:05 +00:00
#-----------------------------------------------------------------------------
# CPack for generating packages
include ( build_files/cmake/packaging.cmake )
2011-06-19 13:49:20 +00:00
2016-07-18 13:16:45 +00:00
#-----------------------------------------------------------------------------
# Use dynamic loading for OpenMP
if ( WITH_BLENDER )
2019-04-17 04:35:54 +00:00
openmp_delayload ( blender )
2017-10-30 01:58:44 +00:00
endif ( )
2011-06-19 13:49:20 +00:00
#-----------------------------------------------------------------------------
# Print Final Configuration
if ( FIRST_RUN )
2015-06-16 23:16:17 +00:00
2019-04-17 04:35:54 +00:00
set ( _config_msg "\nBlender Configuration\n=====================" )
function ( info_cfg_option
_ s e t t i n g
)
set ( _msg " - ${_setting}" )
string ( LENGTH "${_msg}" _len )
while ( "32" GREATER "${_len}" )
set ( _msg "${_msg} " )
math ( EXPR _len "${_len} + 1" )
endwhile ( )
set ( _config_msg "${_config_msg}\n${_msg}${${_setting}}" PARENT_SCOPE )
endfunction ( )
function ( info_cfg_text
_ t e x t
)
set ( _config_msg "${_config_msg}\n\n ${_text}" PARENT_SCOPE )
endfunction ( )
message ( STATUS "C Compiler: \" ${ CMAKE_C_COMPILER_ID } \"")
message ( STATUS "C++ Compiler: \" ${ CMAKE_CXX_COMPILER_ID } \"")
info_cfg_text ( "Build Options:" )
info_cfg_option ( WITH_BULLET )
info_cfg_option ( WITH_IK_SOLVER )
info_cfg_option ( WITH_IK_ITASC )
info_cfg_option ( WITH_OPENCOLLADA )
info_cfg_option ( WITH_FFTW3 )
info_cfg_option ( WITH_INTERNATIONAL )
info_cfg_option ( WITH_INPUT_NDOF )
info_cfg_option ( WITH_CYCLES )
info_cfg_option ( WITH_FREESTYLE )
info_cfg_option ( WITH_OPENCOLORIO )
Compositor: Added denoising node
This node is built on Intel's OpenImageDenoise library.
Other denoisers could be integrated, for example Lukas' Cycles denoiser.
Compositor: Made OpenImageDenoise optional, added CMake and build_env files to find OIDN
Compositor: Fixed some warnings in the denoising operator
build_environment: Updated OpenImageDenoise to 0.8.1
build_environment: Updated OpenImageDenoise in `make deps` for macOS
Reviewers: sergey, jbakker, brecht
Reviewed By: brecht
Subscribers: YAFU, LazyDodo, Zen_YS, slumber, samgreen, tjvoll, yeus, ponomarovmax, getrad, coder.kalyan, vitos1k, Yegor, DeepBlender, kumaran7, Darkfie9825, aliasguru, aafra, ace_dragon, juang3d, pandrodor, cdog, lordodin, jtheninja, mavek, marcog, 5k1n2, Atair, rawalanche, 0o00o0oo, filibis, poor, lukasstockner97
Tags: #compositing
Differential Revision: https://developer.blender.org/D4304
2019-08-14 13:30:26 +00:00
info_cfg_option ( WITH_OPENIMAGEDENOISE )
2019-04-17 04:35:54 +00:00
info_cfg_option ( WITH_OPENVDB )
info_cfg_option ( WITH_ALEMBIC )
2019-08-26 16:34:11 +00:00
info_cfg_option ( WITH_QUADRIFLOW )
2019-04-17 04:35:54 +00:00
info_cfg_text ( "Compiler Options:" )
info_cfg_option ( WITH_BUILDINFO )
info_cfg_option ( WITH_OPENMP )
info_cfg_option ( WITH_RAYOPTIMIZATION )
info_cfg_text ( "System Options:" )
info_cfg_option ( WITH_INSTALL_PORTABLE )
info_cfg_option ( WITH_X11_ALPHA )
info_cfg_option ( WITH_X11_XF86VMODE )
info_cfg_option ( WITH_X11_XFIXES )
info_cfg_option ( WITH_X11_XINPUT )
info_cfg_option ( WITH_MEM_JEMALLOC )
info_cfg_option ( WITH_MEM_VALGRIND )
info_cfg_option ( WITH_SYSTEM_GLEW )
info_cfg_text ( "Image Formats:" )
info_cfg_option ( WITH_OPENIMAGEIO )
info_cfg_option ( WITH_IMAGE_CINEON )
info_cfg_option ( WITH_IMAGE_DDS )
info_cfg_option ( WITH_IMAGE_HDR )
info_cfg_option ( WITH_IMAGE_OPENEXR )
info_cfg_option ( WITH_IMAGE_OPENJPEG )
info_cfg_option ( WITH_IMAGE_TIFF )
info_cfg_text ( "Audio:" )
info_cfg_option ( WITH_OPENAL )
info_cfg_option ( WITH_SDL )
info_cfg_option ( WITH_SDL_DYNLOAD )
info_cfg_option ( WITH_JACK )
info_cfg_option ( WITH_JACK_DYNLOAD )
info_cfg_option ( WITH_CODEC_AVI )
info_cfg_option ( WITH_CODEC_FFMPEG )
info_cfg_option ( WITH_CODEC_SNDFILE )
info_cfg_text ( "Compression:" )
info_cfg_option ( WITH_LZMA )
info_cfg_option ( WITH_LZO )
info_cfg_text ( "Python:" )
info_cfg_option ( WITH_PYTHON_INSTALL )
info_cfg_option ( WITH_PYTHON_INSTALL_NUMPY )
info_cfg_option ( WITH_PYTHON_MODULE )
info_cfg_option ( WITH_PYTHON_SAFETY )
if ( APPLE )
info_cfg_option ( WITH_PYTHON_FRAMEWORK )
endif ( )
info_cfg_text ( "Modifiers:" )
info_cfg_option ( WITH_MOD_REMESH )
info_cfg_option ( WITH_MOD_FLUID )
info_cfg_option ( WITH_MOD_OCEANSIM )
info_cfg_text ( "OpenGL:" )
info_cfg_option ( WITH_GLEW_ES )
info_cfg_option ( WITH_GL_EGL )
info_cfg_option ( WITH_GL_PROFILE_ES20 )
if ( WIN32 )
info_cfg_option ( WITH_GL_ANGLE )
endif ( )
info_cfg_text ( "" )
message ( "${_config_msg}" )
2011-06-19 13:49:20 +00:00
endif ( )
2014-11-16 11:57:42 +00:00
if ( 0 )
2019-04-17 04:35:54 +00:00
print_all_vars ( )
2014-11-16 11:57:42 +00:00
endif ( )