2023-08-15 14:20:26 +00:00
|
|
|
# SPDX-FileCopyrightText: 2006 Blender Authors
|
2023-06-14 12:49:59 +00:00
|
|
|
#
|
2022-02-10 22:07:11 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Early Initialization
|
|
|
|
|
|
|
|
# NOTE: We don't allow in-source builds. This causes no end of troubles because
|
2011-09-30 15:51:58 +00:00
|
|
|
# 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
|
|
|
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
2011-04-21 05:49:47 +00:00
|
|
|
if(NOT DEFINED WITH_IN_SOURCE_BUILD)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"CMake generation for blender is not allowed within the source directory!"
|
2017-06-15 21:38:20 +00:00
|
|
|
"\n Remove \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" and try again from another folder, e.g.:"
|
2011-04-21 05:49:47 +00:00
|
|
|
"\n "
|
2021-10-26 08:45:55 +00:00
|
|
|
"\n rm -rf CMakeCache.txt CMakeFiles"
|
2011-04-21 05:49:47 +00:00
|
|
|
"\n cd .."
|
|
|
|
"\n mkdir cmake-make"
|
|
|
|
"\n cd cmake-make"
|
|
|
|
"\n cmake ../blender"
|
|
|
|
"\n "
|
|
|
|
"\n Alternately define WITH_IN_SOURCE_BUILD to force this option (not recommended!)"
|
|
|
|
)
|
|
|
|
endif()
|
2006-12-13 02:57:57 +00:00
|
|
|
endif()
|
|
|
|
|
2020-07-28 12:17:13 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2015-11-09 15:52:29 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
if(NOT EXECUTABLE_OUTPUT_PATH)
|
2015-06-16 23:16:17 +00:00
|
|
|
set(FIRST_RUN TRUE)
|
|
|
|
else()
|
|
|
|
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
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# Avoid having an empty `CMAKE_BUILD_TYPE`.
|
2017-06-26 23:50:35 +00:00
|
|
|
if(NOT DEFINED CMAKE_BUILD_TYPE_INIT)
|
|
|
|
set(CMAKE_BUILD_TYPE_INIT "Release")
|
2021-02-10 06:42:31 +00:00
|
|
|
# Internal logic caches this variable, avoid showing it by default
|
|
|
|
# since it's easy to accidentally set instead of the build type.
|
2017-06-26 23:50:35 +00:00
|
|
|
endif()
|
2024-01-23 09:40:00 +00:00
|
|
|
mark_as_advanced(CMAKE_BUILD_TYPE_INIT)
|
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)
|
|
|
|
set(CMAKE_INSTALL_MESSAGE "LAZY")
|
|
|
|
endif()
|
|
|
|
|
2010-06-07 14:28:37 +00:00
|
|
|
# quiet output for Makefiles, 'make -s' helps too
|
2010-06-09 06:21:07 +00:00
|
|
|
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
2010-06-07 14:28:37 +00:00
|
|
|
|
2023-12-06 22:49:42 +00:00
|
|
|
# Global compile definitions since add_definitions() adds for all.
|
|
|
|
# _DEBUG is a Visual Studio define, enabled for all platforms.
|
2018-05-18 12:26:02 +00:00
|
|
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
|
2023-12-04 14:13:06 +00:00
|
|
|
$<$<CONFIG:Debug>:_DEBUG>
|
2018-05-18 12:26:02 +00:00
|
|
|
)
|
2022-09-13 03:46:51 +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
|
|
|
|
2020-01-26 15:35:58 +00:00
|
|
|
# Silence draco warning on macOS, new policy works fine.
|
2020-02-03 17:44:52 +00:00
|
|
|
if(POLICY CMP0068)
|
|
|
|
cmake_policy(SET CMP0068 NEW)
|
|
|
|
endif()
|
2020-01-26 15:35:58 +00:00
|
|
|
|
2020-08-22 22:24:09 +00:00
|
|
|
# find_package() uses <PackageName>_ROOT variables.
|
|
|
|
if(POLICY CMP0074)
|
|
|
|
cmake_policy(SET CMP0074 NEW)
|
|
|
|
endif()
|
|
|
|
|
2024-03-06 15:51:06 +00:00
|
|
|
# find_package() uses uppercase <PackageName>_ROOT variables.
|
|
|
|
if(POLICY CMP0144)
|
|
|
|
cmake_policy(SET CMP0144 NEW)
|
|
|
|
endif()
|
|
|
|
|
2021-08-03 15:19:40 +00:00
|
|
|
# Install CODE|SCRIPT allow the use of generator expressions.
|
|
|
|
if(POLICY CMP0087)
|
|
|
|
cmake_policy(SET CMP0087 NEW)
|
|
|
|
endif()
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Load Blender's Local Macros
|
|
|
|
|
2011-05-23 14:56:14 +00:00
|
|
|
include(build_files/cmake/macros.cmake)
|
2011-04-09 11:16:37 +00:00
|
|
|
|
2022-09-13 03:46:51 +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()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
2022-09-26 02:26:48 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Test Compiler Support
|
|
|
|
#
|
2024-01-18 15:10:52 +00:00
|
|
|
# Keep in sync with: https://developer.blender.org/docs/handbook/building_blender/
|
2022-09-26 02:26:48 +00:00
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2022-12-17 02:53:30 +00:00
|
|
|
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
2023-08-09 14:51:35 +00:00
|
|
|
message(FATAL_ERROR "\
|
2024-04-26 11:36:59 +00:00
|
|
|
The minimum supported version of GCC is 11.0.0, found C compiler: ${CMAKE_C_COMPILER_VERSION}"
|
2023-08-09 14:51:35 +00:00
|
|
|
)
|
2022-09-26 02:26:48 +00:00
|
|
|
endif()
|
2024-04-26 07:59:20 +00:00
|
|
|
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
2023-08-09 14:51:35 +00:00
|
|
|
message(FATAL_ERROR "\
|
2024-04-26 11:36:59 +00:00
|
|
|
The minimum supported version of GCC is 11.0.0, found C++ compiler${CMAKE_CXX_COMPILER_VERSION}"
|
2023-08-09 14:51:35 +00:00
|
|
|
)
|
2022-09-26 02:26:48 +00:00
|
|
|
endif()
|
2024-04-26 07:59:20 +00:00
|
|
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0")
|
|
|
|
message(FATAL_ERROR "\
|
2024-04-26 11:36:59 +00:00
|
|
|
The minimum supported version of CLANG is 8.0, found C compiler ${CMAKE_C_COMPILER_VERSION}"
|
2024-04-26 07:59:20 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "8.0")
|
|
|
|
message(FATAL_ERROR "\
|
2024-04-26 11:36:59 +00:00
|
|
|
The minimum supported version of CLANG is 8.0, found C++ compiler ${CMAKE_CXX_COMPILER_VERSION}"
|
2024-04-26 07:59:20 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
2024-03-07 06:56:41 +00:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
2022-09-26 02:26:48 +00:00
|
|
|
if(MSVC_VERSION VERSION_LESS "1928")
|
2023-01-05 10:34:11 +00:00
|
|
|
# MSVC_VERSION is an internal version number, it doesn't map to something
|
|
|
|
# the end user would recognize as a version. Because of this, for MSVC we do
|
|
|
|
# not show the found number. When using our make.bat the actual VS version
|
|
|
|
# will be displayed on the console before starting the build, anyway.
|
2022-09-26 02:26:48 +00:00
|
|
|
message(FATAL_ERROR "The minimum supported version of MSVC is 2019 (16.9.16)")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Test Compiler/Library Features
|
2022-08-17 22:04:56 +00:00
|
|
|
|
|
|
|
include(build_files/cmake/have_features.cmake)
|
|
|
|
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Redirect Output Files
|
2006-11-17 02:27:12 +00:00
|
|
|
|
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)
|
2020-09-07 18:52:39 +00:00
|
|
|
|
|
|
|
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
|
|
|
if(GENERATOR_IS_MULTI_CONFIG)
|
2018-08-17 16:04:55 +00:00
|
|
|
set(TESTS_OUTPUT_DIR ${EXECUTABLE_OUTPUT_PATH}/tests/$<CONFIG>/ CACHE INTERNAL "" FORCE)
|
2018-08-17 20:14:26 +00:00
|
|
|
else()
|
2018-08-17 16:04:55 +00:00
|
|
|
set(TESTS_OUTPUT_DIR ${EXECUTABLE_OUTPUT_PATH}/tests/ CACHE INTERNAL "" FORCE)
|
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Set Default Configuration Options
|
2010-06-06 13:32:58 +00:00
|
|
|
|
2010-07-14 20:26:46 +00:00
|
|
|
get_blender_version()
|
|
|
|
|
2023-05-24 19:19:56 +00:00
|
|
|
if(WIN32)
|
|
|
|
add_definitions(
|
|
|
|
# This is the app ID used for file registration, given it's used from several modules
|
|
|
|
# there really is no nice way to get this information consistent without a global define.
|
|
|
|
-DBLENDER_WIN_APPID="blender.${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}"
|
|
|
|
# This is the name that will be shown in the taskbar and OpenWith windows UI
|
|
|
|
-DBLENDER_WIN_APPID_FRIENDLY_NAME="Blender ${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}"
|
|
|
|
)
|
|
|
|
endif()
|
2014-11-13 22:32:01 +00:00
|
|
|
|
2023-07-04 15:38:02 +00:00
|
|
|
|
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19")
|
|
|
|
# This changes the default value from Off to On, but will still allow people to manually change
|
|
|
|
# this setting through their CMakeCache.txt if they desire to do so.
|
|
|
|
set(CMAKE_OPTIMIZE_DEPENDENCIES ON CACHE INTERNAL "")
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Declare Options
|
2014-11-26 12:24:56 +00:00
|
|
|
|
2010-06-06 13:32:58 +00:00
|
|
|
# Blender internal features
|
2023-04-04 07:19:52 +00:00
|
|
|
option(WITH_BLENDER "Build blender (disable to build only Cycles stand-alone)." ON)
|
2011-07-13 08:15:06 +00:00
|
|
|
mark_as_advanced(WITH_BLENDER)
|
|
|
|
|
2023-01-25 00:53:50 +00:00
|
|
|
if(WIN32)
|
|
|
|
option(WITH_BLENDER_THUMBNAILER "\
|
|
|
|
Build \"BlendThumb.dll\" helper for Windows explorer integration to support extracting \
|
|
|
|
thumbnails from `.blend` files."
|
|
|
|
ON
|
|
|
|
)
|
2021-10-20 01:10:09 +00:00
|
|
|
else()
|
2023-01-25 00:53:50 +00:00
|
|
|
set(_option_default ON)
|
|
|
|
if(APPLE)
|
|
|
|
# In future, can be used with `quicklookthumbnailing/qlthumbnailreply`
|
|
|
|
# to create file thumbnails for say Finder.
|
|
|
|
# Turn it off for now, even though it can build on APPLE, it's not likely to be useful.
|
|
|
|
set(_option_default OFF)
|
|
|
|
endif()
|
|
|
|
option(WITH_BLENDER_THUMBNAILER "\
|
|
|
|
Build stand-alone \"blender-thumbnailer\" command-line thumbnail extraction utility, \
|
|
|
|
intended for use by file-managers to extract PNG images from `.blend` files."
|
|
|
|
${_option_default}
|
|
|
|
)
|
|
|
|
unset(_option_default)
|
2021-10-20 01:10:09 +00:00
|
|
|
endif()
|
|
|
|
|
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
|
|
|
|
2023-08-09 14:51:35 +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)
|
2022-11-03 01:10:16 +00:00
|
|
|
# Don't want people disabling this unless they really know what they are doing.
|
|
|
|
mark_as_advanced(WITH_PYTHON)
|
|
|
|
# Some distributions see this as a security issue, rather than have them patch it,
|
|
|
|
# make a build option.
|
|
|
|
mark_as_advanced(WITH_PYTHON_SECURITY)
|
2011-04-28 06:20:47 +00:00
|
|
|
|
2023-08-09 14:51:35 +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)
|
2023-08-09 14:51:35 +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 (only enable for development), \
|
|
|
|
installs to PYTHON_SITE_PACKAGES (or CMAKE_INSTALL_PREFIX if WITH_INSTALL_PORTABLE is enabled)."
|
|
|
|
OFF
|
|
|
|
)
|
2013-02-22 22:24:38 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_BUILDINFO "\
|
|
|
|
Include extra build details (only disable for development & faster builds)"
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
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)"
|
|
|
|
)
|
|
|
|
set(CPACK_OVERRIDE_PACKAGENAME "" CACHE STRING "\
|
|
|
|
Use instead of the standard packagename (empty string disables this option)"
|
|
|
|
)
|
2016-09-06 13:21:23 +00:00
|
|
|
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
|
|
|
|
2024-02-01 16:09:20 +00:00
|
|
|
# CMAKE 3.28.2 has issues with the combination of PCH and unity builds, disable for now.
|
|
|
|
# upstream ticket https://gitlab.kitware.com/cmake/cmake/-/issues/25650
|
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16" AND NOT ${CMAKE_VERSION} VERSION_EQUAL "3.28.2")
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_UNITY_BUILD "\
|
2023-08-10 23:34:07 +00:00
|
|
|
Enable unity build for modules that support it to improve compile times.\n\
|
|
|
|
WARNING: this option allows files to be built without all necessary headers!\n
|
|
|
|
This option should be disabled before manipulating or removing headers."
|
2023-08-09 14:51:35 +00:00
|
|
|
ON
|
|
|
|
)
|
2021-11-24 10:40:26 +00:00
|
|
|
mark_as_advanced(WITH_UNITY_BUILD)
|
|
|
|
else()
|
|
|
|
set(WITH_UNITY_BUILD OFF)
|
|
|
|
endif()
|
|
|
|
|
2024-02-20 23:35:20 +00:00
|
|
|
if(COMMAND target_precompile_headers)
|
|
|
|
# Disabling is needed for `./tools/utils_maintenance/code_clean.py` to function.
|
|
|
|
option(WITH_COMPILER_PRECOMPILED_HEADERS "\
|
|
|
|
Use pre-compiled headers to speed up compilation."
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
mark_as_advanced(WITH_COMPILER_PRECOMPILED_HEADERS)
|
|
|
|
|
|
|
|
if(WITH_CLANG_TIDY AND CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
if(WITH_COMPILER_PRECOMPILED_HEADERS)
|
|
|
|
message(STATUS
|
|
|
|
"Clang-Tidy and GCC precompiled headers are incompatible, disabling precompiled headers"
|
|
|
|
)
|
|
|
|
set(WITH_COMPILER_PRECOMPILED_HEADERS OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT WITH_COMPILER_PRECOMPILED_HEADERS)
|
|
|
|
set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_IK_ITASC "\
|
|
|
|
Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)"
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
option(WITH_IK_SOLVER "\
|
|
|
|
Enable Legacy IK solver (only disable for development)"
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ON)
|
|
|
|
option(WITH_PUGIXML "Enable PugiXML support (Used for OpenImageIO, Grease Pencil SVG export)" ON)
|
|
|
|
option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
|
|
|
|
option(WITH_SYSTEM_BULLET "\
|
|
|
|
Use the systems bullet library (currently unsupported due to missing features in upstream!)"
|
|
|
|
OFF
|
|
|
|
)
|
2013-01-03 00:23:52 +00:00
|
|
|
mark_as_advanced(WITH_SYSTEM_BULLET)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ON)
|
2023-01-25 00:53:50 +00:00
|
|
|
|
|
|
|
set(_option_default ON)
|
2020-03-04 15:39:00 +00:00
|
|
|
if(APPLE)
|
|
|
|
# There's no OpenXR runtime in sight for macOS, neither is code well
|
|
|
|
# tested there -> disable it by default.
|
2023-01-25 00:53:50 +00:00
|
|
|
set(_option_default OFF)
|
|
|
|
endif()
|
|
|
|
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" ${_option_default})
|
|
|
|
if(APPLE)
|
2020-03-04 15:39:00 +00:00
|
|
|
mark_as_advanced(WITH_XR_OPENXR)
|
|
|
|
endif()
|
2023-01-25 00:53:50 +00:00
|
|
|
unset(_option_default)
|
|
|
|
|
2020-08-28 14:56:44 +00:00
|
|
|
option(WITH_GMP "Enable features depending on GMP (Exact Boolean)" ON)
|
2015-07-18 08:35:03 +00:00
|
|
|
|
|
|
|
# Compositor
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_COMPOSITOR_CPU "Enable the tile based CPU nodal compositor" ON)
|
|
|
|
option(WITH_OPENIMAGEDENOISE "Enable the OpenImageDenoise compositing node" ON)
|
2011-06-04 14:12:55 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" ON)
|
2015-07-20 14:08:06 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_POTRACE "Enable features relying on potrace" ON)
|
|
|
|
option(WITH_OPENVDB "Enable features relying on OpenVDB" ON)
|
|
|
|
option(WITH_OPENVDB_BLOSC "\
|
|
|
|
Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support"
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
option(WITH_OPENVDB_3_ABI_COMPATIBLE "\
|
|
|
|
Assume OpenVDB library has been compiled with version 3 ABI compatibility"
|
|
|
|
OFF
|
|
|
|
)
|
2018-04-02 16:55:10 +00:00
|
|
|
mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_NANOVDB "Enable usage of NanoVDB data structure for rendering on the GPU" ON)
|
|
|
|
option(WITH_HARU "Enable features relying on Libharu (Grease pencil PDF export)" ON)
|
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
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
|
2011-07-13 06:04:54 +00:00
|
|
|
mark_as_advanced(WITH_GHOST_DEBUG)
|
2011-06-23 09:27:56 +00:00
|
|
|
|
2023-08-09 14:51:35 +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
|
|
|
|
2020-05-01 10:07:01 +00:00
|
|
|
if(UNIX AND NOT (APPLE OR HAIKU))
|
|
|
|
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
|
|
|
mark_as_advanced(WITH_GHOST_X11)
|
|
|
|
|
2022-10-07 21:05:46 +00:00
|
|
|
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing" ON)
|
2020-05-01 10:07:01 +00:00
|
|
|
mark_as_advanced(WITH_GHOST_WAYLAND)
|
2022-06-24 06:10:20 +00:00
|
|
|
|
2022-08-09 03:36:45 +00:00
|
|
|
if(WITH_GHOST_WAYLAND)
|
2022-10-07 21:05:46 +00:00
|
|
|
option(WITH_GHOST_WAYLAND_LIBDECOR "Optionally build with LibDecor window decorations" ON)
|
2022-06-24 06:10:20 +00:00
|
|
|
mark_as_advanced(WITH_GHOST_WAYLAND_LIBDECOR)
|
2022-06-27 06:33:58 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_GHOST_WAYLAND_DYNLOAD "Enable runtime dynamic WAYLAND libraries loading" ON)
|
2022-07-05 04:49:36 +00:00
|
|
|
mark_as_advanced(WITH_GHOST_WAYLAND_DYNLOAD)
|
2022-11-16 00:15:10 +00:00
|
|
|
|
|
|
|
set(WITH_GHOST_WAYLAND_APP_ID "" CACHE STRING "\
|
|
|
|
The application ID used for Blender (use default when an empty string), \
|
|
|
|
this can be used to differentiate Blender instances by version or branch for example."
|
|
|
|
)
|
|
|
|
mark_as_advanced(WITH_GHOST_WAYLAND_APP_ID)
|
2022-06-24 06:10:20 +00:00
|
|
|
endif()
|
2020-04-30 03:46:42 +00:00
|
|
|
endif()
|
|
|
|
|
2020-05-01 09:14:50 +00:00
|
|
|
if(WITH_GHOST_X11)
|
2023-08-09 14:51:35 +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...
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_HEADLESS "Build without graphical support (renderfarm, server mode only)" OFF)
|
2011-06-04 14:12:55 +00:00
|
|
|
mark_as_advanced(WITH_HEADLESS)
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_QUADRIFLOW "Build with quadriflow remesher support" ON)
|
2019-08-26 16:34:11 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_AUDASPACE "\
|
|
|
|
Build with blenders audio library (only disable if you know what you're doing!)"
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
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)
|
|
|
|
|
2021-03-30 14:58:45 +00:00
|
|
|
set_and_warn_dependency(WITH_AUDASPACE WITH_SYSTEM_AUDASPACE OFF)
|
2011-07-13 06:04:54 +00:00
|
|
|
|
2023-08-09 14:51:35 +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)
|
|
|
|
option(WITH_OPENMP_STATIC "Link OpenMP statically (only used by the release environment)" OFF)
|
|
|
|
mark_as_advanced(WITH_OPENMP_STATIC)
|
|
|
|
endif()
|
2010-06-06 13:32:58 +00:00
|
|
|
|
2020-05-01 09:14:50 +00:00
|
|
|
if(WITH_GHOST_X11)
|
2023-08-09 14:51:35 +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)
|
2014-10-07 20:46:19 +00:00
|
|
|
endif()
|
|
|
|
|
2021-08-02 15:15:53 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2022-01-26 04:30:21 +00:00
|
|
|
option(WITH_SYSTEM_FREETYPE "Use the freetype library provided by the operating system" OFF)
|
2022-06-23 16:51:12 +00:00
|
|
|
option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
|
2021-08-02 15:15:53 +00:00
|
|
|
else()
|
2022-01-26 04:30:21 +00:00
|
|
|
set(WITH_SYSTEM_FREETYPE OFF)
|
2022-06-23 16:51:12 +00:00
|
|
|
set(WITH_SYSTEM_EIGEN3 OFF)
|
2015-03-19 04:41:41 +00:00
|
|
|
endif()
|
|
|
|
|
2024-02-19 17:11:57 +00:00
|
|
|
if((NOT WITH_PYTHON_MODULE) AND (
|
|
|
|
(WIN32 AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")) OR
|
|
|
|
((UNIX AND NOT APPLE) AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"))))
|
|
|
|
option(WITH_CPU_CHECK "\
|
|
|
|
Report when a CPU is not compatible on startup \
|
|
|
|
instead of failing to start with an inscrutable error."
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
mark_as_advanced(WITH_CPU_CHECK)
|
|
|
|
else()
|
|
|
|
set(WITH_CPU_CHECK OFF)
|
|
|
|
endif()
|
2012-06-23 14:23:44 +00:00
|
|
|
|
2010-10-23 15:40:13 +00:00
|
|
|
# Modifiers
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_MOD_FLUID "Enable Mantaflow Fluid Simulation Framework" ON)
|
|
|
|
option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
|
|
|
|
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" ON)
|
2010-10-23 15:40:13 +00:00
|
|
|
|
2010-06-06 13:32:58 +00:00
|
|
|
# Image format support
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
|
|
|
|
option(WITH_IMAGE_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
|
|
|
|
option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON)
|
|
|
|
option(WITH_IMAGE_WEBP "Enable WebP Image Support" ON)
|
2010-06-06 13:32:58 +00:00
|
|
|
|
2010-11-30 18:52:39 +00:00
|
|
|
# Audio/Video format support
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" ON)
|
|
|
|
option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" ON)
|
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
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_ALEMBIC "Enable Alembic Support" 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
|
|
|
|
USD: Introducing a simple USD Exporter
This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.
Reviewed By: sergey, LazyDodo
Differential Revision: https://developer.blender.org/D6287
- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.
== Meshes ==
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.
Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.
The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.
The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.
A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.
== Animation ==
Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.
The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.
== Support for simple preview materials ==
Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.
When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.
The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.
Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.
Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.
== Hair ==
Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.
== Camera ==
Only perspective cameras are supported for now.
== Particles ==
Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).
Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.
== Instancing/referencing ==
This exporter has experimental support for instancing/referencing.
Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.
I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.
== Lights ==
USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.
== Fluid vertex velocities ==
Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.
== The Building Process ==
- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048
2019-12-13 09:27:40 +00:00
|
|
|
# Universal Scene Description support
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_USD "Enable Universal Scene Description (USD) Support" ON)
|
USD: Introducing a simple USD Exporter
This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.
Reviewed By: sergey, LazyDodo
Differential Revision: https://developer.blender.org/D6287
- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.
== Meshes ==
USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.
Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.
Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.
The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.
The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.
A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.
== Animation ==
Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.
The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.
== Support for simple preview materials ==
Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.
When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.
The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.
Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.
Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.
== Hair ==
Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.
== Camera ==
Only perspective cameras are supported for now.
== Particles ==
Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).
Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.
== Instancing/referencing ==
This exporter has experimental support for instancing/referencing.
Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.
I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.
== Lights ==
USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.
== Fluid vertex velocities ==
Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.
== The Building Process ==
- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048
2019-12-13 09:27:40 +00:00
|
|
|
|
2022-12-05 22:18:54 +00:00
|
|
|
# MaterialX
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_MATERIALX "Enable MaterialX Support" ON)
|
2022-12-05 22:18:54 +00:00
|
|
|
|
2023-08-04 13:10:48 +00:00
|
|
|
# Hydra render engine
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_HYDRA "Enable Hydra render engine" ON)
|
2023-08-04 13:10:48 +00:00
|
|
|
|
2023-11-23 22:35:03 +00:00
|
|
|
# RTL Languages, Complex Shaping, OpenType Features
|
|
|
|
option(WITH_FRIBIDI "Enable features relying on fribidi" OFF)
|
|
|
|
option(WITH_HARFBUZZ "Enable features relying on harfbuzz" 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
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_OPENCOLLADA "Enable OpenCollada Support (http://www.opencollada.org)" ON)
|
|
|
|
option(WITH_IO_WAVEFRONT_OBJ "Enable Wavefront-OBJ 3D file format support (*.obj)" ON)
|
|
|
|
option(WITH_IO_PLY "Enable PLY 3D file format support (*.ply)" ON)
|
|
|
|
option(WITH_IO_STL "Enable STL 3D file format support (*.stl)" ON)
|
|
|
|
option(WITH_IO_GPENCIL "Enable grease-pencil file format IO (*.svg, *.pdf)" ON)
|
2009-11-19 11:49:42 +00:00
|
|
|
|
2010-06-06 13:32:58 +00:00
|
|
|
# Sound output
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_SDL "Enable SDL for sound" ON)
|
|
|
|
option(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
|
2021-03-14 11:46:47 +00:00
|
|
|
if(APPLE)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_COREAUDIO "Enable CoreAudio for audio support on macOS" ON)
|
2021-03-14 11:46:47 +00:00
|
|
|
else()
|
|
|
|
set(WITH_COREAUDIO OFF)
|
|
|
|
endif()
|
2022-11-14 18:14:49 +00:00
|
|
|
if(NOT WIN32)
|
2023-01-25 00:53:50 +00:00
|
|
|
set(_option_default ON)
|
2022-11-14 18:14:49 +00:00
|
|
|
if(APPLE)
|
2023-01-25 00:53:50 +00:00
|
|
|
set(_option_default OFF)
|
2022-11-14 18:14:49 +00:00
|
|
|
endif()
|
2023-01-25 00:53:50 +00:00
|
|
|
option(WITH_JACK "Enable JACK Support (http://www.jackaudio.org)" ${_option_default})
|
|
|
|
unset(_option_default)
|
|
|
|
option(WITH_JACK_DYNLOAD "Enable runtime dynamic JACK libraries loading" OFF)
|
2021-03-16 21:32:16 +00:00
|
|
|
else()
|
|
|
|
set(WITH_JACK OFF)
|
2013-03-27 07:19:54 +00:00
|
|
|
endif()
|
2014-11-17 11:35:36 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_SDL_DYNLOAD "Enable runtime dynamic SDL libraries loading" OFF)
|
2014-11-17 11:35:36 +00:00
|
|
|
endif()
|
2021-03-02 16:29:18 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_PULSEAUDIO "Enable PulseAudio for audio support on Linux" ON)
|
|
|
|
option(WITH_PULSEAUDIO_DYNLOAD "Enable runtime dynamic PulseAudio libraries loading" OFF)
|
2021-03-02 16:29:18 +00:00
|
|
|
else()
|
|
|
|
set(WITH_PULSEAUDIO OFF)
|
|
|
|
endif()
|
2021-03-11 18:22:56 +00:00
|
|
|
if(WIN32)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_WASAPI "Enable Windows Audio Sessions API for audio support on Windows" ON)
|
2021-03-11 18:22:56 +00:00
|
|
|
else()
|
|
|
|
set(WITH_WASAPI OFF)
|
|
|
|
endif()
|
2010-06-06 13:32:58 +00:00
|
|
|
|
|
|
|
# Compression
|
2023-08-09 14:51:35 +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)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_SYSTEM_LZO "Use the system LZO library" OFF)
|
2015-03-13 11:33:31 +00:00
|
|
|
endif()
|
2023-08-09 14:51:35 +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
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_LIBMV "Enable Libmv structure from motion library" ON)
|
2019-11-25 16:41:25 +00:00
|
|
|
option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." ON)
|
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.
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_SYSTEM_GFLAGS "Use system-wide Gflags instead of a bundled one" OFF)
|
|
|
|
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
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
|
2012-12-20 07:57:26 +00:00
|
|
|
|
2023-01-19 06:07:24 +00:00
|
|
|
# Libraries.
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
# Optionally build without pre-compiled libraries.
|
|
|
|
# NOTE: this could be supported on all platforms however in practice UNIX is the only platform
|
|
|
|
# that has good support for detecting installed libraries.
|
|
|
|
option(WITH_LIBS_PRECOMPILED "\
|
|
|
|
Detect and link against pre-compiled libraries (typically found under \"../lib/\"). \
|
|
|
|
Disabling this option will use the system libraries although cached paths \
|
|
|
|
that point to pre-compiled libraries will be left as-is."
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
mark_as_advanced(WITH_LIBS_PRECOMPILED)
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_STATIC_LIBS "\
|
|
|
|
Try to link with static libraries, as much as possible, \
|
|
|
|
to make blender more portable across distributions"
|
|
|
|
OFF
|
|
|
|
)
|
2023-01-19 06:07:24 +00:00
|
|
|
if(WITH_STATIC_LIBS)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_BOOST_ICU "\
|
|
|
|
Boost uses ICU library (required for linking with static Boost built with libicu)."
|
|
|
|
OFF
|
|
|
|
)
|
2023-01-19 06:07:24 +00:00
|
|
|
mark_as_advanced(WITH_BOOST_ICU)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2010-06-06 13:32:58 +00:00
|
|
|
# Misc
|
2023-10-18 22:09:59 +00:00
|
|
|
if(WIN32 OR APPLE OR ((UNIX AND (NOT HAIKU)) AND WITH_GHOST_WAYLAND))
|
2014-12-06 23:58:17 +00:00
|
|
|
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
|
2023-10-18 11:04:25 +00:00
|
|
|
else()
|
|
|
|
set(WITH_INPUT_IME OFF)
|
2014-12-06 23:58:17 +00:00
|
|
|
endif()
|
2019-11-25 16:41:25 +00:00
|
|
|
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
|
2023-11-01 17:28:53 +00:00
|
|
|
# On Windows and for the Blender application on macOS, portable install
|
|
|
|
# is the only supported installation type, so there is no option.
|
|
|
|
if(UNIX AND (NOT APPLE OR WITH_PYTHON_MODULE))
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_INSTALL_PORTABLE "\
|
|
|
|
Install redistributable runtime, otherwise install into CMAKE_INSTALL_PREFIX"
|
|
|
|
ON
|
|
|
|
)
|
2011-03-06 11:41:30 +00:00
|
|
|
endif()
|
2016-03-15 12:50:44 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON)
|
2020-12-14 15:40:00 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_INSTALL_COPYRIGHT "\
|
2023-08-15 14:20:26 +00:00
|
|
|
Copy the official Blender Authors's copyright.txt into the Blender install folder"
|
2023-08-09 14:51:35 +00:00
|
|
|
OFF
|
|
|
|
)
|
2023-05-24 08:07:19 +00:00
|
|
|
mark_as_advanced(WITH_INSTALL_COPYRIGHT)
|
|
|
|
|
2020-12-14 15:40:00 +00:00
|
|
|
if((WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE) OR WITH_MOD_FLUID)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_PYTHON_NUMPY "Include NumPy in Blender (used by Audaspace and Mantaflow)" ON)
|
2020-12-14 15:40:00 +00:00
|
|
|
endif()
|
|
|
|
|
2018-09-17 09:10:45 +00:00
|
|
|
if(WIN32 OR APPLE)
|
|
|
|
# Windows and macOS have this bundled with Python libraries.
|
2020-12-14 15:40:00 +00:00
|
|
|
elseif(WITH_PYTHON_INSTALL OR WITH_PYTHON_NUMPY)
|
2023-08-09 14:51:35 +00:00
|
|
|
set(PYTHON_NUMPY_PATH "" CACHE PATH "\
|
|
|
|
Path to python site-packages or dist-packages containing 'numpy' module"
|
|
|
|
)
|
2016-03-15 12:50:44 +00:00
|
|
|
mark_as_advanced(PYTHON_NUMPY_PATH)
|
2023-08-09 14:51:35 +00:00
|
|
|
set(PYTHON_NUMPY_INCLUDE_DIRS "" CACHE PATH "Path to the include directory of the NumPy module")
|
2017-08-18 06:24:12 +00:00
|
|
|
mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS)
|
|
|
|
endif()
|
|
|
|
if(WITH_PYTHON_INSTALL)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_PYTHON_INSTALL_NUMPY "Copy system NumPy into the blender install folder" ON)
|
2016-03-15 12:50:44 +00:00
|
|
|
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
option(WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON)
|
2023-08-09 14:51:35 +00:00
|
|
|
set(PYTHON_REQUESTS_PATH "" CACHE PATH "\
|
|
|
|
Path to python site-packages or dist-packages containing 'requests' module"
|
|
|
|
)
|
2016-03-15 12:50:44 +00:00
|
|
|
mark_as_advanced(PYTHON_REQUESTS_PATH)
|
|
|
|
endif()
|
2021-10-21 11:45:37 +00:00
|
|
|
|
|
|
|
option(WITH_PYTHON_INSTALL_ZSTANDARD "Copy zstandard into the blender install folder" ON)
|
2023-08-09 14:51:35 +00:00
|
|
|
set(PYTHON_ZSTANDARD_PATH "" CACHE PATH "\
|
|
|
|
Path to python site-packages or dist-packages containing 'zstandard' module"
|
|
|
|
)
|
2021-10-21 11:45:37 +00:00
|
|
|
mark_as_advanced(PYTHON_ZSTANDARD_PATH)
|
2016-03-15 12:50:44 +00:00
|
|
|
endif()
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CPU_SIMD "Enable SIMD instruction if they're detected on the host machine" ON)
|
2021-02-14 03:16:39 +00:00
|
|
|
mark_as_advanced(WITH_CPU_SIMD)
|
2012-05-01 23:22:58 +00:00
|
|
|
|
2011-04-28 13:47:27 +00:00
|
|
|
# Cycles
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
|
|
|
|
option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage support" ON)
|
|
|
|
option(WITH_CYCLES_PATH_GUIDING "Build Cycles with path guiding support" ON)
|
|
|
|
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
|
|
|
|
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
|
|
|
|
option(WITH_CYCLES_DEBUG "Build Cycles with options useful for debugging (e.g., MIS)" OFF)
|
2021-10-22 06:31:47 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
|
|
|
|
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
|
|
|
|
option(WITH_CYCLES_PRECOMPUTE "Build Cycles data precomputation tool" OFF)
|
2021-10-22 06:31:47 +00:00
|
|
|
|
2022-03-23 15:07:43 +00:00
|
|
|
option(WITH_CYCLES_HYDRA_RENDER_DELEGATE "Build Cycles Hydra render delegate" OFF)
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_DEBUG_NAN "\
|
|
|
|
Build Cycles with additional asserts for detecting NaNs and invalid values"
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
option(WITH_CYCLES_NATIVE_ONLY "\
|
|
|
|
Build Cycles with native kernel only (which fits current CPU, use for development only)"
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
option(WITH_CYCLES_KERNEL_ASAN "\
|
|
|
|
Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow"
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
set(CYCLES_TEST_DEVICES CPU CACHE STRING "\
|
|
|
|
Run regression tests on the specified device types (CPU CUDA OPTIX HIP)"
|
|
|
|
)
|
2019-07-11 17:29:29 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
|
2014-10-04 13:00:26 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_LOGGING)
|
2021-07-28 16:27:25 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
|
2016-03-25 15:09:05 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
|
Cycles: Remove MultiGGX code, replace with albedo scaling
While the multiscattering GGX code is cool and solves the darkening problem at higher roughnesses, it's also currently buggy, hard to maintain and often impractical to use due to the higher noise and render time.
In practice, though, having the exact correct directional distribution is not that important as long as the overall albedo is correct and we a) don't get the darkening effect and b) do get the saturation effect at higher roughnesses.
This can simply be achieved by adding a second lobe (https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf) or scaling the single-scattering GGX lobe (https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf). Both approaches require the same precomputation and produce outputs of comparable quality, so I went for the simple albedo scaling since it's easier to implement and more efficient.
Overall, the results are pretty good: All scenarios that I tested (Glossy BSDF, Glass BSDF, Principled BSDF with metallic or transmissive = 1) pass the white furnace test (a material with pure-white color in front of a pure-white background should be indistinguishable from the background if it preserves energy), and the overall albedo for non-white materials matches that produced by the real multi-scattering code (with the expected saturation increase as the roughness increases).
In order to produce the precomputed tables, the PR also includes a utility that computes them. This is not built by default, since there's no reason for a user to run it (it only makes sense for documentation/reproducibility purposes and when making changes to the microfacet models).
Pull Request: https://projects.blender.org/blender/blender/pulls/107958
2023-06-05 00:20:57 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_PRECOMPUTE)
|
2023-07-10 02:02:15 +00:00
|
|
|
mark_as_advanced(CYCLES_TEST_DEVICES)
|
2011-04-28 13:47:27 +00:00
|
|
|
|
2021-10-22 06:31:47 +00:00
|
|
|
# NVIDIA CUDA & OptiX
|
2024-03-07 06:56:41 +00:00
|
|
|
if(NOT APPLE AND NOT (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64"))
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles NVIDIA CUDA compute support" ON)
|
|
|
|
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles NVIDIA OptiX support" ON)
|
2021-12-07 17:27:51 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles NVIDIA CUDA binaries" OFF)
|
|
|
|
set(CYCLES_CUDA_BINARIES_ARCH
|
|
|
|
sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 sm_89 compute_75
|
|
|
|
CACHE STRING "CUDA architectures to build binaries for"
|
|
|
|
)
|
|
|
|
option(WITH_CYCLES_CUDA_BUILD_SERIAL "\
|
|
|
|
Build cubins one after another (useful on machines with limited RAM)"
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
option(WITH_CUDA_DYNLOAD "\
|
|
|
|
Dynamically load CUDA libraries at runtime (for developers, makes cuda-gdb work)"
|
|
|
|
ON
|
|
|
|
)
|
2022-08-29 17:12:15 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
set(OPTIX_ROOT_DIR "" CACHE PATH "\
|
|
|
|
Path to the OptiX SDK root directory, for building Cycles OptiX kernels."
|
|
|
|
)
|
|
|
|
set(CYCLES_RUNTIME_OPTIX_ROOT_DIR "" CACHE PATH "\
|
|
|
|
Path to the OptiX SDK root directory. \
|
|
|
|
When set, this path will be used at runtime to compile OptiX kernels."
|
|
|
|
)
|
2022-08-29 17:12:15 +00:00
|
|
|
|
2021-12-07 17:27:51 +00:00
|
|
|
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
|
|
|
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
|
|
|
|
mark_as_advanced(WITH_CUDA_DYNLOAD)
|
2022-08-29 17:12:15 +00:00
|
|
|
mark_as_advanced(OPTIX_ROOT_DIR)
|
|
|
|
mark_as_advanced(CYCLES_RUNTIME_OPTIX_ROOT_DIR)
|
2021-12-07 17:27:51 +00:00
|
|
|
endif()
|
2016-01-14 07:24:09 +00:00
|
|
|
|
2021-10-22 06:31:47 +00:00
|
|
|
# AMD HIP
|
2024-03-07 06:56:41 +00:00
|
|
|
if(NOT APPLE AND NOT (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64"))
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
|
|
|
|
option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
|
2023-04-19 16:18:05 +00:00
|
|
|
# Radeon VII (gfx906) not currently working with HIP SDK, so left out of the list.
|
2023-08-09 14:51:35 +00:00
|
|
|
set(CYCLES_HIP_BINARIES_ARCH
|
|
|
|
gfx900 gfx90c gfx902
|
2023-08-16 12:35:09 +00:00
|
|
|
gfx1010 gfx1011 gfx1012
|
|
|
|
gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 gfx1036
|
2023-10-19 16:03:31 +00:00
|
|
|
gfx1100 gfx1101 gfx1102 gfx1103
|
2023-08-09 14:51:35 +00:00
|
|
|
CACHE STRING "AMD HIP architectures to build binaries for"
|
|
|
|
)
|
2021-12-07 17:27:51 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
|
|
|
|
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
|
2023-04-24 17:05:30 +00:00
|
|
|
|
|
|
|
# HIPRT is only available on Windows for now.
|
|
|
|
if(WIN32)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_DEVICE_HIPRT "Enable Cycles AMD HIPRT support" OFF)
|
2023-04-24 17:05:30 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_DEVICE_HIPRT)
|
|
|
|
endif()
|
2021-11-09 15:00:06 +00:00
|
|
|
endif()
|
2021-10-22 06:31:47 +00:00
|
|
|
|
2021-12-13 12:48:36 +00:00
|
|
|
# Apple Metal
|
|
|
|
if(APPLE)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_DEVICE_METAL "Enable Cycles Apple Metal compute support" ON)
|
2021-12-13 12:48:36 +00:00
|
|
|
endif()
|
|
|
|
|
2022-06-29 10:58:04 +00:00
|
|
|
# oneAPI
|
2024-03-07 06:56:41 +00:00
|
|
|
if(NOT APPLE AND NOT (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64"))
|
2022-06-29 10:58:04 +00:00
|
|
|
option(WITH_CYCLES_DEVICE_ONEAPI "Enable Cycles oneAPI compute support" OFF)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CYCLES_ONEAPI_BINARIES "\
|
|
|
|
Enable Ahead-Of-Time compilation for Cycles oneAPI device"
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
option(WITH_CYCLES_ONEAPI_HOST_TASK_EXECUTION "\
|
|
|
|
Switch target of oneAPI implementation from SYCL devices to Host Task (single thread on CPU). \
|
|
|
|
This option is only for debugging purposes."
|
|
|
|
OFF
|
|
|
|
)
|
2022-06-29 10:58:04 +00:00
|
|
|
|
|
|
|
# https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compilation/ahead-of-time-compilation.html
|
2023-09-21 11:46:25 +00:00
|
|
|
# The target architectures levels can be retrieved from `ocloc` output when running
|
|
|
|
# `ocloc compile -device {device_id} test.c` for given GPUs PCI device IDs.
|
2024-04-08 16:18:55 +00:00
|
|
|
# 12.55.8 is for Arc Alchemist GPUs. 12.70.4 for Meteor Lake iGPUs.
|
|
|
|
set(CYCLES_ONEAPI_INTEL_BINARIES_ARCH 12.55.8 12.70.4 CACHE STRING "\
|
2023-08-09 14:51:35 +00:00
|
|
|
oneAPI Intel GPU architectures to build binaries for"
|
|
|
|
)
|
|
|
|
set(CYCLES_ONEAPI_SYCL_TARGETS spir64 spir64_gen CACHE STRING "\
|
|
|
|
oneAPI targets to build AOT binaries for"
|
|
|
|
)
|
2022-06-29 10:58:04 +00:00
|
|
|
|
2023-01-03 19:45:57 +00:00
|
|
|
mark_as_advanced(WITH_CYCLES_ONEAPI_HOST_TASK_EXECUTION)
|
2023-09-21 11:33:06 +00:00
|
|
|
mark_as_advanced(CYCLES_ONEAPI_INTEL_BINARIES_ARCH)
|
2022-06-29 10:58:04 +00:00
|
|
|
mark_as_advanced(CYCLES_ONEAPI_SYCL_TARGETS)
|
|
|
|
endif()
|
|
|
|
|
2021-08-03 16:39:30 +00:00
|
|
|
# Draw Manager
|
|
|
|
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
|
|
|
|
mark_as_advanced(WITH_DRAW_DEBUG)
|
|
|
|
|
2012-10-06 11:00:45 +00:00
|
|
|
# LLVM
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_LLVM "Use LLVM" OFF)
|
2024-02-14 11:06:52 +00:00
|
|
|
option(LLVM_STATIC "Link with LLVM static libraries" OFF)
|
2013-04-15 16:18:35 +00:00
|
|
|
mark_as_advanced(LLVM_STATIC)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CLANG "Use Clang" OFF)
|
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
|
2023-08-09 14:51:35 +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
|
2023-08-09 14:51:35 +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)
|
|
|
|
|
2023-12-06 22:49:42 +00:00
|
|
|
option(WITH_ASSERT_RELEASE "Build with asserts enabled even for non-debug configurations" OFF)
|
|
|
|
mark_as_advanced(WITH_ASSERT_RELEASE)
|
|
|
|
|
2020-12-03 18:00:58 +00:00
|
|
|
if((UNIX AND NOT APPLE) OR (CMAKE_GENERATOR MATCHES "^Visual Studio.+"))
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_CLANG_TIDY "\
|
|
|
|
Use Clang Tidy to analyze the source code \
|
|
|
|
(only enable for development on Linux using Clang, or Windows using the Visual Studio IDE)"
|
|
|
|
OFF
|
|
|
|
)
|
2020-06-05 09:37:49 +00:00
|
|
|
mark_as_advanced(WITH_CLANG_TIDY)
|
|
|
|
endif()
|
|
|
|
|
2019-10-09 14:44:29 +00:00
|
|
|
option(WITH_BOOST "Enable features depending on boost" ON)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_TBB "\
|
|
|
|
Enable multi-threading. TBB is also required for features such as Cycles, OpenVDB and USD"
|
|
|
|
ON
|
|
|
|
)
|
2019-11-25 16:41:25 +00:00
|
|
|
|
|
|
|
# TBB malloc is only supported on for windows currently
|
|
|
|
if(WIN32)
|
|
|
|
option(WITH_TBB_MALLOC_PROXY "Enable the TBB malloc replacement" ON)
|
|
|
|
endif()
|
2013-01-31 23:25:06 +00:00
|
|
|
|
2024-02-21 08:57:40 +00:00
|
|
|
option(WITH_EXPERIMENTAL_FEATURES "Enable experimental features" ON)
|
|
|
|
|
2020-08-17 07:47:10 +00:00
|
|
|
# This should be turned off when Blender enter beta/rc/release
|
2024-02-21 08:57:40 +00:00
|
|
|
if("${BLENDER_VERSION_CYCLE}" STREQUAL "alpha" AND WITH_EXPERIMENTAL_FEATURES)
|
2020-09-09 14:07:29 +00:00
|
|
|
set(WITH_EXPERIMENTAL_FEATURES ON)
|
2021-11-26 08:33:47 +00:00
|
|
|
else()
|
|
|
|
set(WITH_EXPERIMENTAL_FEATURES OFF)
|
2020-09-09 14:07:29 +00:00
|
|
|
endif()
|
2020-08-17 07:47:10 +00:00
|
|
|
|
2022-03-07 16:25:50 +00:00
|
|
|
# Unit testing
|
2014-06-18 12:49:17 +00:00
|
|
|
option(WITH_GTESTS "Enable GTest unit testing" OFF)
|
2024-03-07 02:26:55 +00:00
|
|
|
option(WITH_GPU_RENDER_TESTS "\
|
|
|
|
Enable GPU render related unit testing (EEVEE, Workbench and Grease Pencil)"
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
option(WITH_GPU_RENDER_TESTS_SILENT "\
|
|
|
|
Run GPU render tests silently (finished tests will pass). \
|
|
|
|
Generated report will show failing tests"
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
option(WITH_GPU_DRAW_TESTS "\
|
|
|
|
Enable GPU drawing related unit testing (GPU backends and draw manager)"
|
|
|
|
OFF
|
|
|
|
)
|
2023-08-23 14:03:12 +00:00
|
|
|
option(WITH_COMPOSITOR_REALTIME_TESTS "Enable regression testing for realtime compositor" OFF)
|
2023-10-26 04:19:33 +00:00
|
|
|
if(UNIX AND NOT (APPLE OR HAIKU))
|
|
|
|
option(WITH_UI_TESTS "\
|
|
|
|
Enable user-interface tests using a headless display server. \
|
|
|
|
Currently this depends on WITH_GHOST_WAYLAND and the weston compositor \
|
|
|
|
(Experimental)"
|
|
|
|
OFF
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
# TODO: support running GUI tests on other platforms.
|
|
|
|
set(WITH_UI_TESTS OFF)
|
|
|
|
endif()
|
|
|
|
|
2023-11-08 17:41:33 +00:00
|
|
|
# Enabled by default for typical use cases to speed up development cycles. However, when looking
|
|
|
|
# into threading or memory related issues (in dependency graph, out-of-bounds, etc) forcing single
|
|
|
|
# test per Blender instance could give much better clues about the root of the problem.
|
2024-03-07 02:26:55 +00:00
|
|
|
option(WITH_TESTS_BATCHED "\
|
|
|
|
Run multiple tests in a single Blender invocation, for faster test execution"
|
|
|
|
ON
|
|
|
|
)
|
2023-11-08 17:41:33 +00:00
|
|
|
mark_as_advanced(WITH_TESTS_BATCHED)
|
|
|
|
|
2024-01-03 17:35:50 +00:00
|
|
|
option(WITH_TESTS_SINGLE_BINARY "\
|
|
|
|
Link GTest tests into a single binary. \
|
|
|
|
For faster overall build and less disk space, but slower individual test build"
|
|
|
|
ON
|
|
|
|
)
|
|
|
|
mark_as_advanced(WITH_TESTS_SINGLE_BINARY)
|
|
|
|
|
2022-11-03 00:48:47 +00:00
|
|
|
# NOTE: All callers of this must add `TEST_PYTHON_EXE_EXTRA_ARGS` before any other arguments.
|
Tests: use explicit Python to run unit tests
CentOS on the buildbot still runs Python 3.6, which is also used for the
unit tests. This means that the tests can't use language features that
are available to Blender itself. And testing with a different version of
Python than will be used by the actual code seems like a bad idea to me.
This commit adds `TEST_PYTHON_EXECUTABLE` as advanced CMake option. This
will allow us to set a specific Python executable when we need it. When
not set, a platform-specific default will be used:
- On Windows, the `python….exe` from the installation directory. This is
just like before this patch, except that this patch adds the
overridability.
- On macOS/Linux, the `${PYTHON_EXECUTABLE}` as found by CMake.
Every platform should now have a value (configured by the user or
detected by CMake) for `TEST_PYTHON_EXE`, so there is no need to allow
running without. This also removes the need to have some Python files
marked as executable.
If `TEST_PYTHON_EXE` is not user-configured, and thus the above default
is used, a status message is logged by CMake. I've seen this a lot in
other projects, and I like that it shows which values are auto-detected.
However, it's not common in Blender, so if we want we can either remove
it now, or remove it after the buildbot has been set up correctly.
Differential Revision: https://developer.blender.org/D7395
Reviewed by: campbellbarton, mont29, sergey
2020-04-10 08:35:17 +00:00
|
|
|
set(TEST_PYTHON_EXE "" CACHE PATH "Python executable to run unit tests")
|
|
|
|
mark_as_advanced(TEST_PYTHON_EXE)
|
2014-06-18 12:49:17 +00:00
|
|
|
|
2014-11-13 13:07:34 +00:00
|
|
|
# Documentation
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
option(WITH_DOC_MANPAGE "Create a manual page (Unix manpage)" OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2023-07-11 07:17:31 +00:00
|
|
|
# GPU Module
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_GPU_BUILDTIME_SHADER_BUILDER "\
|
|
|
|
Shader builder is a developer option enabling linting on GLSL during compilation"
|
|
|
|
OFF
|
|
|
|
)
|
2023-03-23 15:37:52 +00:00
|
|
|
option(WITH_RENDERDOC "Use Renderdoc API to capture frames" OFF)
|
2014-10-07 20:46:19 +00:00
|
|
|
|
|
|
|
mark_as_advanced(
|
2022-07-11 14:45:07 +00:00
|
|
|
WITH_GPU_BUILDTIME_SHADER_BUILDER
|
2023-03-23 15:37:52 +00:00
|
|
|
WITH_RENDERDOC
|
2014-10-07 20:46:19 +00:00
|
|
|
)
|
|
|
|
|
2023-07-11 07:17:31 +00:00
|
|
|
# OpenGL
|
2023-07-19 12:16:03 +00:00
|
|
|
if(NOT APPLE)
|
|
|
|
option(WITH_OPENGL_BACKEND "Enable OpenGL support as graphic backend" ON)
|
|
|
|
mark_as_advanced(WITH_OPENGL_BACKEND)
|
|
|
|
else()
|
|
|
|
set(WITH_OPENGL_BACKEND OFF)
|
|
|
|
endif()
|
2023-07-11 07:17:31 +00:00
|
|
|
|
2022-10-31 15:01:02 +00:00
|
|
|
# Vulkan
|
2024-04-11 09:04:43 +00:00
|
|
|
option(WITH_VULKAN_BACKEND "Enable Vulkan as graphics backend (experimental)" ON)
|
2024-04-19 05:50:26 +00:00
|
|
|
option(WITH_VULKAN_GUARDEDALLOC "\
|
|
|
|
Use guardedalloc for host allocations done inside Vulkan (development option)"
|
2024-04-11 09:04:43 +00:00
|
|
|
OFF
|
|
|
|
)
|
|
|
|
mark_as_advanced(
|
|
|
|
WITH_VULKAN_BACKEND
|
|
|
|
WITH_VULKAN_GUARDEDALLOC
|
|
|
|
)
|
|
|
|
if(APPLE)
|
|
|
|
option(WITH_VULKAN_MOLTENVK "Enable Vulkan over MoltenVK (development option)" OFF)
|
2023-10-06 13:24:21 +00:00
|
|
|
mark_as_advanced(
|
2024-04-11 09:04:43 +00:00
|
|
|
WITH_VULKAN_MOLTENVK
|
2023-10-06 13:24:21 +00:00
|
|
|
)
|
2024-04-11 09:04:43 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(APPLE AND NOT WITH_VULKAN_MOLTENVK)
|
|
|
|
set(WITH_VULKAN_BACKEND OFF)
|
|
|
|
endif()
|
|
|
|
if(NOT WITH_EXPERIMENTAL_FEATURES)
|
2024-04-19 05:50:26 +00:00
|
|
|
if(APPLE)
|
2024-04-11 09:04:43 +00:00
|
|
|
set(WITH_VULKAN_MOLTENVK OFF)
|
2023-10-06 13:24:21 +00:00
|
|
|
endif()
|
2024-04-11 09:04:43 +00:00
|
|
|
set(WITH_VULKAN_BACKEND OFF)
|
2023-10-06 13:24:21 +00:00
|
|
|
endif()
|
2022-10-31 15:01:02 +00:00
|
|
|
|
2022-03-22 11:38:28 +00:00
|
|
|
# Metal
|
2022-08-09 03:36:45 +00:00
|
|
|
if(APPLE)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_METAL_BACKEND "\
|
|
|
|
Use Metal for graphics instead of (or as well as) OpenGL on macOS."
|
|
|
|
ON
|
|
|
|
)
|
2022-03-22 11:38:28 +00:00
|
|
|
mark_as_advanced(WITH_METAL_BACKEND)
|
|
|
|
else()
|
|
|
|
set(WITH_METAL_BACKEND OFF)
|
|
|
|
endif()
|
|
|
|
|
2015-12-27 15:57:31 +00:00
|
|
|
if(WIN32)
|
2014-11-08 10:32:32 +00:00
|
|
|
getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
|
|
|
|
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
|
|
|
|
endif()
|
|
|
|
|
2023-05-07 03:32:46 +00:00
|
|
|
option(WITH_STRSIZE_DEBUG "\
|
|
|
|
Ensure string operations on fixed size buffers \
|
|
|
|
(works well with with \"WITH_COMPILER_ASAN\" & valgrind to detect incorrect buffer size arguments)"
|
|
|
|
OFF)
|
|
|
|
mark_as_advanced(WITH_STRSIZE_DEBUG)
|
|
|
|
|
2022-01-12 11:49:36 +00:00
|
|
|
# Compiler tool-chain.
|
2023-04-12 11:31:53 +00:00
|
|
|
if(UNIX)
|
2022-01-12 11:49:36 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
|
|
|
|
mark_as_advanced(WITH_LINKER_GOLD)
|
|
|
|
endif()
|
2024-03-07 08:56:58 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2023-04-12 11:31:53 +00:00
|
|
|
option(WITH_LINKER_LLD "Use ld.lld linker which is usually faster than ld.gold" OFF)
|
|
|
|
mark_as_advanced(WITH_LINKER_LLD)
|
2023-08-01 10:35:13 +00:00
|
|
|
option(WITH_LINKER_MOLD "Use ld.mold linker which is usually faster than ld.gold & ld.lld" OFF)
|
2022-01-12 02:35:07 +00:00
|
|
|
mark_as_advanced(WITH_LINKER_MOLD)
|
|
|
|
endif()
|
2016-11-02 09:42:15 +00:00
|
|
|
endif()
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_COMPILER_ASAN "\
|
|
|
|
Build and link against address sanitizer (only for Debug & RelWithDebInfo targets)."
|
|
|
|
OFF
|
|
|
|
)
|
2021-03-30 01:11:17 +00:00
|
|
|
mark_as_advanced(WITH_COMPILER_ASAN)
|
2023-10-19 09:07:06 +00:00
|
|
|
option(WITH_COMPILER_ASAN_EXTERN "\
|
|
|
|
Build `extern` dependencies with address sanitizer when WITH_COMPILER_ASAN is on. \
|
|
|
|
Can cause linking issues due to too large binary size."
|
|
|
|
OFF
|
|
|
|
)
|
2023-10-30 23:42:06 +00:00
|
|
|
mark_as_advanced(WITH_COMPILER_ASAN_EXTERN)
|
2018-05-18 13:21:18 +00:00
|
|
|
|
2024-03-07 08:56:58 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2018-05-18 13:21:18 +00:00
|
|
|
if(WITH_COMPILER_ASAN)
|
|
|
|
set(_asan_defaults "\
|
|
|
|
-fsanitize=address \
|
|
|
|
-fsanitize=bool \
|
|
|
|
-fsanitize=bounds \
|
|
|
|
-fsanitize=enum \
|
|
|
|
-fsanitize=float-cast-overflow \
|
|
|
|
-fsanitize=float-divide-by-zero \
|
|
|
|
-fsanitize=nonnull-attribute \
|
|
|
|
-fsanitize=returns-nonnull-attribute \
|
|
|
|
-fsanitize=signed-integer-overflow \
|
|
|
|
-fsanitize=undefined \
|
|
|
|
-fsanitize=vla-bound \
|
|
|
|
-fno-sanitize=alignment \
|
|
|
|
")
|
|
|
|
|
2020-09-07 18:47:17 +00:00
|
|
|
if(MSVC)
|
|
|
|
# clang-cl doesn't support all sanitizers, but leak and object-size give errors/warnings.
|
|
|
|
set(_asan_defaults "${_asan_defaults}")
|
|
|
|
elseif(APPLE)
|
|
|
|
# AppleClang doesn't support all sanitizers, but leak gives error.
|
2020-09-15 20:46:15 +00:00
|
|
|
# Build type is not known for multi-config generator, so don't add object-size sanitizer.
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
2020-09-07 18:47:17 +00:00
|
|
|
# Silence the warning that object-size is not effective in -O0.
|
|
|
|
set(_asan_defaults "${_asan_defaults}")
|
|
|
|
else()
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND _asan_defaults " -fsanitize=object-size")
|
2020-09-07 18:47:17 +00:00
|
|
|
endif()
|
2023-04-11 12:15:34 +00:00
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC)
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND _asan_defaults " -fsanitize=leak -fsanitize=object-size")
|
2023-04-11 12:15:34 +00:00
|
|
|
else()
|
|
|
|
string(APPEND _asan_defaults " -fsanitize=leak")
|
2018-05-31 17:50:30 +00:00
|
|
|
endif()
|
2020-09-07 18:47:17 +00:00
|
|
|
|
2018-05-18 13:21:18 +00:00
|
|
|
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)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2018-05-18 13:21:18 +00:00
|
|
|
unset(_asan_defaults)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2020-09-07 18:47:17 +00:00
|
|
|
if(MSVC)
|
2022-09-29 02:00:18 +00:00
|
|
|
find_library(
|
|
|
|
COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
|
2018-06-10 06:12:13 +00:00
|
|
|
PATHS
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
|
|
|
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
|
|
|
|
)
|
2023-04-11 12:15:34 +00:00
|
|
|
mark_as_advanced(COMPILER_ASAN_LIBRARY)
|
2020-09-07 18:47:17 +00:00
|
|
|
elseif(APPLE)
|
2020-09-12 22:06:24 +00:00
|
|
|
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
|
|
|
|
-print-file-name=lib
|
2020-09-07 18:47:17 +00:00
|
|
|
OUTPUT_VARIABLE CLANG_LIB_DIR
|
|
|
|
)
|
|
|
|
string(STRIP "${CLANG_LIB_DIR}" CLANG_LIB_DIR)
|
|
|
|
find_library(
|
2020-09-15 20:46:15 +00:00
|
|
|
COMPILER_ASAN_LIBRARY
|
|
|
|
NAMES
|
|
|
|
libclang_rt.asan_osx_dynamic.dylib
|
2020-09-12 22:06:24 +00:00
|
|
|
PATHS
|
2020-09-15 20:46:15 +00:00
|
|
|
"${CLANG_LIB_DIR}/darwin/"
|
2020-09-07 18:47:17 +00:00
|
|
|
)
|
|
|
|
unset(CLANG_LIB_DIR)
|
2023-04-11 12:15:34 +00:00
|
|
|
mark_as_advanced(COMPILER_ASAN_LIBRARY)
|
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC)
|
2020-09-07 18:47:17 +00:00
|
|
|
find_library(
|
|
|
|
COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}
|
|
|
|
)
|
2023-04-11 12:15:34 +00:00
|
|
|
mark_as_advanced(COMPILER_ASAN_LIBRARY)
|
2018-06-10 06:12:13 +00:00
|
|
|
endif()
|
2020-09-07 18:47:17 +00:00
|
|
|
|
2018-05-18 13:21:18 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-03-07 08:56:58 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_COMPILER_SHORT_FILE_MACRO "\
|
|
|
|
Make paths in macros like __FILE__ relative to top level source and build directories."
|
|
|
|
ON
|
|
|
|
)
|
2020-11-02 09:40:10 +00:00
|
|
|
mark_as_advanced(WITH_COMPILER_SHORT_FILE_MACRO)
|
|
|
|
endif()
|
|
|
|
|
2017-03-05 17:05:00 +00:00
|
|
|
if(WIN32)
|
|
|
|
# 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
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WINDOWS_PYTHON_DEBUG "\
|
|
|
|
Include the files needed for debugging python scripts with visual studio 2017+."
|
|
|
|
OFF
|
|
|
|
)
|
2018-10-22 16:17:08 +00:00
|
|
|
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
|
2019-12-06 17:12:03 +00:00
|
|
|
|
|
|
|
option(WITH_WINDOWS_BUNDLE_CRT "Bundle the C runtime for install free distribution." ON)
|
|
|
|
mark_as_advanced(WITH_WINDOWS_BUNDLE_CRT)
|
|
|
|
|
2024-04-18 14:57:04 +00:00
|
|
|
option(WITH_WINDOWS_EXTERNAL_MANIFEST "Use external manifest files" OFF)
|
|
|
|
mark_as_advanced(WITH_WINDOWS_EXTERNAL_MANIFEST)
|
|
|
|
|
2020-04-20 18:51:43 +00:00
|
|
|
option(WITH_WINDOWS_SCCACHE "Use sccache to speed up builds (Ninja builder only)" OFF)
|
|
|
|
mark_as_advanced(WITH_WINDOWS_SCCACHE)
|
|
|
|
|
2023-10-07 08:46:38 +00:00
|
|
|
option(WITH_WINDOWS_RELEASE_PDB "\
|
|
|
|
Generate a pdb file for client side stacktraces for release builds"
|
|
|
|
ON
|
|
|
|
)
|
2023-08-18 16:20:36 +00:00
|
|
|
mark_as_advanced(WITH_WINDOWS_RELEASE_PDB)
|
2020-05-01 13:37:48 +00:00
|
|
|
|
2023-08-18 16:20:36 +00:00
|
|
|
option(WITH_WINDOWS_RELEASE_STRIPPED_PDB "Use a stripped PDB file for release builds" ON)
|
|
|
|
mark_as_advanced(WITH_WINDOWS_RELEASE_STRIPPED_PDB)
|
2020-05-01 13:37:48 +00:00
|
|
|
|
2017-03-05 17:05:00 +00:00
|
|
|
endif()
|
2016-08-31 12:26:05 +00:00
|
|
|
|
2021-08-05 15:49:55 +00:00
|
|
|
if(WIN32 OR XCODE)
|
2023-08-09 14:51:35 +00:00
|
|
|
option(IDE_GROUP_SOURCES_IN_FOLDERS "\
|
|
|
|
Organize the source files in filters matching the source folders."
|
|
|
|
ON
|
|
|
|
)
|
2021-08-05 15:49:55 +00:00
|
|
|
mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(IDE_GROUP_PROJECTS_IN_FOLDERS "\
|
|
|
|
Organize the projects according to source folder structure."
|
|
|
|
ON
|
|
|
|
)
|
2021-08-05 15:49:55 +00:00
|
|
|
mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
|
|
|
|
|
2022-01-28 03:08:11 +00:00
|
|
|
if(IDE_GROUP_PROJECTS_IN_FOLDERS)
|
2021-08-05 15:49:55 +00:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-12-21 05:17:35 +00:00
|
|
|
if(UNIX)
|
|
|
|
# See WITH_WINDOWS_SCCACHE for Windows.
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_COMPILER_CCACHE "\
|
|
|
|
Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)"
|
|
|
|
OFF
|
|
|
|
)
|
2021-02-10 06:42:31 +00:00
|
|
|
mark_as_advanced(WITH_COMPILER_CCACHE)
|
2020-12-21 05:17:35 +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
|
|
|
# The following only works with the Ninja generator in CMake >= 3.0.
|
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Ninja")
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_NINJA_POOL_JOBS "\
|
|
|
|
Enable Ninja pools of jobs, to try to ease building on machines with 16GB of RAM or less \
|
|
|
|
(if not yet defined, will try to set best values based on detected machine specifications)."
|
2024-01-04 15:47:03 +00:00
|
|
|
ON
|
2023-08-09 14:51:35 +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
|
|
|
mark_as_advanced(WITH_NINJA_POOL_JOBS)
|
|
|
|
endif()
|
|
|
|
|
2019-11-07 15:50:31 +00:00
|
|
|
# Installation process.
|
2022-01-19 18:04:25 +00:00
|
|
|
set(POSTINSTALL_SCRIPT "" CACHE FILEPATH "Run given CMake script after installation process")
|
2019-11-07 15:50:31 +00:00
|
|
|
mark_as_advanced(POSTINSTALL_SCRIPT)
|
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
set(POSTCONFIGURE_SCRIPT "" CACHE FILEPATH "\
|
|
|
|
Run given CMake script as the last step of CMake configuration"
|
|
|
|
)
|
2022-01-19 18:45:09 +00:00
|
|
|
mark_as_advanced(POSTCONFIGURE_SCRIPT)
|
|
|
|
|
2014-11-13 22:32:01 +00:00
|
|
|
# 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)
|
2015-12-27 15:57:31 +00:00
|
|
|
if(WIN32)
|
2023-08-09 14:51:35 +00:00
|
|
|
set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "\
|
|
|
|
default install path"
|
|
|
|
FORCE
|
|
|
|
)
|
2014-11-13 13:10:30 +00:00
|
|
|
elseif(APPLE)
|
2023-08-09 14:51:35 +00:00
|
|
|
set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "\
|
|
|
|
default install path"
|
|
|
|
FORCE
|
|
|
|
)
|
2014-11-13 13:10:30 +00:00
|
|
|
else()
|
2014-11-13 14:03:30 +00:00
|
|
|
if(WITH_INSTALL_PORTABLE)
|
|
|
|
set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH} CACHE PATH "default install path" FORCE)
|
2014-11-13 13:10:30 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2014-11-08 10:32:32 +00:00
|
|
|
endif()
|
2014-11-11 20:44:26 +00:00
|
|
|
|
2022-08-18 15:07:10 +00:00
|
|
|
# Effective install path including config folder, as a generator expression.
|
|
|
|
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
|
|
|
if(GENERATOR_IS_MULTI_CONFIG)
|
2023-08-09 14:51:35 +00:00
|
|
|
string(
|
|
|
|
REPLACE "\${BUILD_TYPE}" "$<CONFIG>"
|
|
|
|
CMAKE_INSTALL_PREFIX_WITH_CONFIG ${CMAKE_INSTALL_PREFIX}
|
|
|
|
)
|
2022-08-18 15:07:10 +00:00
|
|
|
else()
|
2023-08-09 14:51:35 +00:00
|
|
|
string(
|
|
|
|
REPLACE "\${BUILD_TYPE}" ""
|
|
|
|
CMAKE_INSTALL_PREFIX_WITH_CONFIG ${CMAKE_INSTALL_PREFIX}
|
|
|
|
)
|
2022-08-18 15:07:10 +00:00
|
|
|
endif()
|
2014-11-08 10:32:32 +00:00
|
|
|
|
|
|
|
|
2014-10-07 20:46:19 +00:00
|
|
|
# Apple
|
|
|
|
|
2010-07-04 18:40:59 +00:00
|
|
|
if(APPLE)
|
2017-04-23 15:42:45 +00:00
|
|
|
include(platform_apple_xcode)
|
2010-06-06 13:32:58 +00:00
|
|
|
endif()
|
|
|
|
|
2012-03-13 22:27:21 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Check for Conflicting/Unsupported Configurations
|
2011-06-08 01:53:12 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
option(WITH_STRICT_BUILD_OPTIONS "\
|
|
|
|
When requirements for a build option are not met, error instead of disabling the option."
|
|
|
|
OFF
|
|
|
|
)
|
2022-09-29 17:01:35 +00:00
|
|
|
|
2022-03-23 15:07:43 +00:00
|
|
|
if(NOT WITH_BLENDER AND NOT WITH_CYCLES_STANDALONE AND NOT WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
2016-05-18 01:58:08 +00:00
|
|
|
message(FATAL_ERROR
|
2018-04-16 13:54:36 +00:00
|
|
|
"At least one of WITH_BLENDER or WITH_CYCLES_STANDALONE "
|
2022-03-23 15:07:43 +00:00
|
|
|
"or WITH_CYCLES_HYDRA_RENDER_DELEGATE "
|
2018-04-16 13:54:36 +00:00
|
|
|
"must be enabled, nothing to do!"
|
2016-05-18 01:58:08 +00:00
|
|
|
)
|
2011-07-13 08:15:06 +00:00
|
|
|
endif()
|
|
|
|
|
2021-03-16 21:32:16 +00:00
|
|
|
set_and_warn_dependency(WITH_AUDASPACE WITH_OPENAL OFF)
|
2021-03-14 11:46:47 +00:00
|
|
|
set_and_warn_dependency(WITH_AUDASPACE WITH_COREAUDIO OFF)
|
2021-03-16 21:32:16 +00:00
|
|
|
set_and_warn_dependency(WITH_AUDASPACE WITH_JACK OFF)
|
2021-03-02 16:29:18 +00:00
|
|
|
set_and_warn_dependency(WITH_AUDASPACE WITH_PULSEAUDIO OFF)
|
2021-03-11 18:22:56 +00:00
|
|
|
set_and_warn_dependency(WITH_AUDASPACE WITH_WASAPI OFF)
|
2011-06-23 09:27:56 +00:00
|
|
|
|
2011-07-13 06:04:54 +00:00
|
|
|
if(NOT WITH_SDL AND WITH_GHOST_SDL)
|
2012-11-12 04:50:45 +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)
|
|
|
|
message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
|
|
|
|
endif()
|
|
|
|
|
2021-03-30 14:58:45 +00:00
|
|
|
set_and_warn_dependency(WITH_PYTHON WITH_CYCLES OFF)
|
|
|
|
set_and_warn_dependency(WITH_PYTHON WITH_DRACO OFF)
|
2022-05-20 01:17:32 +00:00
|
|
|
set_and_warn_dependency(WITH_PYTHON WITH_MOD_FLUID OFF)
|
2013-08-07 22:40:03 +00:00
|
|
|
|
2019-04-12 12:26:17 +00:00
|
|
|
if(WITH_DRACO AND NOT WITH_PYTHON_INSTALL)
|
2021-03-31 19:42:48 +00:00
|
|
|
message(STATUS "WITH_DRACO requires WITH_PYTHON_INSTALL to be ON, disabling WITH_DRACO for now")
|
2019-04-12 12:26:17 +00:00
|
|
|
set(WITH_DRACO OFF)
|
|
|
|
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
|
2020-02-07 14:27:40 +00:00
|
|
|
|
|
|
|
set_and_warn_dependency(WITH_BOOST WITH_INTERNATIONAL OFF)
|
|
|
|
set_and_warn_dependency(WITH_BOOST WITH_OPENVDB OFF)
|
|
|
|
set_and_warn_dependency(WITH_BOOST WITH_QUADRIFLOW OFF)
|
|
|
|
set_and_warn_dependency(WITH_BOOST WITH_USD OFF)
|
2022-05-10 22:38:20 +00:00
|
|
|
if(WITH_CYCLES)
|
2023-01-04 13:32:29 +00:00
|
|
|
set_and_warn_dependency(WITH_BOOST WITH_CYCLES_OSL OFF)
|
2022-05-10 22:38:20 +00:00
|
|
|
set_and_warn_dependency(WITH_PUGIXML WITH_CYCLES_OSL OFF)
|
|
|
|
endif()
|
2020-02-07 14:27:40 +00:00
|
|
|
|
2020-06-05 10:53:38 +00:00
|
|
|
set_and_warn_dependency(WITH_TBB WITH_CYCLES OFF)
|
2020-02-07 14:27:40 +00:00
|
|
|
set_and_warn_dependency(WITH_TBB WITH_USD OFF)
|
|
|
|
set_and_warn_dependency(WITH_TBB WITH_OPENVDB OFF)
|
|
|
|
set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
|
2020-10-02 15:40:28 +00:00
|
|
|
|
|
|
|
# NanoVDB requires OpenVDB to convert the data structure
|
|
|
|
set_and_warn_dependency(WITH_OPENVDB WITH_NANOVDB OFF)
|
2020-02-07 14:27:40 +00:00
|
|
|
|
2023-06-07 05:50:04 +00:00
|
|
|
# OpenVDB, Alembic and OSL uses 'half' or 'imath' from OpenEXR
|
2020-03-03 23:39:53 +00:00
|
|
|
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
|
2023-04-03 07:50:50 +00:00
|
|
|
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_ALEMBIC OFF)
|
|
|
|
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_CYCLES_OSL OFF)
|
2020-03-03 23:39:53 +00:00
|
|
|
|
2023-08-04 13:10:48 +00:00
|
|
|
# Hydra requires USD.
|
|
|
|
set_and_warn_dependency(WITH_USD WITH_HYDRA OFF)
|
|
|
|
|
2024-02-14 11:06:52 +00:00
|
|
|
if(NOT WITH_CYCLES)
|
2015-06-13 23:50:33 +00:00
|
|
|
set(WITH_CYCLES_OSL OFF)
|
2013-03-27 18:44:46 +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)
|
|
|
|
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
|
|
|
endif()
|
|
|
|
|
2023-10-07 09:21:52 +00:00
|
|
|
if(UNIX AND NOT (APPLE OR HAIKU))
|
|
|
|
set_and_warn_incompatible(WITH_HEADLESS WITH_GHOST_WAYLAND OFF)
|
|
|
|
set_and_warn_incompatible(WITH_HEADLESS WITH_GHOST_X11 OFF)
|
|
|
|
endif()
|
2023-10-07 08:11:51 +00:00
|
|
|
set_and_warn_incompatible(WITH_HEADLESS WITH_GHOST_SDL OFF)
|
|
|
|
|
2023-10-18 11:04:25 +00:00
|
|
|
if(WITH_INPUT_IME)
|
2023-10-07 10:22:13 +00:00
|
|
|
set_and_warn_incompatible(WITH_HEADLESS WITH_INPUT_IME OFF)
|
|
|
|
set_and_warn_incompatible(WITH_GHOST_SDL WITH_INPUT_IME OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_and_warn_incompatible(WITH_HEADLESS WITH_XR_OPENXR OFF)
|
2023-10-07 08:11:51 +00:00
|
|
|
set_and_warn_incompatible(WITH_GHOST_SDL WITH_XR_OPENXR OFF)
|
2012-03-13 14:28:58 +00:00
|
|
|
|
2023-10-26 04:19:33 +00:00
|
|
|
if(WITH_UI_TESTS)
|
|
|
|
set_and_warn_dependency(WITH_GHOST_WAYLAND WITH_UI_TESTS OFF)
|
|
|
|
endif()
|
|
|
|
|
2016-03-11 08:05:44 +00:00
|
|
|
if(WITH_BUILDINFO)
|
|
|
|
find_package(Git)
|
2022-09-29 17:01:35 +00:00
|
|
|
set_and_warn_library_found("Git" GIT_FOUND WITH_BUILDINFO)
|
2016-03-11 08:05:44 +00:00
|
|
|
endif()
|
|
|
|
|
2015-06-16 08:03:35 +00:00
|
|
|
if(WITH_AUDASPACE)
|
2017-08-18 06:24:12 +00:00
|
|
|
if(NOT WITH_SYSTEM_AUDASPACE)
|
2023-08-09 14:51:35 +00:00
|
|
|
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"
|
|
|
|
)
|
2015-06-16 08:03:35 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-02-14 09:20:26 +00:00
|
|
|
# Auto-enable CUDA dynload if toolkit is not found.
|
2021-12-07 18:51:39 +00:00
|
|
|
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_CUDA AND NOT WITH_CUDA_DYNLOAD)
|
2018-02-14 09:20:26 +00:00
|
|
|
find_package(CUDA)
|
2019-06-18 21:24:55 +00:00
|
|
|
if(NOT CUDA_FOUND)
|
2022-09-09 01:52:14 +00:00
|
|
|
message(
|
|
|
|
STATUS
|
|
|
|
"CUDA toolkit not found, "
|
|
|
|
"using dynamic runtime loading of libraries (WITH_CUDA_DYNLOAD) instead"
|
|
|
|
)
|
2018-02-14 09:20:26 +00:00
|
|
|
set(WITH_CUDA_DYNLOAD ON)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-09-28 14:51:14 +00:00
|
|
|
if(WITH_CYCLES_DEVICE_HIP)
|
|
|
|
# Currently HIP must be dynamically loaded, this may change in future toolkits
|
|
|
|
set(WITH_HIP_DYNLOAD ON)
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Check if Sub-modules are Cloned
|
2012-03-14 00:30:20 +00:00
|
|
|
|
|
|
|
if(WITH_PYTHON)
|
2017-12-04 05:37:31 +00:00
|
|
|
# While we have this as an '#error' in 'bpy_capi_utils.h',
|
2017-10-08 03:00:42 +00:00
|
|
|
# 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.
|
2024-01-09 11:23:41 +00:00
|
|
|
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.11")
|
2022-09-09 01:52:14 +00:00
|
|
|
message(
|
|
|
|
FATAL_ERROR
|
2024-01-09 11:23:41 +00:00
|
|
|
"At least Python 3.11 is required to build, but found Python ${PYTHON_VERSION}"
|
2022-09-09 01:52:14 +00:00
|
|
|
)
|
2017-10-08 03:00:42 +00:00
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2023-02-21 15:39:58 +00:00
|
|
|
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/scripts/addons")
|
2019-09-05 18:22:52 +00:00
|
|
|
list(LENGTH RESULT DIR_LEN)
|
|
|
|
if(DIR_LEN EQUAL 0)
|
2022-09-09 01:52:14 +00:00
|
|
|
message(
|
|
|
|
WARNING
|
2023-02-21 16:20:03 +00:00
|
|
|
"Addons path '${CMAKE_SOURCE_DIR}/scripts/addons' is missing. "
|
2023-02-21 15:39:58 +00:00
|
|
|
"This is an external repository which needs to be checked out. Use `make update` to do so. "
|
|
|
|
"* CONTINUING WITHOUT ADDONS *"
|
2016-05-18 01:58:08 +00:00
|
|
|
)
|
2012-03-14 00:30:20 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# InitialIze Un-cached Vars, Avoid Unused Warning
|
2011-02-22 06:23:07 +00:00
|
|
|
|
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)
|
|
|
|
|
2022-05-19 00:33:02 +00:00
|
|
|
# NOTE: These flags are intended for situations where where it's impractical to
|
|
|
|
# suppress warnings by modifying the code or for code which is maintained externally.
|
|
|
|
# For GCC this typically means adding `-Wno-*` arguments to negate warnings
|
|
|
|
# that are useful in the general case.
|
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
|
|
|
|
2020-09-15 14:00:15 +00:00
|
|
|
# Libraries to link to targets in setup_platform_linker_libs
|
2011-10-01 19:52:33 +00:00
|
|
|
set(PLATFORM_LINKLIBS "")
|
2011-06-28 02:49:49 +00:00
|
|
|
|
2020-09-15 14:00:15 +00:00
|
|
|
# Added to target linker flags in setup_platform_linker_flags
|
2011-06-28 02:49:49 +00:00
|
|
|
# - CMAKE_EXE_LINKER_FLAGS
|
|
|
|
# - CMAKE_EXE_LINKER_FLAGS_DEBUG
|
2011-10-01 19:52:33 +00:00
|
|
|
set(PLATFORM_LINKFLAGS "")
|
|
|
|
set(PLATFORM_LINKFLAGS_DEBUG "")
|
2023-01-19 06:07:23 +00:00
|
|
|
set(PLATFORM_LINKFLAGS_RELEASE "")
|
|
|
|
set(PLATFORM_LINKFLAGS_EXECUTABLE "")
|
2011-02-22 06:23:07 +00:00
|
|
|
|
2019-06-18 21:24:55 +00:00
|
|
|
if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
|
2018-06-08 09:45:05 +00:00
|
|
|
if(WITH_COMPILER_ASAN)
|
2020-10-08 14:17:45 +00:00
|
|
|
if(NOT APPLE)
|
|
|
|
# Avoid passing address sanitizer compiler flags to `try_compile`.
|
|
|
|
# Since linker flags are not set, all compiler checks and `find_package`
|
|
|
|
# calls that rely on `try_compile` will fail.
|
|
|
|
# See CMP0066 also.
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND CMAKE_C_FLAGS_DEBUG " ${COMPILER_ASAN_CFLAGS}")
|
|
|
|
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " ${COMPILER_ASAN_CFLAGS}")
|
2020-10-08 14:17:45 +00:00
|
|
|
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${COMPILER_ASAN_CXXFLAGS}")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " ${COMPILER_ASAN_CXXFLAGS}")
|
2020-10-08 14:17:45 +00:00
|
|
|
endif()
|
2018-06-08 09:45:05 +00:00
|
|
|
if(MSVC)
|
2018-06-17 18:15:24 +00:00
|
|
|
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
|
2018-06-08 09:45:05 +00:00
|
|
|
endif()
|
2020-09-26 07:35:33 +00:00
|
|
|
|
|
|
|
if(APPLE AND COMPILER_ASAN_LIBRARY)
|
|
|
|
string(REPLACE " " ";" _list_COMPILER_ASAN_CFLAGS ${COMPILER_ASAN_CFLAGS})
|
2020-12-02 08:25:52 +00:00
|
|
|
set(_is_CONFIG_DEBUG "$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>")
|
2020-12-02 07:53:25 +00:00
|
|
|
add_compile_options("$<${_is_CONFIG_DEBUG}:${_list_COMPILER_ASAN_CFLAGS}>")
|
2024-01-03 15:39:05 +00:00
|
|
|
|
|
|
|
# Skip generation of the unwind tables, as they might require a lot of space when sanitizers
|
|
|
|
# are enabled and not fit into the .eh_frame section. Disabling the unwind tables might have
|
|
|
|
# side effects on code which does frame walking, such as
|
|
|
|
# - backtrace()
|
|
|
|
# - __attribute__((__cleanup__(f)))
|
|
|
|
# - __builtin_return_address(n), for n > 0
|
|
|
|
# - pthread_cleanup_push when it is implemented using __attribute__((__cleanup__(f)))
|
|
|
|
# It should not have affect on debugging, since it uses -g flag which generates debugging
|
|
|
|
# tables in the .debug_frame section.
|
|
|
|
# At the time of adding these flags calling backtrace() from C code on Apple M2 did not
|
|
|
|
# affect on the printed backtrace, and exception handling was correct as well.
|
|
|
|
#
|
|
|
|
# Related discussion:
|
2024-03-07 02:26:55 +00:00
|
|
|
# https://stackoverflow.com/questions/26300819
|
2024-01-03 15:39:05 +00:00
|
|
|
add_compile_options("$<${_is_CONFIG_DEBUG}:-fno-unwind-tables>")
|
|
|
|
add_compile_options("$<${_is_CONFIG_DEBUG}:-fno-asynchronous-unwind-tables>")
|
|
|
|
|
|
|
|
add_compile_options("$<${_is_CONFIG_DEBUG}:-fno-omit-frame-pointer>")
|
2020-12-02 07:53:25 +00:00
|
|
|
add_link_options("$<${_is_CONFIG_DEBUG}:-fno-omit-frame-pointer;-fsanitize=address>")
|
2020-09-26 07:35:33 +00:00
|
|
|
unset(_list_COMPILER_ASAN_CFLAGS)
|
2020-12-02 07:53:25 +00:00
|
|
|
unset(_is_CONFIG_DEBUG)
|
2020-09-26 07:35:33 +00:00
|
|
|
elseif(COMPILER_ASAN_LIBRARY)
|
CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.
While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).
Top-level idea: leave it to CMake to keep track of dependency graph.
The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.
It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.
For example, this order will likely fail:
libbf_blenfont.a libfreetype6.a libbf_blenfont.a
This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.
General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.
The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.
Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.
The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:
- Have every library prefixed as "optimized" or "debug" if
separation is needed (non-prefixed libraries will be considered
"generic").
- Loop through libraries passed to function and do simple parsing
which will look for "optimized" and "debug" words and specify
following library to corresponding category.
This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.
Tested the following configurations on Linux, macOS and Windows:
- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer
NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.
Differential Revision: https://developer.blender.org/D6642
2020-01-20 17:36:19 +00:00
|
|
|
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
|
2023-08-17 01:53:56 +00:00
|
|
|
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY}")
|
|
|
|
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY}")
|
|
|
|
if(DEFINED COMPILER_ASAN_LINKER_FLAGS)
|
|
|
|
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${COMPILER_ASAN_LINKER_FLAGS}")
|
|
|
|
set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} ${COMPILER_ASAN_LINKER_FLAGS}")
|
|
|
|
endif()
|
CMake: Refactor external dependencies handling
This is a more correct fix to the issue Brecht was fixing in D6600.
While the fix in that patch worked fine for linking it broke ASAN
runtime under some circumstances.
For example, `make full debug developer` would compile, but trying
to start blender will cause assert failure in ASAN (related on check
that ASAN is not running already).
Top-level idea: leave it to CMake to keep track of dependency graph.
The root of the issue comes to the fact that target like "blender" is
configured to use a lot of static libraries coming from Blender sources
and to use external static libraries. There is nothing which ensures
order between blender's and external libraries. Only order of blender
libraries is guaranteed.
It was possible that due to a cycle or other circumstances some of
blender libraries would have been passed to linker after libraries
it uses, causing linker errors.
For example, this order will likely fail:
libbf_blenfont.a libfreetype6.a libbf_blenfont.a
This change makes it so blender libraries are explicitly provided
their dependencies to an external libraries, which allows CMake to
ensure they are always linked against them.
General rule here: if bf_foo depends on an external library it is
to be provided to LIBS for bf_foo.
For example, if bf_blenkernel depends on opensubdiv then LIBS in
blenkernel's CMakeLists.txt is to include OPENSUBDIB_LIBRARIES.
The change is made based on searching for used include folders
such as OPENSUBDIV_INCLUDE_DIRS and adding corresponding libraries
to LIBS ion that CMakeLists.txt. Transitive dependencies are not
simplified by this approach, but I am not aware of any downside of
this: CMake should be smart enough to simplify them on its side.
And even if not, this shouldn't affect linking time.
Benefit of not relying on transitive dependencies is that build
system is more robust towards future changes. For example, if
bf_intern_opensubiv is no longer depends on OPENSUBDIV_LIBRARIES
and all such code is moved to bf_blenkernel this will not break
linking.
The not-so-trivial part is change to blender_add_lib (and its
version in Cycles). The complexity is caused by libraries being
provided as a single list argument which doesn't allow to use
different release and debug libraries on Windows. The idea is:
- Have every library prefixed as "optimized" or "debug" if
separation is needed (non-prefixed libraries will be considered
"generic").
- Loop through libraries passed to function and do simple parsing
which will look for "optimized" and "debug" words and specify
following library to corresponding category.
This isn't something particularly great. Alternative would be to
use target_link_libraries() directly, which sounds like more code
but which is more explicit and allows to have more flexibility
and control comparing to wrapper approach.
Tested the following configurations on Linux, macOS and Windows:
- make full debug developer
- make full release developer
- make lite debug developer
- make lite release developer
NOTE: Linux libraries needs to be compiled with D6641 applied,
otherwise, depending on configuration, it's possible to run into
duplicated zlib symbols error.
Differential Revision: https://developer.blender.org/D6642
2020-01-20 17:36:19 +00:00
|
|
|
endif()
|
2018-05-31 17:50:30 +00:00
|
|
|
endif()
|
2018-05-18 13:21:18 +00:00
|
|
|
endif()
|
2011-02-22 06:23:07 +00:00
|
|
|
|
2021-03-01 18:15:29 +00:00
|
|
|
# Test SIMD support, before platform includes to determine if sse2neon is needed.
|
|
|
|
if(WITH_CPU_SIMD)
|
2024-04-11 18:46:14 +00:00
|
|
|
set(COMPILER_SSE42_FLAG)
|
2021-03-01 18:15:29 +00:00
|
|
|
|
|
|
|
# Test Neon first since macOS Arm can compile and run x86-64 SSE binaries.
|
2022-09-23 04:33:44 +00:00
|
|
|
test_neon_support()
|
2021-03-01 18:15:29 +00:00
|
|
|
if(NOT SUPPORT_NEON_BUILD)
|
2024-04-11 18:46:14 +00:00
|
|
|
test_sse_support(COMPILER_SSE42_FLAG)
|
2021-03-01 18:15:29 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
2015-07-28 07:47:21 +00:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Main Platform Checks
|
|
|
|
#
|
|
|
|
# - UNIX
|
|
|
|
# - WIN32
|
|
|
|
# - APPLE
|
|
|
|
|
2009-07-03 09:23:12 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2016-08-09 13:19:11 +00:00
|
|
|
include(platform_unix)
|
2010-11-21 13:41:43 +00:00
|
|
|
elseif(WIN32)
|
2016-08-09 13:19:11 +00:00
|
|
|
include(platform_win32)
|
2010-11-21 13:41:43 +00:00
|
|
|
elseif(APPLE)
|
2016-08-09 13:19:11 +00:00
|
|
|
include(platform_apple)
|
2010-11-21 13:41:43 +00:00
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Common Checks for Compatible Options
|
2010-08-11 08:23:48 +00:00
|
|
|
|
2012-12-05 15:46:31 +00:00
|
|
|
if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
|
|
|
|
message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
|
|
|
|
endif()
|
|
|
|
|
2012-11-11 16:54:26 +00:00
|
|
|
if(WITH_INTERNATIONAL)
|
|
|
|
if(NOT WITH_BOOST)
|
2022-09-09 01:52:14 +00:00
|
|
|
message(
|
|
|
|
FATAL_ERROR
|
2016-05-18 01:58:08 +00:00
|
|
|
"Internationalization requires WITH_BOOST, the library may not have been found. "
|
|
|
|
"Configure BOOST or disable WITH_INTERNATIONAL"
|
|
|
|
)
|
2012-11-11 16:54:26 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2012-07-01 15:26:25 +00:00
|
|
|
|
2022-09-23 04:33:44 +00:00
|
|
|
# Enable SIMD support if detected by `test_sse_support()` or `test_neon_support()`.
|
2021-02-14 03:16:39 +00:00
|
|
|
#
|
|
|
|
if(WITH_CPU_SIMD)
|
|
|
|
if(SUPPORT_NEON_BUILD)
|
|
|
|
# Neon
|
|
|
|
if(SSE2NEON_FOUND)
|
2022-09-18 05:41:13 +00:00
|
|
|
include_directories(SYSTEM "${SSE2NEON_INCLUDE_DIRS}")
|
2021-02-14 03:16:39 +00:00
|
|
|
add_definitions(-DWITH_SSE2NEON)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
# SSE
|
2024-04-11 18:46:14 +00:00
|
|
|
if(SUPPORT_SSE42_BUILD)
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS " ${COMPILER_SSE42_FLAG}")
|
|
|
|
string(APPEND CMAKE_C_FLAGS " ${COMPILER_SSE42_FLAG}")
|
|
|
|
# MSVC doesn't define any of these and only does the AVX and higher flags.
|
|
|
|
# For consistency we define these flags for MSVC.
|
|
|
|
if(WIN32)
|
|
|
|
add_compile_definitions(
|
|
|
|
__MMX__
|
|
|
|
__SSE__
|
|
|
|
__SSE2__
|
|
|
|
__SSE3__
|
|
|
|
__SSE4_1__
|
|
|
|
__SSE4_2__
|
|
|
|
)
|
2021-02-14 03:16:39 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2010-08-11 08:23:48 +00:00
|
|
|
endif()
|
2023-10-07 07:20:30 +00:00
|
|
|
endif()
|
2010-12-08 08:43:06 +00:00
|
|
|
|
2023-10-07 07:20:30 +00:00
|
|
|
# Print instructions used on first run.
|
|
|
|
if(FIRST_RUN)
|
|
|
|
if(WITH_CPU_SIMD)
|
|
|
|
if(SUPPORT_NEON_BUILD)
|
|
|
|
if(SSE2NEON_FOUND)
|
|
|
|
message(STATUS "Neon SIMD instructions enabled")
|
|
|
|
else()
|
|
|
|
message(STATUS "Neon SIMD instructions detected but unused, requires sse2neon")
|
|
|
|
endif()
|
2024-04-11 18:46:14 +00:00
|
|
|
elseif(SUPPORT_SSE42_BUILD)
|
|
|
|
message(STATUS "SSE42 SIMD instructions enabled")
|
2021-02-14 03:16:39 +00:00
|
|
|
else()
|
2023-10-07 07:20:30 +00:00
|
|
|
message(STATUS "No SIMD instructions detected")
|
2021-02-14 03:16:39 +00:00
|
|
|
endif()
|
|
|
|
else()
|
2023-10-07 07:20:30 +00:00
|
|
|
message(STATUS "SIMD instructions disabled")
|
2021-02-14 03:16:39 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2011-09-19 08:02:17 +00:00
|
|
|
|
|
|
|
# set the endian define
|
2012-08-07 12:03:43 +00:00
|
|
|
if(MSVC)
|
2011-09-27 01:32:27 +00:00
|
|
|
# for some reason this fails on msvc
|
2011-09-19 08:02:17 +00:00
|
|
|
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,
|
2021-11-19 11:44:27 +00:00
|
|
|
# endianness-detection and auto-setting is counterproductive
|
2019-06-18 21:24:55 +00:00
|
|
|
# so we just set endianness according CMAKE_OSX_ARCHITECTURES
|
2012-08-07 13:51:19 +00:00
|
|
|
|
2023-08-09 14:51:35 +00:00
|
|
|
elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR
|
|
|
|
CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR
|
|
|
|
CMAKE_OSX_ARCHITECTURES MATCHES arm64)
|
2012-08-07 13:51:19 +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)
|
2012-08-07 13:51:19 +00:00
|
|
|
add_definitions(-D__BIG_ENDIAN__)
|
2017-04-27 11:40:18 +00:00
|
|
|
|
2011-09-27 01:32:27 +00:00
|
|
|
else()
|
|
|
|
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-08-03 11:25:34 +00:00
|
|
|
if(WITH_IMAGE_OPENJPEG)
|
2015-09-17 09:17:00 +00:00
|
|
|
# Special handling of Windows platform where openjpeg is always static.
|
|
|
|
if(WIN32)
|
|
|
|
set(OPENJPEG_DEFINES "-DOPJ_STATIC")
|
2018-08-30 12:20:19 +00:00
|
|
|
else()
|
|
|
|
set(OPENJPEG_DEFINES "")
|
2015-09-17 09:17:00 +00:00
|
|
|
endif()
|
2010-08-03 11:25:34 +00:00
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2015-03-19 04:41:41 +00:00
|
|
|
if(NOT WITH_SYSTEM_EIGEN3)
|
|
|
|
set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3)
|
|
|
|
endif()
|
2008-10-07 17:13:35 +00:00
|
|
|
|
2020-02-26 14:11:24 +00:00
|
|
|
if(WITH_OPENVDB)
|
|
|
|
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB)
|
|
|
|
|
|
|
|
if(WITH_OPENVDB_3_ABI_COMPATIBLE)
|
|
|
|
list(APPEND OPENVDB_DEFINITIONS -DOPENVDB_3_ABI_COMPATIBLE)
|
|
|
|
endif()
|
|
|
|
|
2021-02-10 17:17:23 +00:00
|
|
|
# OpenVDB headers use deprecated TBB headers, silence warning.
|
|
|
|
list(APPEND OPENVDB_DEFINITIONS -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
|
|
|
|
|
2020-02-26 14:11:24 +00:00
|
|
|
list(APPEND OPENVDB_INCLUDE_DIRS
|
|
|
|
${BOOST_INCLUDE_DIR}
|
|
|
|
${TBB_INCLUDE_DIRS}
|
2022-08-09 03:36:45 +00:00
|
|
|
${OPENEXR_INCLUDE_DIRS}
|
|
|
|
)
|
2020-02-26 14:11:24 +00:00
|
|
|
|
|
|
|
list(APPEND OPENVDB_LIBRARIES ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
|
|
|
|
|
|
|
|
if(WITH_OPENVDB_BLOSC)
|
|
|
|
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB_BLOSC)
|
2023-08-17 01:53:56 +00:00
|
|
|
# Even when `WITH_OPENVDB_BLOSC` is set, `FindBlosc.cmake` isn't running.
|
|
|
|
# As this might be used at some point, check the libraries are defined.
|
|
|
|
if(DEFINED BLOSC_LIBRARIES)
|
|
|
|
list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
list(APPEND OPENVDB_LIBRARIES ${ZLIB_LIBRARIES})
|
2020-02-26 14:11:24 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND OPENVDB_LIBRARIES ${BOOST_LIBRARIES} ${TBB_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Configure Metal
|
|
|
|
|
2022-08-09 03:36:45 +00:00
|
|
|
if(WITH_METAL_BACKEND)
|
2022-03-22 11:38:28 +00:00
|
|
|
add_definitions(-DWITH_METAL_BACKEND)
|
|
|
|
|
|
|
|
# No need to add frameworks here, all the ones we need for Metal and
|
|
|
|
# Metal-OpenGL Interop are already being added by
|
|
|
|
# build_files/cmake/platform/platform_apple.cmake
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Configure OpenMP
|
|
|
|
|
2014-07-07 22:29:53 +00:00
|
|
|
if(WITH_OPENMP)
|
2019-01-26 13:14:51 +00:00
|
|
|
if(NOT OPENMP_CUSTOM)
|
|
|
|
find_package(OpenMP)
|
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2022-09-29 17:01:35 +00:00
|
|
|
set_and_warn_library_found("OpenMP" OPENMP_FOUND WITH_OPENMP)
|
|
|
|
|
2010-11-19 11:33:12 +00:00
|
|
|
if(OPENMP_FOUND)
|
2015-12-02 13:09:06 +00:00
|
|
|
if(NOT WITH_OPENMP_STATIC)
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
|
2024-03-01 05:22:06 +00:00
|
|
|
if(DEFINED OpenMP_LINKER_FLAGS)
|
|
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
|
|
|
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${OpenMP_LINKER_FLAGS}")
|
|
|
|
endif()
|
2015-12-02 13:09:06 +00:00
|
|
|
else()
|
|
|
|
# Typically avoid adding flags as defines but we can't
|
2016-01-05 14:41:08 +00:00
|
|
|
# pass OpenMP flags to the linker for static builds, meaning
|
2015-12-02 13:09:06 +00:00
|
|
|
# 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}")
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2015-12-03 10:34:41 +00:00
|
|
|
find_library_static(OpenMP_LIBRARIES gomp ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
|
2023-07-10 02:02:15 +00:00
|
|
|
mark_as_advanced(
|
|
|
|
OpenMP_LIBRARIES
|
|
|
|
)
|
2015-12-02 13:09:06 +00:00
|
|
|
endif()
|
2010-11-19 11:33:12 +00:00
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-09-30 15:51:58 +00:00
|
|
|
mark_as_advanced(
|
|
|
|
OpenMP_C_FLAGS
|
|
|
|
OpenMP_CXX_FLAGS
|
|
|
|
)
|
|
|
|
endif()
|
2010-11-19 11:33:12 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
2013-01-03 00:23:52 +00:00
|
|
|
# Configure Bullet
|
|
|
|
|
2023-01-19 06:07:21 +00:00
|
|
|
if(WITH_BULLET)
|
|
|
|
if(WITH_SYSTEM_BULLET)
|
|
|
|
find_package(Bullet)
|
|
|
|
set_and_warn_library_found("Bullet" BULLET_FOUND WITH_BULLET)
|
|
|
|
else()
|
|
|
|
set(BULLET_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/bullet2/src")
|
|
|
|
set(BULLET_LIBRARIES "extern_bullet")
|
|
|
|
endif()
|
2013-01-03 00:23:52 +00:00
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Configure Python
|
2011-03-24 00:14:49 +00:00
|
|
|
|
2023-10-07 08:28:36 +00:00
|
|
|
# Not currently supported due to different required Python link flags.
|
|
|
|
set_and_warn_incompatible(WITH_PYTHON_MODULE WITH_GTESTS OFF)
|
2011-03-24 00:14:49 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Configure `GLog/GFlags`
|
2016-01-04 11:47:36 +00:00
|
|
|
|
|
|
|
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
|
2017-04-21 08:58:01 +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()
|
2022-09-13 03:46:51 +00:00
|
|
|
# `FindGflags` does not define this, and we are not even sure what to use here.
|
2017-04-21 08:58:01 +00:00
|
|
|
set(GFLAGS_DEFINES)
|
|
|
|
else()
|
|
|
|
set(GFLAGS_DEFINES
|
|
|
|
-DGFLAGS_DLL_DEFINE_FLAG=
|
|
|
|
-DGFLAGS_DLL_DECLARE_FLAG=
|
|
|
|
-DGFLAGS_DLL_DECL=
|
|
|
|
)
|
|
|
|
set(GFLAGS_NAMESPACE "gflags")
|
|
|
|
set(GFLAGS_LIBRARIES extern_gflags)
|
|
|
|
set(GFLAGS_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/extern/gflags/src")
|
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2017-04-21 12:26:25 +00:00
|
|
|
if(WITH_SYSTEM_GLOG)
|
|
|
|
find_package(Glog)
|
|
|
|
if(NOT GLOG_FOUND)
|
|
|
|
message(FATAL_ERROR "System wide Glog is requested but was not found")
|
|
|
|
endif()
|
2022-09-13 03:46:51 +00:00
|
|
|
# `FindGlog` does not define this, and we are not even sure what to use here.
|
2017-04-21 12:26:25 +00:00
|
|
|
set(GLOG_DEFINES)
|
|
|
|
else()
|
|
|
|
set(GLOG_DEFINES
|
|
|
|
-DGOOGLE_GLOG_DLL_DECL=
|
|
|
|
)
|
|
|
|
set(GLOG_LIBRARIES extern_glog)
|
|
|
|
if(WIN32)
|
|
|
|
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src/windows)
|
|
|
|
else()
|
2018-03-23 13:32:18 +00:00
|
|
|
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/include)
|
2017-04-21 12:26:25 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2016-01-04 11:47:36 +00:00
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Ninja Job Limiting
|
|
|
|
|
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.
|
2022-09-13 03:46:51 +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
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Ninja" AND WITH_NINJA_POOL_JOBS)
|
|
|
|
if(NOT NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS AND
|
|
|
|
NOT NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS AND
|
|
|
|
NOT NINJA_MAX_NUM_PARALLEL_LINK_JOBS)
|
|
|
|
# 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)
|
|
|
|
|
2024-01-05 11:22:00 +00:00
|
|
|
# Heuristics: Assume 8Gb of RAM is needed per heavy compile job.
|
|
|
|
# Typical RAM peak usage of these is actually less than 3GB currently,
|
|
|
|
# but this also accounts for the part of the physical RAM being used by other unrelated
|
|
|
|
# processes on the system, and the part being used by the 'regular' compile and linking jobs.
|
|
|
|
#
|
2024-03-07 02:26:55 +00:00
|
|
|
# Also always cap heavy jobs amount to `number of available threads - 1`,
|
|
|
|
# to ensure that even if there would be enough RAM, the machine never ends up
|
|
|
|
# handling only heavy jobs at some point.
|
|
|
|
# This can have annoying sides effects, like lack of output in the console for several
|
|
|
|
# minutes, which can lead to a wrong detection of 'unresponsive' state by the build-bots e.g.
|
2024-01-05 11:22:00 +00:00
|
|
|
#
|
2024-03-07 02:26:55 +00:00
|
|
|
# Currently, these settings applied to a 64GB/16threads linux machine will use,
|
|
|
|
# for a full build:
|
2024-01-05 11:22:00 +00:00
|
|
|
# - release build:
|
|
|
|
# * RAM: typically less than 20%, with some peaks at 25%.
|
|
|
|
# * CPU: over 90% of usage on average over the whole build time.
|
|
|
|
# - debug with ASAN build:
|
|
|
|
# * RAM: typically less than 40%, with some peaks at 50%.
|
|
|
|
# * CPU: over 90% of usage on average over the whole build time.
|
|
|
|
math(EXPR _compile_heavy_jobs "${_TOT_MEM} / 8000")
|
|
|
|
math(EXPR _compile_heavy_jobs_max "${_NUM_CORES} - 1")
|
|
|
|
if(${_compile_heavy_jobs} GREATER ${_compile_heavy_jobs_max})
|
2024-01-05 11:51:47 +00:00
|
|
|
set(_compile_heavy_jobs ${_compile_heavy_jobs_max})
|
2024-01-05 11:22:00 +00:00
|
|
|
elseif(${_compile_heavy_jobs} LESS 1)
|
|
|
|
set(_compile_heavy_jobs 1)
|
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
|
|
|
endif()
|
2023-08-09 14:51:35 +00:00
|
|
|
set(NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS "${_compile_heavy_jobs}" CACHE STRING "\
|
|
|
|
Define the maximum number of concurrent heavy compilation jobs, for ninja build system \
|
|
|
|
(used for some targets which cpp files can take several GB each during compilation)."
|
|
|
|
FORCE
|
|
|
|
)
|
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
|
|
|
mark_as_advanced(NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
|
|
|
|
set(_compile_heavy_jobs)
|
2024-01-05 11:51:47 +00:00
|
|
|
set(_compile_heavy_jobs_max)
|
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
|
|
|
|
2024-01-05 11:51:47 +00:00
|
|
|
# Heuristics: Assume 2Gb of RAM is needed per heavy compile job.
|
|
|
|
# Typical RAM peak usage of these is actually way less than 1GB usually,
|
|
|
|
# but this also accounts for the part of the physical RAM being used by other unrelated
|
|
|
|
# processes on the system, and the part being used by the 'heavy' compile and linking jobs.
|
|
|
|
#
|
|
|
|
# If there are 'enough' cores available, cap the maximum number of regular jobs to
|
|
|
|
# `number of cores - 1`, otherwise allow using all cores if there is enough RAM available.
|
2024-01-05 11:22:00 +00:00
|
|
|
# This allows to ensure that the heavy jobs won't get starved by too many normal jobs,
|
|
|
|
# since the former usually take a long time to process.
|
2024-01-05 11:51:47 +00:00
|
|
|
math(EXPR _compile_jobs "${_TOT_MEM} / 2000")
|
|
|
|
if(${_NUM_CORES} GREATER 3)
|
|
|
|
math(EXPR _compile_jobs_max "${_NUM_CORES} - 1")
|
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
|
|
|
else()
|
2024-01-05 11:51:47 +00:00
|
|
|
set(_compile_jobs_max ${_NUM_CORES})
|
|
|
|
endif()
|
|
|
|
if(${_compile_jobs} GREATER ${_compile_jobs_max})
|
|
|
|
set(_compile_jobs ${_compile_jobs_max})
|
|
|
|
elseif(${_compile_jobs} LESS 1)
|
|
|
|
set(_compile_jobs 1)
|
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
|
|
|
endif()
|
|
|
|
set(NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS "${_compile_jobs}" CACHE STRING
|
|
|
|
"Define the maximum number of concurrent compilation jobs, for ninja build system." FORCE)
|
|
|
|
mark_as_advanced(NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS)
|
|
|
|
set(_compile_jobs)
|
2024-01-05 11:51:47 +00:00
|
|
|
set(_compile_jobs_max)
|
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
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# In practice, even when there is RAM available,
|
|
|
|
# this proves to be quicker than running in parallel (due to slow disks accesses).
|
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
|
|
|
set(NINJA_MAX_NUM_PARALLEL_LINK_JOBS "1" CACHE STRING
|
|
|
|
"Define the maximum number of concurrent link jobs, for ninja build system." FORCE)
|
|
|
|
mark_as_advanced(NINJA_MAX_NUM_PARALLEL_LINK_JOBS)
|
|
|
|
|
|
|
|
set(_NUM_CORES)
|
|
|
|
set(_TOT_MEM)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS)
|
2023-08-09 14:51:35 +00:00
|
|
|
set_property(
|
|
|
|
GLOBAL APPEND PROPERTY
|
|
|
|
JOB_POOLS compile_job_pool=${NINJA_MAX_NUM_PARALLEL_COMPILE_JOBS}
|
|
|
|
)
|
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
|
|
|
set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
|
2023-08-09 14:51:35 +00:00
|
|
|
set_property(
|
|
|
|
GLOBAL APPEND PROPERTY
|
|
|
|
JOB_POOLS compile_heavy_job_pool=${NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS}
|
|
|
|
)
|
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
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NINJA_MAX_NUM_PARALLEL_LINK_JOBS)
|
2023-08-09 14:51:35 +00:00
|
|
|
set_property(
|
|
|
|
GLOBAL APPEND PROPERTY
|
|
|
|
JOB_POOLS link_job_pool=${NINJA_MAX_NUM_PARALLEL_LINK_JOBS}
|
|
|
|
)
|
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
|
|
|
set(CMAKE_JOB_POOL_LINK link_job_pool)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Extra Compile Flags
|
2010-10-18 12:35:40 +00:00
|
|
|
|
2010-10-17 06:38:56 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2010-12-16 09:55:35 +00:00
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_WARNINGS
|
|
|
|
|
|
|
|
C_WARN_ALL -Wall
|
|
|
|
C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration
|
|
|
|
|
|
|
|
# System headers sometimes do this, disable for now, was: `-Werror=strict-prototypes`.
|
|
|
|
C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes
|
|
|
|
|
|
|
|
C_WARN_ERROR_RETURN_TYPE -Werror=return-type
|
|
|
|
C_WARN_ERROR_VLA -Werror=vla
|
|
|
|
C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes
|
|
|
|
C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts
|
|
|
|
C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas
|
|
|
|
C_WARN_POINTER_ARITH -Wpointer-arith
|
|
|
|
C_WARN_UNUSED_PARAMETER -Wunused-parameter
|
|
|
|
C_WARN_WRITE_STRINGS -Wwrite-strings
|
|
|
|
C_WARN_LOGICAL_OP -Wlogical-op
|
|
|
|
C_WARN_UNDEF -Wundef
|
|
|
|
|
|
|
|
# Needs: `-Wuninitialized`.
|
|
|
|
C_WARN_INIT_SELF -Winit-self
|
|
|
|
|
|
|
|
C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs
|
|
|
|
C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero
|
|
|
|
C_WARN_TYPE_LIMITS -Wtype-limits
|
|
|
|
C_WARN_FORMAT_SIGN -Wformat-signedness
|
|
|
|
C_WARN_RESTRICT -Wrestrict
|
|
|
|
|
|
|
|
# Useful but too many false positives and inconvenient to suppress each occurrence.
|
|
|
|
C_WARN_NO_STRINGOP_OVERREAD -Wno-stringop-overread
|
|
|
|
C_WARN_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow
|
|
|
|
|
|
|
|
# C-only.
|
|
|
|
C_WARN_NO_NULL -Wnonnull
|
|
|
|
C_WARN_ABSOLUTE_VALUE -Wabsolute-value
|
|
|
|
|
|
|
|
C_WARN_UNINITIALIZED -Wuninitialized
|
|
|
|
C_WARN_REDUNDANT_DECLS -Wredundant-decls
|
|
|
|
C_WARN_SHADOW -Wshadow
|
|
|
|
|
|
|
|
# Disable because it gives warnings for printf() & friends.
|
|
|
|
# C_WARN_DOUBLE_PROMOTION "-Wdouble-promotion -Wno-error=double-promotion"
|
|
|
|
|
|
|
|
# Use `ATTR_FALLTHROUGH` macro to suppress.
|
|
|
|
C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5
|
|
|
|
)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2012-01-01 16:46:08 +00:00
|
|
|
if(NOT APPLE)
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_WARNINGS
|
|
|
|
C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable
|
|
|
|
)
|
2012-01-01 16:46:08 +00:00
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_WARNINGS
|
|
|
|
|
|
|
|
CXX_WARN_UNINITIALIZED -Wuninitialized
|
|
|
|
CXX_WARN_REDUNDANT_DECLS -Wredundant-decls
|
|
|
|
|
|
|
|
CXX_WARN_ALL -Wall
|
|
|
|
CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof
|
|
|
|
CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare
|
|
|
|
CXX_WARN_LOGICAL_OP -Wlogical-op
|
|
|
|
|
|
|
|
# Needs: `-Wuninitialized`.
|
|
|
|
CXX_WARN_INIT_SELF -Winit-self
|
|
|
|
|
|
|
|
CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs
|
|
|
|
CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero
|
|
|
|
CXX_WARN_TYPE_LIMITS -Wtype-limits
|
|
|
|
CXX_WARN_ERROR_RETURN_TYPE -Werror=return-type
|
|
|
|
CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts
|
|
|
|
CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas
|
|
|
|
CXX_WARN_POINTER_ARITH -Wpointer-arith
|
|
|
|
CXX_WARN_UNUSED_PARAMETER -Wunused-parameter
|
|
|
|
CXX_WARN_WRITE_STRINGS -Wwrite-strings
|
|
|
|
CXX_WARN_UNDEF -Wundef
|
2023-08-17 13:13:41 +00:00
|
|
|
CXX_WARN_COMMA_SUBSCRIPT -Wcomma-subscript
|
2023-08-10 01:28:22 +00:00
|
|
|
CXX_WARN_FORMAT_SIGN -Wformat-signedness
|
|
|
|
CXX_WARN_RESTRICT -Wrestrict
|
|
|
|
CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override
|
|
|
|
CXX_WARN_UNINITIALIZED -Wuninitialized
|
|
|
|
|
2023-12-08 05:22:18 +00:00
|
|
|
# NOTE(@ideasman42): In GCC 13.2.1 on Linux this causes internal compiler errors.
|
|
|
|
# The crashes can be resolved by disabling the flag per module (but not via pragmas).
|
|
|
|
# However this also causes a type mix-up FreeStyle (Blender & FreeStyle's `Curve`)
|
|
|
|
# so it seems to impact GCC's the internal state enough that it's too risky to enable.
|
|
|
|
# When this is resolved the check can be enabled for fixed GCC versions.
|
|
|
|
#
|
|
|
|
# Prevents linking errors with MSVC.
|
|
|
|
# `CXX_WARN_MISMATCHED_TAGS -Wmismatched-tags`
|
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
# Useful but too many false positives and inconvenient to suppress each occurrence.
|
|
|
|
CXX_WARN_NO_STRINGOP_OVERREAD -Wno-stringop-overread
|
|
|
|
CXX_WARN_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow
|
|
|
|
|
|
|
|
# Use `[[fallthrough]]` or `ATTR_FALLTHROUGH` macro to suppress.
|
|
|
|
CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5
|
|
|
|
)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2012-10-01 16:45:50 +00:00
|
|
|
# causes too many warnings
|
|
|
|
if(NOT APPLE)
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_WARNINGS
|
|
|
|
CXX_WARN_UNDEF -Wundef
|
|
|
|
CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations
|
|
|
|
)
|
2012-10-01 16:45:50 +00:00
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# ---------------------
|
2022-05-19 00:33:02 +00:00
|
|
|
# Suppress Strict Flags
|
|
|
|
#
|
|
|
|
# Exclude the following warnings from this list:
|
|
|
|
# - `-Wno-address`:
|
|
|
|
# This can give useful hints that point to bugs/misleading logic.
|
|
|
|
# - `-Wno-strict-prototypes`:
|
|
|
|
# No need to support older C-style prototypes.
|
|
|
|
#
|
|
|
|
# If code in `./extern/` needs to suppress these flags that can be done on a case-by-case basis.
|
|
|
|
|
2011-10-30 04:48:00 +00:00
|
|
|
# flags to undo strict flags
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_REMOVE_STRICT_FLAGS
|
|
|
|
|
|
|
|
C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations
|
|
|
|
C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter
|
|
|
|
C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function
|
|
|
|
C_WARN_NO_TYPE_LIMITS -Wno-type-limits
|
|
|
|
C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context
|
|
|
|
C_WARN_NO_FORMAT -Wno-format
|
|
|
|
C_WARN_NO_SWITCH -Wno-switch
|
|
|
|
C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable
|
|
|
|
C_WARN_NO_UNUSED_VARIABLE -Wno-uninitialized
|
|
|
|
C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_REMOVE_STRICT_FLAGS
|
|
|
|
|
|
|
|
CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess
|
|
|
|
CXX_WARN_NO_COMMENT -Wno-comment
|
|
|
|
CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs
|
|
|
|
CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable
|
|
|
|
CXX_WARN_NO_UNUSED_VARIABLE -Wno-uninitialized
|
|
|
|
)
|
|
|
|
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2012-01-01 16:46:08 +00:00
|
|
|
if(NOT APPLE)
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_REMOVE_STRICT_FLAGS
|
|
|
|
C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable
|
|
|
|
)
|
2012-01-01 16:46:08 +00:00
|
|
|
endif()
|
2011-10-30 04:48:00 +00:00
|
|
|
|
2024-03-07 08:56:58 +00:00
|
|
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
|
|
# Matches both "Clang" & "AppleClang" on macOS.
|
2012-06-11 12:13:41 +00:00
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_WARNINGS
|
|
|
|
|
|
|
|
# Strange, clang complains these are not supported, but then uses them.
|
|
|
|
C_WARN_ALL -Wall
|
|
|
|
C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration
|
|
|
|
C_WARN_ERROR_RETURN_TYPE -Werror=return-type
|
|
|
|
C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare
|
|
|
|
C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas
|
|
|
|
C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts
|
|
|
|
C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes
|
|
|
|
C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes
|
|
|
|
C_WARN_UNUSED_PARAMETER -Wunused-parameter
|
|
|
|
C_WARN_UNDEF -Wundef
|
|
|
|
C_WARN_UNDEF_PREFIX -Wundef-prefix
|
|
|
|
|
|
|
|
C_WARN_ERROR_UNGUARDED_AVAILABILITY_NEW -Werror=unguarded-availability-new
|
|
|
|
)
|
|
|
|
|
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_WARNINGS
|
|
|
|
|
|
|
|
CXX_WARN_ALL -Wall
|
|
|
|
# Using C++20 features while having C++17 as the project language isn't allowed by MSVC.
|
|
|
|
CXX_CXX20_DESIGNATOR -Wc++20-designator
|
|
|
|
|
|
|
|
CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare
|
|
|
|
CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas
|
|
|
|
CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts
|
|
|
|
|
|
|
|
# We get a lot of these, if its a problem a dev needs to look into it.
|
|
|
|
CXX_WARN_NO_OVERLOADED_VIRTUAL -Wno-overloaded-virtual
|
|
|
|
|
|
|
|
CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare
|
|
|
|
CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof
|
|
|
|
|
|
|
|
# Apple Clang (tested on version 12) doesn't support this flag while LLVM Clang 11 does.
|
|
|
|
CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override
|
|
|
|
|
|
|
|
CXX_WARN_UNDEF -Wundef
|
|
|
|
CXX_WARN_UNDEF_PREFIX -Wundef-prefix
|
|
|
|
CXX_WARN_UNUSED_PARAMETER -Wunused-parameter
|
|
|
|
|
2023-12-08 05:22:18 +00:00
|
|
|
# Prevents linking errors with MSVC.
|
|
|
|
CXX_WARN_MISMATCHED_TAGS -Wmismatched-tags
|
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
# Gives too many unfixable warnings.
|
|
|
|
# `C_WARN_UNUSED_MACROS -Wunused-macros`
|
|
|
|
# `CXX_WARN_UNUSED_MACROS -Wunused-macros`
|
|
|
|
|
|
|
|
CXX_WARN_ERROR_UNGUARDED_AVAILABILITY_NEW -Werror=unguarded-availability-new
|
|
|
|
)
|
CMake: Windows: suppress Clang-cl warnings
Building with clang on windows isn't an officially supported scenario
but it's something we'd like to keep working, but as it doesn't see
regular use, things tend to bit rot a bit.
0136289cb6 got things back into somewhat working order however the build
log came in at a little over 5.5GiB emitting a total of 11.787.294
warnings (827.847 unique), it was getting to the point where printing
all warnings, was a rather significant contributor to the total build
time.
this PR, suppress every single warning out of that build, one could
argue that some of these warnings are actually genuine and should be
enabled, and dealt with, the thing is, building with clang isn't
supported as of now and I honestly lack the time right now to sift
though this barrage of data.
given MSVC, Clang on mac and GCC on linux currently all build without
warnings, having clang on windows match that baseline seems like a
reasonable thing to do.
I left some notes in cmake flagging the potential cleanup, and added
counts of how often each warn occurred (The one off warns are much more
likely to lead to a genuine bug fix than the ones that produce a whole
lot of noise) so if someone wants to spend some effort they can do so
effectively.
The suppression is guarded with clang on windows specific guard and
should not affect any other platforms.
Pull Request: https://projects.blender.org/blender/blender/pulls/121085
2024-04-25 18:32:20 +00:00
|
|
|
if(MSVC_CLANG)
|
|
|
|
# clang-cl produces an unhealthy ammount of warnings in its default
|
|
|
|
# configuration as it for reasons unknown decided to enable all
|
|
|
|
# warnings known to mankind. Resulting in a 5.5GB build log containing
|
|
|
|
# well over 11 million warnings. The code below disables every single
|
|
|
|
# one of them indiscriminately. Someone with time on their hands,
|
|
|
|
# could/should go over these and either fix them or describe why we
|
|
|
|
# would want to disable the warning. The list below contains both C
|
|
|
|
# and C++ warnings for all warnings since clang has seemingly no
|
|
|
|
# easy way to tell if something is a C or C++ specific warning and
|
|
|
|
# manually auditing every single one of them just isn't in the cards
|
|
|
|
# right now.
|
|
|
|
|
|
|
|
# /W3 is being removed, then added back again, this is because order
|
|
|
|
# matters for clang and these flags are being placed before the
|
|
|
|
# CMAKE_[LANGUAGE]_FLAGS which normally contain /W3, so we would
|
|
|
|
# disable certain warings here only for them to be re-enabled by /W3
|
|
|
|
# later on.
|
|
|
|
remove_cc_flag("/W3")
|
2023-08-10 01:28:22 +00:00
|
|
|
|
CMake: Windows: suppress Clang-cl warnings
Building with clang on windows isn't an officially supported scenario
but it's something we'd like to keep working, but as it doesn't see
regular use, things tend to bit rot a bit.
0136289cb6 got things back into somewhat working order however the build
log came in at a little over 5.5GiB emitting a total of 11.787.294
warnings (827.847 unique), it was getting to the point where printing
all warnings, was a rather significant contributor to the total build
time.
this PR, suppress every single warning out of that build, one could
argue that some of these warnings are actually genuine and should be
enabled, and dealt with, the thing is, building with clang isn't
supported as of now and I honestly lack the time right now to sift
though this barrage of data.
given MSVC, Clang on mac and GCC on linux currently all build without
warnings, having clang on windows match that baseline seems like a
reasonable thing to do.
I left some notes in cmake flagging the potential cleanup, and added
counts of how often each warn occurred (The one off warns are much more
likely to lead to a genuine bug fix than the ones that produce a whole
lot of noise) so if someone wants to spend some effort they can do so
effectively.
The suppression is guarded with clang on windows specific guard and
should not affect any other platforms.
Pull Request: https://projects.blender.org/blender/blender/pulls/121085
2024-04-25 18:32:20 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_WARNINGS
|
|
|
|
C_WARN_CLANG_CL_W3 /W3
|
|
|
|
# The number behind each warn is the number of unique warning were
|
|
|
|
# generated on 2024-04-24 (d2be9cecc28a03ff1f799e8c63f1f9f8eda7cce3)
|
|
|
|
# especially the ones in the single and low double digits are likely
|
|
|
|
# genuine problems that can be investigated.
|
|
|
|
C_WARN_CLANG_CL_C++98_COMPAT -Wno-c++98-compat # 352692
|
|
|
|
C_WARN_CLANG_CL_OLD_STYLE_CAST -Wno-old-style-cast # 178608
|
|
|
|
C_WARN_CLANG_CL_UNSAFE_BUFFER_USAGE -Wno-unsafe-buffer-usage # 89032
|
|
|
|
C_WARN_CLANG_CL_MISSING_PROTOTYPES -Wno-missing-prototypes # 25587
|
|
|
|
C_WARN_CLANG_CL_SIGN_CONVERSION -Wno-sign-conversion # 20109
|
|
|
|
C_WARN_CLANG_CL_MISSING_FIELD_INITIALIZERS -Wno-missing-field-initializers # 20060
|
|
|
|
C_WARN_CLANG_CL_EXTRA_SEMI -Wno-extra-semi # 12513
|
|
|
|
C_WARN_CLANG_CL_LANGUAGE_EXTENSION_TOKEN -Wno-language-extension-token # 11032
|
|
|
|
C_WARN_CLANG_CL_IMPLICIT_FLOAT_CONVERSION -Wno-implicit-float-conversion # 11003
|
|
|
|
C_WARN_CLANG_CL_C++98_COMPAT_PEDANTIC -Wno-c++98-compat-pedantic # 10336
|
|
|
|
C_WARN_CLANG_CL_IMPLICIT_INT_FLOAT_CONVERSION -Wno-implicit-int-float-conversion # 7354
|
|
|
|
C_WARN_CLANG_CL_DOUBLE_PROMOTION -Wno-double-promotion # 7350
|
|
|
|
C_WARN_CLANG_CL_PRE_C++17_COMPAT -Wno-pre-c++17-compat # 7303
|
|
|
|
C_WARN_CLANG_CL_SHORTEN_64_TO_32 -Wno-shorten-64-to-32 # 7085
|
|
|
|
C_WARN_CLANG_CL_C++98_COMPAT_LOCAL_TYPE_TEMPLATE_ARGS -Wno-c++98-compat-local-type-template-args # 6906
|
|
|
|
C_WARN_CLANG_CL_RESERVED_IDENTIFIER -Wno-reserved-identifier # 5886
|
|
|
|
C_WARN_CLANG_CL_CAST_ALIGN -Wno-cast-align # 5513
|
|
|
|
C_WARN_CLANG_CL_DOCUMENTATION -Wno-documentation # 5107
|
|
|
|
C_WARN_CLANG_CL_DISABLED_MACRO_EXPANSION -Wno-disabled-macro-expansion # 4449
|
|
|
|
C_WARN_CLANG_CL_EXTRA_SEMI_STMT -Wno-extra-semi-stmt # 4349
|
|
|
|
C_WARN_CLANG_CL_ZERO_AS_NULL_POINTER_CONSTANT -Wno-zero-as-null-pointer-constant # 3209
|
|
|
|
C_WARN_CLANG_CL_FLOAT_CONVERSION -Wno-float-conversion # 2869
|
|
|
|
C_WARN_CLANG_CL_RESERVED_MACRO_IDENTIFIER -Wno-reserved-macro-identifier # 2862
|
|
|
|
C_WARN_CLANG_CL_CAST_FUNCTION_TYPE_STRICT -Wno-cast-function-type-strict # 2663
|
|
|
|
C_WARN_CLANG_CL_FLOAT_EQUAL -Wno-float-equal # 2153
|
|
|
|
C_WARN_CLANG_CL_IMPLICIT_INT_CONVERSION -Wno-implicit-int-conversion # 2117
|
|
|
|
C_WARN_CLANG_CL_SHADOW -Wno-shadow # 2068
|
|
|
|
C_WARN_CLANG_CL_SHADOW_FIELD_IN_CONSTRUCTOR -Wno-shadow-field-in-constructor # 1829
|
|
|
|
C_WARN_CLANG_CL_CAST_QUAL -Wno-cast-qual # 1742
|
|
|
|
C_WARN_CLANG_CL_PRE_C++14_COMPAT -Wno-pre-c++14-compat # 1569
|
|
|
|
C_WARN_CLANG_CL_GLOBAL_CONSTRUCTORS -Wno-global-constructors # 1402
|
|
|
|
C_WARN_CLANG_CL_SWITCH_ENUM -Wno-switch-enum # 973
|
|
|
|
C_WARN_CLANG_CL_EXIT_TIME_DESTRUCTORS -Wno-exit-time-destructors # 940
|
|
|
|
C_WARN_CLANG_CL_CTAD_MAYBE_UNSUPPORTED -Wno-ctad-maybe-unsupported # 891
|
|
|
|
C_WARN_CLANG_CL_UNDEFINED_FUNC_TEMPLATE -Wno-undefined-func-template # 863
|
|
|
|
C_WARN_CLANG_CL_C++98_COMPAT_EXTRA_SEMI -Wno-c++98-compat-extra-semi # 848
|
|
|
|
C_WARN_CLANG_CL_CAST_FUNCTION_TYPE -Wno-cast-function-type # 807
|
|
|
|
C_WARN_CLANG_CL_NULLABILITY_EXTENSION -Wno-nullability-extension # 602
|
|
|
|
C_WARN_CLANG_CL_SHADOW_FIELD -Wno-shadow-field # 585
|
|
|
|
C_WARN_CLANG_CL_CONDITIONAL_UNINITIALIZED -Wno-conditional-uninitialized # 555
|
|
|
|
C_WARN_CLANG_CL_UNUSED_PARAMETER -Wno-unused-parameter # 539
|
|
|
|
C_WARN_CLANG_CL_SUGGEST_DESTRUCTOR_OVERRIDE -Wno-suggest-destructor-override # 356
|
|
|
|
C_WARN_CLANG_CL_SHADOW_UNCAPTURED_LOCAL -Wno-shadow-uncaptured-local # 355
|
|
|
|
C_WARN_CLANG_CL_UNUSED_MACROS -Wno-unused-macros # 289
|
|
|
|
C_WARN_CLANG_CL_COVERED_SWITCH_DEFAULT -Wno-covered-switch-default # 233
|
|
|
|
C_WARN_CLANG_CL_SIGNED_ENUM_BITFIELD -Wno-signed-enum-bitfield # 229
|
|
|
|
C_WARN_CLANG_CL_DECLARATION_AFTER_STATEMENT -Wno-declaration-after-statement # 228
|
|
|
|
C_WARN_CLANG_CL_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough # 164
|
|
|
|
C_WARN_CLANG_CL_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor # 161
|
|
|
|
C_WARN_CLANG_CL_NESTED_ANON_TYPES -Wno-nested-anon-types # 140
|
|
|
|
C_WARN_CLANG_CL_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS -Wno-gnu-zero-variadic-macro-arguments # 132
|
|
|
|
C_WARN_CLANG_CL_UNREACHABLE_CODE_BREAK -Wno-unreachable-code-break # 115
|
|
|
|
C_WARN_CLANG_CL_INCONSISTENT_MISSING_DESTRUCTOR_OVERRIDE -Wno-inconsistent-missing-destructor-override # 104
|
|
|
|
C_WARN_CLANG_CL_FORMAT_PEDANTIC -Wno-format-pedantic # 97
|
|
|
|
C_WARN_CLANG_CL_NONPORTABLE_SYSTEM_INCLUDE_PATH -Wno-nonportable-system-include-path # 95
|
|
|
|
C_WARN_CLANG_CL_UNDEF -Wno-undef # 94
|
|
|
|
C_WARN_CLANG_CL_IGNORED_QUALIFIERS -Wno-ignored-qualifiers # 93
|
|
|
|
C_WARN_CLANG_CL_USED_BUT_MARKED_UNUSED -Wno-used-but-marked-unused # 83
|
|
|
|
C_WARN_CLANG_CL_HEADER_HYGIENE -Wno-header-hygiene # 79
|
|
|
|
C_WARN_CLANG_CL_CHAR_SUBSCRIPTS -Wno-char-subscripts # 76
|
|
|
|
C_WARN_CLANG_CL_UNREACHABLE_CODE_RETURN -Wno-unreachable-code-return # 71
|
|
|
|
C_WARN_CLANG_CL_UNUSED_TEMPLATE -Wno-unused-template # 66
|
|
|
|
C_WARN_CLANG_CL_GNU_ANONYMOUS_STRUCT -Wno-gnu-anonymous-struct # 63
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_COPY_WITH_USER_PROVIDED_DTOR -Wno-deprecated-copy-with-user-provided-dtor # 62
|
|
|
|
C_WARN_CLANG_CL_INCONSISTENT_MISSING_OVERRIDE -Wno-inconsistent-missing-override # 54
|
|
|
|
C_WARN_CLANG_CL_UNREACHABLE_CODE -Wno-unreachable-code # 52
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_DYNAMIC_EXCEPTION_SPEC -Wno-deprecated-dynamic-exception-spec # 51
|
|
|
|
C_WARN_CLANG_CL_BAD_FUNCTION_CAST -Wno-bad-function-cast # 50
|
|
|
|
C_WARN_CLANG_CL_MICROSOFT_ENUM_VALUE -Wno-microsoft-enum-value # 47
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_COPY_WITH_USER_PROVIDED_COPY -Wno-deprecated-copy-with-user-provided-copy # 41
|
|
|
|
C_WARN_CLANG_CL_ZERO_LENGTH_ARRAY -Wno-zero-length-array # 39
|
|
|
|
C_WARN_CLANG_CL_UNUSED_FUNCTION -Wno-unused-function # 38
|
|
|
|
C_WARN_CLANG_CL_PEDANTIC -Wno-pedantic # 38
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_COPY_WITH_DTOR -Wno-deprecated-copy-with-dtor # 37
|
|
|
|
C_WARN_CLANG_CL_DOCUMENTATION_UNKNOWN_COMMAND -Wno-documentation-unknown-command # 34
|
|
|
|
C_WARN_CLANG_CL_UNDEFINED_REINTERPRET_CAST -Wno-undefined-reinterpret-cast # 33
|
|
|
|
C_WARN_CLANG_CL_FORMAT_NONLITERAL -Wno-format-nonliteral # 29
|
|
|
|
C_WARN_CLANG_CL_COMMA -Wno-comma # 27
|
|
|
|
C_WARN_CLANG_CL_DOCUMENTATION_DEPRECATED_SYNC -Wno-documentation-deprecated-sync # 26
|
|
|
|
C_WARN_CLANG_CL_SHIFT_SIGN_OVERFLOW -Wno-shift-sign-overflow # 24
|
|
|
|
C_WARN_CLANG_CL_PRE_C++17_COMPAT_PEDANTIC -Wno-pre-c++17-compat-pedantic # 24
|
|
|
|
C_WARN_CLANG_CL_C++98_COMPAT_UNNAMED_TYPE_TEMPLATE_ARGS -Wno-c++98-compat-unnamed-type-template-args # 22
|
|
|
|
C_WARN_CLANG_CL_SIGN_COMPARE -Wno-sign-compare # 21
|
|
|
|
C_WARN_CLANG_CL_FORMAT -Wno-format # 21
|
|
|
|
C_WARN_CLANG_CL_C++98_COMPAT_BIND_TO_TEMPORARY_COPY -Wno-c++98-compat-bind-to-temporary-copy # 21
|
|
|
|
C_WARN_CLANG_CL_ENUM_ENUM_CONVERSION -Wno-enum-enum-conversion # 20
|
|
|
|
C_WARN_CLANG_CL_ANON_ENUM_ENUM_CONVERSION -Wno-anon-enum-enum-conversion # 14
|
|
|
|
C_WARN_CLANG_CL_RANGE_LOOP_BIND_REFERENCE -Wno-range-loop-bind-reference # 14
|
|
|
|
C_WARN_CLANG_CL_ENUM_FLOAT_CONVERSION -Wno-enum-float-conversion # 12
|
|
|
|
C_WARN_CLANG_CL_KEYWORD_MACRO -Wno-keyword-macro # 10
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_COPY -Wno-deprecated-copy # 10
|
|
|
|
C_WARN_CLANG_CL_UNUSED_MEMBER_FUNCTION -Wno-unused-member-function # 9
|
|
|
|
C_WARN_CLANG_CL_MISSING_NORETURN -Wno-missing-noreturn # 8
|
|
|
|
C_WARN_CLANG_CL_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations # 8
|
|
|
|
C_WARN_CLANG_CL_DOCUMENTATION_HTML -Wno-documentation-html # 6
|
|
|
|
C_WARN_CLANG_CL_GNU_REDECLARED_ENUM -Wno-gnu-redeclared-enum # 6
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations # 6
|
|
|
|
C_WARN_CLANG_CL_OVERLOADED_VIRTUAL -Wno-overloaded-virtual # 5
|
|
|
|
C_WARN_CLANG_CL_C++98_C++11_COMPAT_BINARY_LITERAL -Wno-c++98-c++11-compat-binary-literal # 4
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_REDUNDANT_CONSTEXPR_STATIC_DEF -Wno-deprecated-redundant-constexpr-static-def # 4
|
|
|
|
C_WARN_CLANG_CL_MISSING_BRACES -Wno-missing-braces # 4
|
|
|
|
C_WARN_CLANG_CL_C99_EXTENSIONS -Wno-c99-extensions # 4
|
|
|
|
C_WARN_CLANG_CL_STRICT_PROTOTYPES -Wno-strict-prototypes # 4
|
|
|
|
C_WARN_CLANG_CL_UNREACHABLE_CODE_LOOP_INCREMENT -Wno-unreachable-code-loop-increment # 4
|
|
|
|
C_WARN_CLANG_CL_GNU_CASE_RANGE -Wno-gnu-case-range # 4
|
|
|
|
C_WARN_CLANG_CL_DUPLICATE_ENUM -Wno-duplicate-enum # 3
|
|
|
|
C_WARN_CLANG_CL_NULL_POINTER_SUBTRACTION -Wno-null-pointer-subtraction # 2
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_LITERAL_OPERATOR -Wno-deprecated-literal-operator # 2
|
|
|
|
C_WARN_CLANG_CL_NEWLINE_EOF -Wno-newline-eof # 2
|
|
|
|
C_WARN_CLANG_CL_MICROSOFT_CAST -Wno-microsoft-cast # 2
|
|
|
|
C_WARN_CLANG_CL_DATE_TIME -Wno-date-time # 2
|
|
|
|
C_WARN_CLANG_CL_DELETE_NON_ABSTRACT_NON_VIRTUAL_DTOR -Wno-delete-non-abstract-non-virtual-dtor # 2
|
|
|
|
C_WARN_CLANG_CL_UNUSED_PRIVATE_FIELD -Wno-unused-private-field # 2
|
|
|
|
C_WARN_CLANG_CL_FLEXIBLE_ARRAY_EXTENSIONS -Wno-flexible-array-extensions # 2
|
|
|
|
C_WARN_CLANG_CL_STRING_CONVERSION -Wno-string-conversion # 2
|
|
|
|
C_WARN_CLANG_CL_FINAL_DTOR_NON_FINAL_CLASS -Wno-final-dtor-non-final-class # 2
|
|
|
|
C_WARN_CLANG_CL_MICROSOFT_UNQUALIFIED_FRIEND -Wno-microsoft-unqualified-friend # 2
|
|
|
|
C_WARN_CLANG_CL_INVALID_NORETURN -Wno-invalid-noreturn # 1
|
|
|
|
C_WARN_CLANG_CL_INVALID_UTF8 -Wno-invalid-utf8 # 1
|
|
|
|
C_WARN_CLANG_CL_FOUR_CHAR_CONSTANTS -Wno-four-char-constants # 1
|
|
|
|
C_WARN_CLANG_CL_PARENTHESES -Wno-parentheses # 1
|
|
|
|
C_WARN_CLANG_CL_PESSIMIZING_MOVE -Wno-pessimizing-move # 1
|
|
|
|
C_WARN_CLANG_CL_DEPRECATED_NON_PROTOTYPE -Wno-deprecated-non-prototype # 1
|
|
|
|
C_WARN_CLANG_CL_BITFIELD_ENUM_CONVERSION -Wno-bitfield-enum-conversion # 1
|
|
|
|
C_WARN_CLANG_CL_UNUSED_LAMBDA_CAPTURE -Wno-unused-lambda-capture # 1
|
|
|
|
C_WARN_CLANG_CL_SHADOW_FIELD_IN_CONSTRUCTOR_MODIFIED -Wno-shadow-field-in-constructor-modified # 1
|
|
|
|
)
|
2023-08-10 01:28:22 +00:00
|
|
|
|
CMake: Windows: suppress Clang-cl warnings
Building with clang on windows isn't an officially supported scenario
but it's something we'd like to keep working, but as it doesn't see
regular use, things tend to bit rot a bit.
0136289cb6 got things back into somewhat working order however the build
log came in at a little over 5.5GiB emitting a total of 11.787.294
warnings (827.847 unique), it was getting to the point where printing
all warnings, was a rather significant contributor to the total build
time.
this PR, suppress every single warning out of that build, one could
argue that some of these warnings are actually genuine and should be
enabled, and dealt with, the thing is, building with clang isn't
supported as of now and I honestly lack the time right now to sift
though this barrage of data.
given MSVC, Clang on mac and GCC on linux currently all build without
warnings, having clang on windows match that baseline seems like a
reasonable thing to do.
I left some notes in cmake flagging the potential cleanup, and added
counts of how often each warn occurred (The one off warns are much more
likely to lead to a genuine bug fix than the ones that produce a whole
lot of noise) so if someone wants to spend some effort they can do so
effectively.
The suppression is guarded with clang on windows specific guard and
should not affect any other platforms.
Pull Request: https://projects.blender.org/blender/blender/pulls/121085
2024-04-25 18:32:20 +00:00
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_WARNINGS
|
|
|
|
CXX_WARN_CLANG_CL_W3 /W3
|
|
|
|
CXX_WARN_CLANG_CL_C++98_COMPAT -Wno-c++98-compat # 352692
|
|
|
|
CXX_WARN_CLANG_CL_OLD_STYLE_CAST -Wno-old-style-cast # 178608
|
|
|
|
CXX_WARN_CLANG_CL_UNSAFE_BUFFER_USAGE -Wno-unsafe-buffer-usage # 89032
|
|
|
|
CXX_WARN_CLANG_CL_MISSING_PROTOTYPES -Wno-missing-prototypes # 25587
|
|
|
|
CXX_WARN_CLANG_CL_SIGN_CONVERSION -Wno-sign-conversion # 20109
|
|
|
|
CXX_WARN_CLANG_CL_MISSING_FIELD_INITIALIZERS -Wno-missing-field-initializers # 20060
|
|
|
|
CXX_WARN_CLANG_CL_EXTRA_SEMI -Wno-extra-semi # 12513
|
|
|
|
CXX_WARN_CLANG_CL_LANGUAGE_EXTENSION_TOKEN -Wno-language-extension-token # 11032
|
|
|
|
CXX_WARN_CLANG_CL_IMPLICIT_FLOAT_CONVERSION -Wno-implicit-float-conversion # 11003
|
|
|
|
CXX_WARN_CLANG_CL_C++98_COMPAT_PEDANTIC -Wno-c++98-compat-pedantic # 10336
|
|
|
|
CXX_WARN_CLANG_CL_IMPLICIT_INT_FLOAT_CONVERSION -Wno-implicit-int-float-conversion # 7354
|
|
|
|
CXX_WARN_CLANG_CL_DOUBLE_PROMOTION -Wno-double-promotion # 7350
|
|
|
|
CXX_WARN_CLANG_CL_PRE_C++17_COMPAT -Wno-pre-c++17-compat # 7303
|
|
|
|
CXX_WARN_CLANG_CL_SHORTEN_64_TO_32 -Wno-shorten-64-to-32 # 7085
|
|
|
|
CXX_WARN_CLANG_CL_C++98_COMPAT_LOCAL_TYPE_TEMPLATE_ARGS -Wno-c++98-compat-local-type-template-args # 6906
|
|
|
|
CXX_WARN_CLANG_CL_RESERVED_IDENTIFIER -Wno-reserved-identifier # 5886
|
|
|
|
CXX_WARN_CLANG_CL_CAST_ALIGN -Wno-cast-align # 5513
|
|
|
|
CXX_WARN_CLANG_CL_DOCUMENTATION -Wno-documentation # 5107
|
|
|
|
CXX_WARN_CLANG_CL_DISABLED_MACRO_EXPANSION -Wno-disabled-macro-expansion # 4449
|
|
|
|
CXX_WARN_CLANG_CL_EXTRA_SEMI_STMT -Wno-extra-semi-stmt # 4349
|
|
|
|
CXX_WARN_CLANG_CL_ZERO_AS_NULL_POINTER_CONSTANT -Wno-zero-as-null-pointer-constant # 3209
|
|
|
|
CXX_WARN_CLANG_CL_FLOAT_CONVERSION -Wno-float-conversion # 2869
|
|
|
|
CXX_WARN_CLANG_CL_RESERVED_MACRO_IDENTIFIER -Wno-reserved-macro-identifier # 2862
|
|
|
|
CXX_WARN_CLANG_CL_CAST_FUNCTION_TYPE_STRICT -Wno-cast-function-type-strict # 2663
|
|
|
|
CXX_WARN_CLANG_CL_FLOAT_EQUAL -Wno-float-equal # 2153
|
|
|
|
CXX_WARN_CLANG_CL_IMPLICIT_INT_CONVERSION -Wno-implicit-int-conversion # 2117
|
|
|
|
CXX_WARN_CLANG_CL_SHADOW -Wno-shadow # 2068
|
|
|
|
CXX_WARN_CLANG_CL_SHADOW_FIELD_IN_CONSTRUCTOR -Wno-shadow-field-in-constructor # 1829
|
|
|
|
CXX_WARN_CLANG_CL_CAST_QUAL -Wno-cast-qual # 1742
|
|
|
|
CXX_WARN_CLANG_CL_PRE_C++14_COMPAT -Wno-pre-c++14-compat # 1569
|
|
|
|
CXX_WARN_CLANG_CL_GLOBAL_CONSTRUCTORS -Wno-global-constructors # 1402
|
|
|
|
CXX_WARN_CLANG_CL_SWITCH_ENUM -Wno-switch-enum # 973
|
|
|
|
CXX_WARN_CLANG_CL_EXIT_TIME_DESTRUCTORS -Wno-exit-time-destructors # 940
|
|
|
|
CXX_WARN_CLANG_CL_CTAD_MAYBE_UNSUPPORTED -Wno-ctad-maybe-unsupported # 891
|
|
|
|
CXX_WARN_CLANG_CL_UNDEFINED_FUNC_TEMPLATE -Wno-undefined-func-template # 863
|
|
|
|
CXX_WARN_CLANG_CL_C++98_COMPAT_EXTRA_SEMI -Wno-c++98-compat-extra-semi # 848
|
|
|
|
CXX_WARN_CLANG_CL_CAST_FUNCTION_TYPE -Wno-cast-function-type # 807
|
|
|
|
CXX_WARN_CLANG_CL_NULLABILITY_EXTENSION -Wno-nullability-extension # 602
|
|
|
|
CXX_WARN_CLANG_CL_SHADOW_FIELD -Wno-shadow-field # 585
|
|
|
|
CXX_WARN_CLANG_CL_CONDITIONAL_UNINITIALIZED -Wno-conditional-uninitialized # 555
|
|
|
|
CXX_WARN_CLANG_CL_UNUSED_PARAMETER -Wno-unused-parameter # 539
|
|
|
|
CXX_WARN_CLANG_CL_SUGGEST_DESTRUCTOR_OVERRIDE -Wno-suggest-destructor-override # 356
|
|
|
|
CXX_WARN_CLANG_CL_SHADOW_UNCAPTURED_LOCAL -Wno-shadow-uncaptured-local # 355
|
|
|
|
CXX_WARN_CLANG_CL_UNUSED_MACROS -Wno-unused-macros # 289
|
|
|
|
CXX_WARN_CLANG_CL_COVERED_SWITCH_DEFAULT -Wno-covered-switch-default # 233
|
|
|
|
CXX_WARN_CLANG_CL_SIGNED_ENUM_BITFIELD -Wno-signed-enum-bitfield # 229
|
|
|
|
CXX_WARN_CLANG_CL_DECLARATION_AFTER_STATEMENT -Wno-declaration-after-statement # 228
|
|
|
|
CXX_WARN_CLANG_CL_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough # 164
|
|
|
|
CXX_WARN_CLANG_CL_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor # 161
|
|
|
|
CXX_WARN_CLANG_CL_NESTED_ANON_TYPES -Wno-nested-anon-types # 140
|
|
|
|
CXX_WARN_CLANG_CL_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS -Wno-gnu-zero-variadic-macro-arguments # 132
|
|
|
|
CXX_WARN_CLANG_CL_UNREACHABLE_CODE_BREAK -Wno-unreachable-code-break # 115
|
|
|
|
CXX_WARN_CLANG_CL_INCONSISTENT_MISSING_DESTRUCTOR_OVERRIDE -Wno-inconsistent-missing-destructor-override # 104
|
|
|
|
CXX_WARN_CLANG_CL_FORMAT_PEDANTIC -Wno-format-pedantic # 97
|
|
|
|
CXX_WARN_CLANG_CL_NONPORTABLE_SYSTEM_INCLUDE_PATH -Wno-nonportable-system-include-path # 95
|
|
|
|
CXX_WARN_CLANG_CL_UNDEF -Wno-undef # 94
|
|
|
|
CXX_WARN_CLANG_CL_IGNORED_QUALIFIERS -Wno-ignored-qualifiers # 93
|
|
|
|
CXX_WARN_CLANG_CL_USED_BUT_MARKED_UNUSED -Wno-used-but-marked-unused # 83
|
|
|
|
CXX_WARN_CLANG_CL_HEADER_HYGIENE -Wno-header-hygiene # 79
|
|
|
|
CXX_WARN_CLANG_CL_CHAR_SUBSCRIPTS -Wno-char-subscripts # 76
|
|
|
|
CXX_WARN_CLANG_CL_UNREACHABLE_CODE_RETURN -Wno-unreachable-code-return # 71
|
|
|
|
CXX_WARN_CLANG_CL_UNUSED_TEMPLATE -Wno-unused-template # 66
|
|
|
|
CXX_WARN_CLANG_CL_GNU_ANONYMOUS_STRUCT -Wno-gnu-anonymous-struct # 63
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_COPY_WITH_USER_PROVIDED_DTOR -Wno-deprecated-copy-with-user-provided-dtor # 62
|
|
|
|
CXX_WARN_CLANG_CL_INCONSISTENT_MISSING_OVERRIDE -Wno-inconsistent-missing-override # 54
|
|
|
|
CXX_WARN_CLANG_CL_UNREACHABLE_CODE -Wno-unreachable-code # 52
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_DYNAMIC_EXCEPTION_SPEC -Wno-deprecated-dynamic-exception-spec # 51
|
|
|
|
CXX_WARN_CLANG_CL_BAD_FUNCTION_CAST -Wno-bad-function-cast # 50
|
|
|
|
CXX_WARN_CLANG_CL_MICROSOFT_ENUM_VALUE -Wno-microsoft-enum-value # 47
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_COPY_WITH_USER_PROVIDED_COPY -Wno-deprecated-copy-with-user-provided-copy # 41
|
|
|
|
CXX_WARN_CLANG_CL_ZERO_LENGTH_ARRAY -Wno-zero-length-array # 39
|
|
|
|
CXX_WARN_CLANG_CL_UNUSED_FUNCTION -Wno-unused-function # 38
|
|
|
|
CXX_WARN_CLANG_CL_PEDANTIC -Wno-pedantic # 38
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_COPY_WITH_DTOR -Wno-deprecated-copy-with-dtor # 37
|
|
|
|
CXX_WARN_CLANG_CL_DOCUMENTATION_UNKNOWN_COMMAND -Wno-documentation-unknown-command # 34
|
|
|
|
CXX_WARN_CLANG_CL_UNDEFINED_REINTERPRET_CAST -Wno-undefined-reinterpret-cast # 33
|
|
|
|
CXX_WARN_CLANG_CL_FORMAT_NONLITERAL -Wno-format-nonliteral # 29
|
|
|
|
CXX_WARN_CLANG_CL_COMMA -Wno-comma # 27
|
|
|
|
CXX_WARN_CLANG_CL_DOCUMENTATION_DEPRECATED_SYNC -Wno-documentation-deprecated-sync # 26
|
|
|
|
CXX_WARN_CLANG_CL_SHIFT_SIGN_OVERFLOW -Wno-shift-sign-overflow # 24
|
|
|
|
CXX_WARN_CLANG_CL_PRE_C++17_COMPAT_PEDANTIC -Wno-pre-c++17-compat-pedantic # 24
|
|
|
|
CXX_WARN_CLANG_CL_C++98_COMPAT_UNNAMED_TYPE_TEMPLATE_ARGS -Wno-c++98-compat-unnamed-type-template-args # 22
|
|
|
|
CXX_WARN_CLANG_CL_SIGN_COMPARE -Wno-sign-compare # 21
|
|
|
|
CXX_WARN_CLANG_CL_FORMAT -Wno-format # 21
|
|
|
|
CXX_WARN_CLANG_CL_C++98_COMPAT_BIND_TO_TEMPORARY_COPY -Wno-c++98-compat-bind-to-temporary-copy # 21
|
|
|
|
CXX_WARN_CLANG_CL_ENUM_ENUM_CONVERSION -Wno-enum-enum-conversion # 20
|
|
|
|
CXX_WARN_CLANG_CL_ANON_ENUM_ENUM_CONVERSION -Wno-anon-enum-enum-conversion # 14
|
|
|
|
CXX_WARN_CLANG_CL_RANGE_LOOP_BIND_REFERENCE -Wno-range-loop-bind-reference # 14
|
|
|
|
CXX_WARN_CLANG_CL_ENUM_FLOAT_CONVERSION -Wno-enum-float-conversion # 12
|
|
|
|
CXX_WARN_CLANG_CL_KEYWORD_MACRO -Wno-keyword-macro # 10
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_COPY -Wno-deprecated-copy # 10
|
|
|
|
CXX_WARN_CLANG_CL_UNUSED_MEMBER_FUNCTION -Wno-unused-member-function # 9
|
|
|
|
CXX_WARN_CLANG_CL_MISSING_NORETURN -Wno-missing-noreturn # 8
|
|
|
|
CXX_WARN_CLANG_CL_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations # 8
|
|
|
|
CXX_WARN_CLANG_CL_DOCUMENTATION_HTML -Wno-documentation-html # 6
|
|
|
|
CXX_WARN_CLANG_CL_GNU_REDECLARED_ENUM -Wno-gnu-redeclared-enum # 6
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations # 6
|
|
|
|
CXX_WARN_CLANG_CL_OVERLOADED_VIRTUAL -Wno-overloaded-virtual # 5
|
|
|
|
CXX_WARN_CLANG_CL_C++98_C++11_COMPAT_BINARY_LITERAL -Wno-c++98-c++11-compat-binary-literal # 4
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_REDUNDANT_CONSTEXPR_STATIC_DEF -Wno-deprecated-redundant-constexpr-static-def # 4
|
|
|
|
CXX_WARN_CLANG_CL_MISSING_BRACES -Wno-missing-braces # 4
|
|
|
|
CXX_WARN_CLANG_CL_C99_EXTENSIONS -Wno-c99-extensions # 4
|
|
|
|
CXX_WARN_CLANG_CL_STRICT_PROTOTYPES -Wno-strict-prototypes # 4
|
|
|
|
CXX_WARN_CLANG_CL_UNREACHABLE_CODE_LOOP_INCREMENT -Wno-unreachable-code-loop-increment # 4
|
|
|
|
CXX_WARN_CLANG_CL_GNU_CASE_RANGE -Wno-gnu-case-range # 4
|
|
|
|
CXX_WARN_CLANG_CL_DUPLICATE_ENUM -Wno-duplicate-enum # 3
|
|
|
|
CXX_WARN_CLANG_CL_NULL_POINTER_SUBTRACTION -Wno-null-pointer-subtraction # 2
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_LITERAL_OPERATOR -Wno-deprecated-literal-operator # 2
|
|
|
|
CXX_WARN_CLANG_CL_NEWLINE_EOF -Wno-newline-eof # 2
|
|
|
|
CXX_WARN_CLANG_CL_MICROSOFT_CAST -Wno-microsoft-cast # 2
|
|
|
|
CXX_WARN_CLANG_CL_DATE_TIME -Wno-date-time # 2
|
|
|
|
CXX_WARN_CLANG_CL_DELETE_NON_ABSTRACT_NON_VIRTUAL_DTOR -Wno-delete-non-abstract-non-virtual-dtor # 2
|
|
|
|
CXX_WARN_CLANG_CL_UNUSED_PRIVATE_FIELD -Wno-unused-private-field # 2
|
|
|
|
CXX_WARN_CLANG_CL_FLEXIBLE_ARRAY_EXTENSIONS -Wno-flexible-array-extensions # 2
|
|
|
|
CXX_WARN_CLANG_CL_STRING_CONVERSION -Wno-string-conversion # 2
|
|
|
|
CXX_WARN_CLANG_CL_FINAL_DTOR_NON_FINAL_CLASS -Wno-final-dtor-non-final-class # 2
|
|
|
|
CXX_WARN_CLANG_CL_MICROSOFT_UNQUALIFIED_FRIEND -Wno-microsoft-unqualified-friend # 2
|
|
|
|
CXX_WARN_CLANG_CL_INVALID_NORETURN -Wno-invalid-noreturn # 1
|
|
|
|
CXX_WARN_CLANG_CL_INVALID_UTF8 -Wno-invalid-utf8 # 1
|
|
|
|
CXX_WARN_CLANG_CL_FOUR_CHAR_CONSTANTS -Wno-four-char-constants # 1
|
|
|
|
CXX_WARN_CLANG_CL_PARENTHESES -Wno-parentheses # 1
|
|
|
|
CXX_WARN_CLANG_CL_PESSIMIZING_MOVE -Wno-pessimizing-move # 1
|
|
|
|
CXX_WARN_CLANG_CL_DEPRECATED_NON_PROTOTYPE -Wno-deprecated-non-prototype # 1
|
|
|
|
CXX_WARN_CLANG_CL_BITFIELD_ENUM_CONVERSION -Wno-bitfield-enum-conversion # 1
|
|
|
|
CXX_WARN_CLANG_CL_UNUSED_LAMBDA_CAPTURE -Wno-unused-lambda-capture # 1
|
|
|
|
CXX_WARN_CLANG_CL_SHADOW_FIELD_IN_CONSTRUCTOR_MODIFIED -Wno-shadow-field-in-constructor-modified # 1
|
|
|
|
)
|
|
|
|
endif()
|
2023-08-10 01:28:22 +00:00
|
|
|
|
2023-03-17 09:45:03 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# ---------------------
|
2022-05-19 00:33:02 +00:00
|
|
|
# Suppress Strict Flags
|
|
|
|
|
2013-03-14 07:25:54 +00:00
|
|
|
# flags to undo strict flags
|
2023-08-10 01:28:22 +00:00
|
|
|
|
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_REMOVE_STRICT_FLAGS
|
|
|
|
|
|
|
|
C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter
|
|
|
|
C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable
|
|
|
|
C_WARN_NO_UNUSED_MACROS -Wno-unused-macros
|
|
|
|
C_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation
|
|
|
|
|
|
|
|
C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations
|
|
|
|
C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers
|
|
|
|
C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function
|
|
|
|
C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast
|
|
|
|
C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes
|
|
|
|
C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum
|
|
|
|
C_WARN_NO_UNDEF -Wno-undef
|
|
|
|
C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn
|
|
|
|
C_WARN_NO_UNUSED_BUT_SET_VARIABLE -Wno-unused-but-set-variable
|
|
|
|
C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations
|
|
|
|
C_WARN_NO_STRICT_PROTOTYPES -Wno-strict-prototypes
|
|
|
|
C_WARN_NO_BITWISE_INSTEAD_OF_LOGICAL -Wno-bitwise-instead-of-logical
|
|
|
|
C_WARN_NO_IMPLICIT_CONST_INT_FLOAT_CONVERSION -Wno-implicit-const-int-float-conversion
|
2023-10-02 07:56:44 +00:00
|
|
|
C_WARN_NO_SINGLE_BIT_BITFIELD_CONSTANT_CONVERSION -Wno-single-bit-bitfield-constant-conversion
|
2023-08-10 01:28:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_REMOVE_STRICT_FLAGS
|
|
|
|
|
|
|
|
CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter
|
|
|
|
CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field
|
|
|
|
CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing
|
|
|
|
CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor
|
|
|
|
CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros
|
|
|
|
CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable
|
|
|
|
CXX_WARN_NO_REORDER -Wno-reorder
|
|
|
|
CXX_WARN_NO_COMMENT -Wno-comment
|
|
|
|
CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs
|
|
|
|
CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template
|
|
|
|
CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization
|
|
|
|
CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation
|
|
|
|
CXX_WARN_NO_BITWISE_INSTEAD_OF_LOGICAL -Wno-bitwise-instead-of-logical
|
|
|
|
CXX_WARN_NO_IMPLICIT_CONST_INT_FLOAT_CONVERSION -Wno-implicit-const-int-float-conversion
|
|
|
|
CXX_WARN_NO_UNDEF -Wno-undef
|
|
|
|
CXX_WARN_NO_UNDEF_PREFIX -Wno-undef-prefix
|
|
|
|
)
|
2013-07-15 08:26:16 +00:00
|
|
|
|
2024-03-07 06:56:41 +00:00
|
|
|
elseif(CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
2010-12-16 09:55:35 +00:00
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_WARNINGS
|
|
|
|
|
|
|
|
C_WARN_ALL -Wall
|
|
|
|
C_WARN_POINTER_ARITH -Wpointer-arith
|
|
|
|
C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas
|
|
|
|
)
|
2010-12-16 09:55:35 +00:00
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_WARNINGS
|
2010-12-16 09:55:35 +00:00
|
|
|
|
2023-08-10 01:28:22 +00:00
|
|
|
CXX_WARN_ALL -Wall
|
|
|
|
CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof
|
|
|
|
CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare
|
|
|
|
)
|
|
|
|
|
|
|
|
# Disable numbered, false positives.
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND C_WARNINGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
|
|
|
|
string(APPEND CXX_WARNINGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
|
2024-03-07 06:56:41 +00:00
|
|
|
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
2014-11-08 20:17:04 +00:00
|
|
|
# most msvc warnings are C & C++
|
|
|
|
set(_WARNINGS
|
|
|
|
# warning level:
|
|
|
|
"/W3"
|
|
|
|
"/w34062" # switch statement contains 'default' but no 'case' labels
|
2023-03-09 15:05:48 +00:00
|
|
|
"/w34100" # 'identifier' : unreferenced formal parameter
|
2019-03-22 19:15:46 +00:00
|
|
|
"/w34115" # 'type' : named type definition in parentheses
|
2018-08-29 16:08:00 +00:00
|
|
|
"/w34189" # local variable is initialized but not referenced
|
2022-09-26 02:26:48 +00:00
|
|
|
# see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017
|
|
|
|
"/w35038" # order of initialization in c++ constructors
|
2014-11-08 20:17:04 +00:00
|
|
|
# disable:
|
|
|
|
"/wd4018" # signed/unsigned mismatch
|
2015-12-21 03:54:36 +00:00
|
|
|
"/wd4146" # unary minus operator applied to unsigned type, result still unsigned
|
2014-11-08 20:17:04 +00:00
|
|
|
"/wd4065" # switch statement contains 'default' but no 'case' labels
|
|
|
|
"/wd4127" # conditional expression is constant
|
|
|
|
"/wd4181" # qualifier applied to reference type; ignored
|
|
|
|
"/wd4200" # zero-sized array in struct/union
|
|
|
|
"/wd4244" # conversion from 'type1' to 'type2', possible loss of data
|
|
|
|
"/wd4267" # conversion from 'size_t' to 'type', possible loss of data
|
|
|
|
"/wd4305" # truncation from 'type1' to 'type2'
|
|
|
|
"/wd4800" # forcing value to bool 'true' or 'false'
|
2018-06-10 06:12:13 +00:00
|
|
|
"/wd4828" # The file contains a character that is illegal
|
2018-09-25 17:05:01 +00:00
|
|
|
"/wd4996" # identifier was declared deprecated
|
2019-05-26 22:13:31 +00:00
|
|
|
"/wd4661" # no suitable definition provided for explicit template instantiation request
|
2022-05-25 14:28:07 +00:00
|
|
|
"/wd4848" # 'no_unique_address' is a vendor extension in C++17
|
2014-11-08 20:17:04 +00:00
|
|
|
# errors:
|
|
|
|
"/we4013" # 'function' undefined; assuming extern returning int
|
2017-09-28 02:59:28 +00:00
|
|
|
"/we4133" # incompatible pointer types
|
2014-11-08 20:17:04 +00:00
|
|
|
"/we4431" # missing type specifier - int assumed
|
2022-09-28 14:32:56 +00:00
|
|
|
"/we4033" # 'function' must return a value
|
2014-11-08 20:17:04 +00:00
|
|
|
)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2014-11-08 20:17:04 +00:00
|
|
|
string(REPLACE ";" " " _WARNINGS "${_WARNINGS}")
|
|
|
|
set(C_WARNINGS "${_WARNINGS}")
|
|
|
|
set(CXX_WARNINGS "${_WARNINGS}")
|
|
|
|
unset(_WARNINGS)
|
2010-10-17 06:38:56 +00:00
|
|
|
endif()
|
|
|
|
|
2023-08-17 13:54:04 +00:00
|
|
|
# Xcode enables additional warning flags by default. Disable some to match
|
|
|
|
# command line build and other platforms more closely.
|
|
|
|
if(XCODE)
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION NO)
|
|
|
|
endif()
|
|
|
|
|
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)
|
|
|
|
if(NOT EXISTS "${PYTHON_INCLUDE_DIR}/Python.h")
|
2022-09-09 01:52:14 +00:00
|
|
|
message(
|
|
|
|
FATAL_ERROR
|
2016-05-18 01:58:08 +00:00
|
|
|
"Missing: \"${PYTHON_INCLUDE_DIR}/Python.h\",\n"
|
|
|
|
"Set the cache entry 'PYTHON_INCLUDE_DIR' to point "
|
|
|
|
"to a valid python include path. Containing "
|
|
|
|
"Python.h for python version \"${PYTHON_VERSION}\""
|
|
|
|
)
|
2011-07-16 06:55:45 +00:00
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2022-09-09 01:12:56 +00:00
|
|
|
if(WIN32)
|
|
|
|
# Always use numpy bundled in precompiled libs.
|
2020-12-14 15:40:00 +00:00
|
|
|
elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR WITH_PYTHON_NUMPY)
|
2017-08-18 06:24:12 +00:00
|
|
|
if(("${PYTHON_NUMPY_PATH}" STREQUAL "") OR (${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
|
2020-12-14 15:40:00 +00:00
|
|
|
find_python_package(numpy "core/include")
|
2017-08-18 06:24:12 +00:00
|
|
|
endif()
|
2012-04-30 09:38:32 +00:00
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2014-03-04 18:39:53 +00:00
|
|
|
if(WIN32 OR APPLE)
|
2022-09-09 01:12:56 +00:00
|
|
|
# Always copy from precompiled libs.
|
2014-03-04 18:39:53 +00:00
|
|
|
elseif(WITH_PYTHON_INSTALL_REQUESTS)
|
2020-12-14 15:40:00 +00:00
|
|
|
find_python_package(requests "")
|
2014-03-04 18:39:53 +00:00
|
|
|
endif()
|
2021-10-21 11:45:37 +00:00
|
|
|
|
|
|
|
if(WIN32 OR APPLE)
|
2022-09-09 01:12:56 +00:00
|
|
|
# Always copy from precompiled libs.
|
2021-10-21 11:45:37 +00:00
|
|
|
elseif(WITH_PYTHON_INSTALL_ZSTANDARD)
|
|
|
|
find_python_package(zstandard "")
|
|
|
|
endif()
|
2011-07-16 06:55:45 +00:00
|
|
|
endif()
|
|
|
|
|
2021-07-14 21:17:02 +00:00
|
|
|
# Select C++17 as the standard for C++ projects.
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
# If C++17 is not available, downgrading to an earlier standard is NOT OK.
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2021-11-19 11:44:27 +00:00
|
|
|
# Do not enable compiler specific language extensions.
|
2021-07-14 21:17:02 +00:00
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
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(
|
|
|
|
CMAKE_COMPILER_IS_GNUCC OR
|
2024-03-07 08:56:58 +00:00
|
|
|
(CMAKE_C_COMPILER_ID MATCHES "Clang" AND (NOT MSVC)) OR
|
2024-03-07 06:56:41 +00:00
|
|
|
(CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
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
|
|
|
)
|
2018-09-28 08:06:59 +00:00
|
|
|
# Use C11 + GNU extensions, works with GCC, Clang, ICC
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND CMAKE_C_FLAGS " -std=gnu11")
|
2015-11-22 16:12:54 +00:00
|
|
|
endif()
|
|
|
|
|
2020-11-02 09:40:10 +00:00
|
|
|
if(WITH_COMPILER_SHORT_FILE_MACRO)
|
|
|
|
# Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
|
2023-07-29 03:47:57 +00:00
|
|
|
set(C_PREFIX_MAP_FLAGS "")
|
|
|
|
set(CXX_PREFIX_MAP_FLAGS "")
|
2023-08-10 01:28:22 +00:00
|
|
|
add_check_c_compiler_flags(
|
|
|
|
C_PREFIX_MAP_FLAGS
|
|
|
|
C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar
|
|
|
|
)
|
|
|
|
add_check_cxx_compiler_flags(
|
|
|
|
CXX_PREFIX_MAP_FLAGS
|
|
|
|
CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar
|
|
|
|
)
|
2020-11-04 15:30:29 +00:00
|
|
|
if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP)
|
2020-11-02 09:40:10 +00:00
|
|
|
if(APPLE)
|
|
|
|
if(XCODE AND ${XCODE_VERSION} VERSION_LESS 12.0)
|
2020-11-04 15:30:29 +00:00
|
|
|
# Developers may have say LLVM Clang-10.0.1 toolchain (which supports the flag)
|
|
|
|
# with Xcode-11 (the Clang of which doesn't support the flag).
|
2022-09-09 01:52:14 +00:00
|
|
|
message(
|
|
|
|
WARNING
|
2020-11-02 09:40:10 +00:00
|
|
|
"-fmacro-prefix-map flag is NOT supported by Clang shipped with Xcode-${XCODE_VERSION}."
|
2022-09-09 01:52:14 +00:00
|
|
|
" Some Xcode functionality in Product menu may not work. "
|
|
|
|
"Disabling WITH_COMPILER_SHORT_FILE_MACRO."
|
2020-11-02 09:40:10 +00:00
|
|
|
)
|
|
|
|
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(WITH_COMPILER_SHORT_FILE_MACRO)
|
2020-11-04 04:59:59 +00:00
|
|
|
path_ensure_trailing_slash(_src_dir "${CMAKE_SOURCE_DIR}")
|
|
|
|
path_ensure_trailing_slash(_bin_dir "${CMAKE_BINARY_DIR}")
|
2020-11-04 07:38:49 +00:00
|
|
|
# Keep this variable so it can be stripped from build-info.
|
|
|
|
set(PLATFORM_CFLAGS_FMACRO_PREFIX_MAP
|
|
|
|
"-fmacro-prefix-map=\"${_src_dir}\"=\"\" -fmacro-prefix-map=\"${_bin_dir}\"=\"\"")
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND PLATFORM_CFLAGS " ${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}")
|
2020-11-04 04:59:59 +00:00
|
|
|
unset(_src_dir)
|
|
|
|
unset(_bin_dir)
|
2020-11-02 09:40:10 +00:00
|
|
|
endif()
|
|
|
|
else()
|
2022-09-09 01:52:14 +00:00
|
|
|
message(
|
|
|
|
WARNING
|
2020-11-04 15:30:29 +00:00
|
|
|
"-fmacro-prefix-map flag is NOT supported by C/C++ compiler."
|
2020-11-02 09:40:10 +00:00
|
|
|
" Disabling WITH_COMPILER_SHORT_FILE_MACRO."
|
|
|
|
)
|
|
|
|
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)
|
|
|
|
endif()
|
2023-07-29 03:47:57 +00:00
|
|
|
unset(C_PREFIX_MAP_FLAGS)
|
|
|
|
unset(CXX_PREFIX_MAP_FLAGS)
|
2020-11-02 09:40:10 +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(
|
|
|
|
CYCLES_OSL
|
|
|
|
OSL_LIB_EXEC
|
|
|
|
OSL_COMPILER
|
|
|
|
OSL_LIB_COMP
|
|
|
|
OSL_LIB_QUERY
|
2014-12-29 09:48:21 +00:00
|
|
|
OSL_INCLUDE_DIR
|
2013-08-28 04:32:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
mark_as_advanced(
|
|
|
|
LLVM_CONFIG
|
2015-03-05 04:36:22 +00:00
|
|
|
LLVM_ROOT_DIR
|
2013-08-28 04:32:39 +00:00
|
|
|
LLVM_LIBRARY
|
|
|
|
LLVM_VERSION
|
|
|
|
)
|
|
|
|
|
2022-09-13 03:46:51 +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.
|
2009-10-19 16:20:12 +00:00
|
|
|
if(WITH_CXX_GUARDEDALLOC)
|
2011-05-24 06:44:39 +00:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/intern/guardedalloc)
|
2012-06-25 10:35:24 +00:00
|
|
|
add_definitions(-DWITH_CXX_GUARDEDALLOC)
|
2009-10-19 16:20:12 +00:00
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2010-12-15 10:22:26 +00:00
|
|
|
if(WITH_ASSERT_ABORT)
|
|
|
|
add_definitions(-DWITH_ASSERT_ABORT)
|
|
|
|
endif()
|
|
|
|
|
2023-12-06 22:49:42 +00:00
|
|
|
# NDEBUG is the standard C define to disable asserts.
|
|
|
|
if(WITH_ASSERT_RELEASE)
|
|
|
|
# CMake seemingly be setting the NDEBUG flag on its own already on some configurations
|
|
|
|
# therefore we need to remove the flags if they happen to be set.
|
|
|
|
remove_cc_flag("-DNDEBUG") # GCC/CLang
|
|
|
|
remove_cc_flag("/DNDEBUG") # MSVC
|
|
|
|
else()
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
|
|
|
|
$<$<CONFIG:Release>:NDEBUG>
|
|
|
|
$<$<CONFIG:MinSizeRel>:NDEBUG>
|
|
|
|
$<$<CONFIG:RelWithDebInfo>:NDEBUG>
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2010-12-16 12:48:30 +00:00
|
|
|
# message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
|
|
|
|
# message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}")
|
|
|
|
|
2024-01-03 13:49:11 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Testing Functions
|
|
|
|
|
|
|
|
include(build_files/cmake/testing.cmake)
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Add Sub-Directories
|
2010-12-06 10:56:37 +00:00
|
|
|
|
2018-04-16 13:54:36 +00:00
|
|
|
if(WITH_BLENDER)
|
2014-01-20 19:41:54 +00:00
|
|
|
add_subdirectory(intern)
|
|
|
|
add_subdirectory(extern)
|
2014-06-18 12:49:17 +00:00
|
|
|
|
|
|
|
# source after intern and extern to gather all
|
|
|
|
# internal and external library information first, for test linking
|
|
|
|
add_subdirectory(source)
|
2022-03-23 15:07:43 +00:00
|
|
|
elseif(WITH_CYCLES_STANDALONE OR WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
2021-01-18 06:43:42 +00:00
|
|
|
add_subdirectory(intern/guardedalloc)
|
|
|
|
add_subdirectory(intern/libc_compat)
|
|
|
|
add_subdirectory(intern/sky)
|
|
|
|
|
2014-01-20 19:41:54 +00:00
|
|
|
add_subdirectory(intern/cycles)
|
2021-01-18 06:43:42 +00:00
|
|
|
if(WITH_CYCLES_LOGGING)
|
|
|
|
if(NOT WITH_SYSTEM_GFLAGS)
|
|
|
|
add_subdirectory(extern/gflags)
|
|
|
|
endif()
|
|
|
|
add_subdirectory(extern/glog)
|
|
|
|
endif()
|
2016-01-14 07:24:09 +00:00
|
|
|
if(WITH_CUDA_DYNLOAD)
|
|
|
|
add_subdirectory(extern/cuew)
|
|
|
|
endif()
|
2021-09-28 14:51:14 +00:00
|
|
|
if(WITH_HIP_DYNLOAD)
|
|
|
|
add_subdirectory(extern/hipew)
|
|
|
|
endif()
|
2014-01-20 19:41:54 +00:00
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Add Testing Directory
|
|
|
|
|
2021-01-11 10:29:30 +00:00
|
|
|
add_subdirectory(tests)
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Add Blender Application
|
|
|
|
|
2011-07-13 08:15:06 +00:00
|
|
|
if(WITH_BLENDER)
|
|
|
|
add_subdirectory(source/creator)
|
|
|
|
endif()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2008-09-09 21:15:30 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Define 'heavy' sub-modules (for Ninja builder when using pools)
|
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
|
|
|
setup_heavy_lib_pool()
|
|
|
|
|
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
2011-02-15 18:33:05 +00:00
|
|
|
# CPack for generating packages
|
2022-09-13 03:46:51 +00:00
|
|
|
|
2011-02-15 18:33:05 +00:00
|
|
|
include(build_files/cmake/packaging.cmake)
|
2011-06-19 13:49:20 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Use Dynamic Loading for OpenMP
|
|
|
|
|
2016-07-18 13:16:45 +00:00
|
|
|
if(WITH_BLENDER)
|
|
|
|
openmp_delayload(blender)
|
2017-10-30 01:58:44 +00:00
|
|
|
endif()
|
2011-06-19 13:49:20 +00:00
|
|
|
|
2022-09-13 03:46:51 +00:00
|
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
2011-06-19 13:49:20 +00:00
|
|
|
# Print Final Configuration
|
|
|
|
|
|
|
|
if(FIRST_RUN)
|
2015-06-16 23:16:17 +00:00
|
|
|
|
|
|
|
set(_config_msg "\nBlender Configuration\n=====================")
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2015-06-16 23:16:17 +00:00
|
|
|
function(info_cfg_option
|
|
|
|
_setting
|
|
|
|
)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2015-06-16 23:16:17 +00:00
|
|
|
set(_msg " - ${_setting}")
|
2011-06-19 13:49:20 +00:00
|
|
|
string(LENGTH "${_msg}" _len)
|
2022-03-25 20:33:39 +00:00
|
|
|
while("36" GREATER "${_len}")
|
2020-11-05 23:29:04 +00:00
|
|
|
string(APPEND _msg " ")
|
2016-05-18 01:58:08 +00:00
|
|
|
math(EXPR _len "${_len} + 1")
|
2011-06-19 13:49:20 +00:00
|
|
|
endwhile()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2015-06-16 23:16:17 +00:00
|
|
|
set(_config_msg "${_config_msg}\n${_msg}${${_setting}}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2015-06-16 23:16:17 +00:00
|
|
|
function(info_cfg_text
|
|
|
|
_text
|
|
|
|
)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2015-06-16 23:16:17 +00:00
|
|
|
set(_config_msg "${_config_msg}\n\n ${_text}" PARENT_SCOPE)
|
|
|
|
endfunction()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2013-12-02 00:36:33 +00:00
|
|
|
message(STATUS "C Compiler: \"${CMAKE_C_COMPILER_ID}\"")
|
|
|
|
message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("Build Options:")
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_ALEMBIC)
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_option(WITH_BULLET)
|
2021-02-24 14:13:37 +00:00
|
|
|
info_cfg_option(WITH_CLANG)
|
2011-11-07 17:13:32 +00:00
|
|
|
info_cfg_option(WITH_CYCLES)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_FFTW3)
|
2013-05-24 10:15:20 +00:00
|
|
|
info_cfg_option(WITH_FREESTYLE)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_GMP)
|
2021-02-01 16:28:57 +00:00
|
|
|
info_cfg_option(WITH_HARU)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_IK_ITASC)
|
|
|
|
info_cfg_option(WITH_IK_SOLVER)
|
|
|
|
info_cfg_option(WITH_INPUT_NDOF)
|
2021-07-05 11:11:17 +00:00
|
|
|
info_cfg_option(WITH_INPUT_IME)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_INTERNATIONAL)
|
|
|
|
info_cfg_option(WITH_OPENCOLLADA)
|
2012-09-15 10:03:17 +00:00
|
|
|
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)
|
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
|
|
|
info_cfg_option(WITH_OPENVDB)
|
2021-01-26 14:27:57 +00:00
|
|
|
info_cfg_option(WITH_POTRACE)
|
|
|
|
info_cfg_option(WITH_PUGIXML)
|
2019-08-26 16:34:11 +00:00
|
|
|
info_cfg_option(WITH_QUADRIFLOW)
|
2020-05-04 21:58:48 +00:00
|
|
|
info_cfg_option(WITH_TBB)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_USD)
|
2022-12-05 22:18:54 +00:00
|
|
|
info_cfg_option(WITH_MATERIALX)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_XR_OPENXR)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("Compiler Options:")
|
|
|
|
info_cfg_option(WITH_BUILDINFO)
|
|
|
|
info_cfg_option(WITH_OPENMP)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("System Options:")
|
|
|
|
info_cfg_option(WITH_INSTALL_PORTABLE)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_MEM_JEMALLOC)
|
|
|
|
info_cfg_option(WITH_MEM_VALGRIND)
|
2022-10-08 02:15:09 +00:00
|
|
|
|
|
|
|
info_cfg_text("GHOST Options:")
|
|
|
|
info_cfg_option(WITH_GHOST_DEBUG)
|
|
|
|
info_cfg_option(WITH_GHOST_SDL)
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
info_cfg_option(WITH_GHOST_X11)
|
|
|
|
info_cfg_option(WITH_GHOST_WAYLAND)
|
|
|
|
if(WITH_GHOST_X11)
|
|
|
|
info_cfg_option(WITH_GHOST_XDND)
|
|
|
|
info_cfg_option(WITH_X11_XF86VMODE)
|
|
|
|
info_cfg_option(WITH_X11_XFIXES)
|
|
|
|
info_cfg_option(WITH_X11_XINPUT)
|
|
|
|
endif()
|
|
|
|
if(WITH_GHOST_WAYLAND)
|
|
|
|
info_cfg_option(WITH_GHOST_WAYLAND_DYNLOAD)
|
|
|
|
info_cfg_option(WITH_GHOST_WAYLAND_LIBDECOR)
|
|
|
|
endif()
|
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("Image Formats:")
|
|
|
|
info_cfg_option(WITH_IMAGE_CINEON)
|
|
|
|
info_cfg_option(WITH_IMAGE_OPENEXR)
|
|
|
|
info_cfg_option(WITH_IMAGE_OPENJPEG)
|
2023-03-10 01:48:35 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("Audio:")
|
|
|
|
info_cfg_option(WITH_CODEC_FFMPEG)
|
|
|
|
info_cfg_option(WITH_CODEC_SNDFILE)
|
2021-03-14 11:46:47 +00:00
|
|
|
info_cfg_option(WITH_COREAUDIO)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_JACK)
|
|
|
|
info_cfg_option(WITH_JACK_DYNLOAD)
|
|
|
|
info_cfg_option(WITH_OPENAL)
|
2021-03-02 16:29:18 +00:00
|
|
|
info_cfg_option(WITH_PULSEAUDIO)
|
|
|
|
info_cfg_option(WITH_PULSEAUDIO_DYNLOAD)
|
2021-03-23 06:41:46 +00:00
|
|
|
info_cfg_option(WITH_SDL)
|
|
|
|
info_cfg_option(WITH_SDL_DYNLOAD)
|
2021-03-11 18:22:56 +00:00
|
|
|
info_cfg_option(WITH_WASAPI)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("Compression:")
|
|
|
|
info_cfg_option(WITH_LZMA)
|
|
|
|
info_cfg_option(WITH_LZO)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2023-08-10 02:36:31 +00:00
|
|
|
if(WITH_PYTHON)
|
|
|
|
info_cfg_text("Python:")
|
|
|
|
info_cfg_option(WITH_PYTHON_INSTALL)
|
|
|
|
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
|
|
|
|
info_cfg_option(WITH_PYTHON_INSTALL_ZSTANDARD)
|
|
|
|
info_cfg_option(WITH_PYTHON_MODULE)
|
|
|
|
info_cfg_option(WITH_PYTHON_SAFETY)
|
|
|
|
endif()
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("Modifiers:")
|
|
|
|
info_cfg_option(WITH_MOD_FLUID)
|
2011-11-13 14:16:43 +00:00
|
|
|
info_cfg_option(WITH_MOD_OCEANSIM)
|
2020-11-06 07:15:25 +00:00
|
|
|
info_cfg_option(WITH_MOD_REMESH)
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2023-08-10 02:36:31 +00:00
|
|
|
info_cfg_text("Rendering:")
|
|
|
|
info_cfg_option(WITH_HYDRA)
|
|
|
|
|
2022-10-04 17:31:24 +00:00
|
|
|
if(WITH_CYCLES)
|
2023-08-10 02:36:31 +00:00
|
|
|
info_cfg_text("Rendering (Cycles):")
|
2022-10-04 17:31:24 +00:00
|
|
|
info_cfg_option(WITH_CYCLES_OSL)
|
|
|
|
info_cfg_option(WITH_CYCLES_EMBREE)
|
|
|
|
info_cfg_option(WITH_CYCLES_PATH_GUIDING)
|
|
|
|
if(NOT APPLE)
|
|
|
|
info_cfg_option(WITH_CYCLES_DEVICE_OPTIX)
|
|
|
|
info_cfg_option(WITH_CYCLES_DEVICE_CUDA)
|
|
|
|
info_cfg_option(WITH_CYCLES_CUDA_BINARIES)
|
|
|
|
info_cfg_option(WITH_CYCLES_DEVICE_ONEAPI)
|
|
|
|
info_cfg_option(WITH_CYCLES_ONEAPI_BINARIES)
|
2023-04-24 17:05:30 +00:00
|
|
|
info_cfg_option(WITH_CYCLES_DEVICE_HIP)
|
|
|
|
info_cfg_option(WITH_CYCLES_HIP_BINARIES)
|
|
|
|
endif()
|
|
|
|
if(WIN32)
|
|
|
|
info_cfg_option(WITH_CYCLES_DEVICE_HIPRT)
|
2022-10-04 17:31:24 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
info_cfg_text("")
|
2019-04-17 04:35:54 +00:00
|
|
|
|
2011-06-19 13:49:20 +00:00
|
|
|
message("${_config_msg}")
|
|
|
|
endif()
|
2014-11-16 11:57:42 +00:00
|
|
|
|
|
|
|
if(0)
|
|
|
|
print_all_vars()
|
|
|
|
endif()
|
2022-01-19 18:45:09 +00:00
|
|
|
|
|
|
|
# Should be the last step of configuration.
|
|
|
|
if(POSTCONFIGURE_SCRIPT)
|
|
|
|
include(${POSTCONFIGURE_SCRIPT})
|
|
|
|
endif()
|