Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-11-09 12:34:41 +0300
committerJeroen Bakker <jeroen@blender.org>2021-11-09 12:34:41 +0300
commitb65df10346f5fe47c881b183901e2d7eff775848 (patch)
tree95120de32f77d7193edc3687f0b97a0692288e8b /CMakeLists.txt
parent8bf8db8ca2dd534ce4aaa32a0921b599f36098c4 (diff)
parenta7540f4b3611a0d06f197e6f27148319927188f7 (diff)
Merge branch 'master' into tmp-vulkan
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt149
1 files changed, 98 insertions, 51 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2e8dc91776..8a622e52143 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,7 +30,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
"CMake generation for blender is not allowed within the source directory!"
"\n Remove \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" and try again from another folder, e.g.:"
"\n "
- "\n rm CMakeCache.txt"
+ "\n rm -rf CMakeCache.txt CMakeFiles"
"\n cd .."
"\n mkdir cmake-make"
"\n cd cmake-make"
@@ -110,6 +110,10 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
+# Install CODE|SCRIPT allow the use of generator expressions.
+if(POLICY CMP0087)
+ cmake_policy(SET CMP0087 NEW)
+endif()
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)
@@ -152,6 +156,15 @@ get_blender_version()
option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
mark_as_advanced(WITH_BLENDER)
+if(APPLE)
+ # Currently this causes a build error linking, disable.
+ set(WITH_BLENDER_THUMBNAILER OFF)
+elseif(WIN32)
+ option(WITH_BLENDER_THUMBNAILER "Build \"BlendThumb.dll\" helper for Windows explorer integration" ON)
+else()
+ option(WITH_BLENDER_THUMBNAILER "Build \"blender-thumbnailer\" thumbnail extraction utility" ON)
+endif()
+
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
@@ -349,7 +362,7 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# Misc
-if(WIN32)
+if(WIN32 OR APPLE)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
endif()
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
@@ -384,46 +397,59 @@ if(WITH_PYTHON_INSTALL)
set(PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module")
mark_as_advanced(PYTHON_REQUESTS_PATH)
endif()
+
+ option(WITH_PYTHON_INSTALL_ZSTANDARD "Copy zstandard into the blender install folder" ON)
+ set(PYTHON_ZSTANDARD_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'zstandard' module")
+ mark_as_advanced(PYTHON_ZSTANDARD_PATH)
endif()
option(WITH_CPU_SIMD "Enable SIMD instruction if they're detected on the host machine" ON)
mark_as_advanced(WITH_CPU_SIMD)
# Cycles
-option(WITH_CYCLES "Enable Cycles Render Engine" ON)
-option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
-option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
-option(WITH_CYCLES_OSL "Build Cycles with OSL support" ON)
-option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
-option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
-option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
-option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
-mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
-set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX OPENCL)" )
-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 compute_75 CACHE STRING "CUDA architectures to build binaries for")
-mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
-unset(PLATFORM_DEFAULT)
-option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
-option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
-option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
-option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
+option(WITH_CYCLES "Enable Cycles Render Engine" ON)
+option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage 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_STANDALONE "Build Cycles standalone application" OFF)
+option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
+
+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)" )
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
-mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING)
-mark_as_advanced(WITH_CYCLES_DEBUG)
+mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
-option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
-option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" OFF)
-option(WITH_CYCLES_DEVICE_OPENCL "Enable Cycles OpenCL compute support" ON)
-option(WITH_CYCLES_NETWORK "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF)
+# NVIDIA CUDA & OptiX
+option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles NVIDIA CUDA compute support" ON)
+option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles NVIDIA OptiX support" ON)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
-mark_as_advanced(WITH_CYCLES_DEVICE_OPENCL)
-mark_as_advanced(WITH_CYCLES_NETWORK)
-option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
+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 compute_75 CACHE STRING "CUDA architectures to build binaries for")
+option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
+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)
+mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
+mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
+mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
mark_as_advanced(WITH_CUDA_DYNLOAD)
+# AMD HIP
+option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" OFF)
+option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
+set(CYCLES_HIP_BINARIES_ARCH gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 CACHE STRING "AMD HIP architectures to build binaries for")
+mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
+mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
+
+# Draw Manager
+option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
+mark_as_advanced(WITH_DRAW_DEBUG)
+
# LLVM
option(WITH_LLVM "Use LLVM" OFF)
if(APPLE)
@@ -609,12 +635,6 @@ if(WIN32)
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
- option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
- mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
-
- option(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON)
- mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
-
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
@@ -627,11 +647,23 @@ if(WIN32)
option(WITH_WINDOWS_PDB "Generate a pdb file for client side stacktraces" ON)
mark_as_advanced(WITH_WINDOWS_PDB)
- option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" On)
+ option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" ON)
mark_as_advanced(WITH_WINDOWS_STRIPPED_PDB)
endif()
+if(WIN32 OR XCODE)
+ option(IDE_GROUP_SOURCES_IN_FOLDERS "Organize the source files in filters matching the source folders." ON)
+ mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
+
+ option(IDE_GROUP_PROJECTS_IN_FOLDERS "Organize the projects according to source folder structure." ON)
+ mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
+
+ if (IDE_GROUP_PROJECTS_IN_FOLDERS)
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ endif()
+endif()
+
if(UNIX)
# See WITH_WINDOWS_SCCACHE for Windows.
option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF)
@@ -816,6 +848,11 @@ if(NOT WITH_CUDA_DYNLOAD)
endif()
endif()
+if(WITH_CYCLES_DEVICE_HIP)
+ # Currently HIP must be dynamically loaded, this may change in future toolkits
+ set(WITH_HIP_DYNLOAD ON)
+endif()
+
#-----------------------------------------------------------------------------
# Check check if submodules are cloned
@@ -1601,6 +1638,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
+ # Using C++20 features while having C++17 as the project language isn't allowed by MSVC.
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_CXX20_DESIGNATOR -Wc++20-designator)
+
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
@@ -1720,24 +1760,26 @@ if(WITH_PYTHON)
elseif(WITH_PYTHON_INSTALL_REQUESTS)
find_python_package(requests "")
endif()
+
+ if(WIN32 OR APPLE)
+ # pass, we have this in lib/python/site-packages
+ elseif(WITH_PYTHON_INSTALL_ZSTANDARD)
+ find_python_package(zstandard "")
+ endif()
endif()
-if(MSVC)
- string(APPEND CMAKE_CXX_FLAGS " /std:c++17")
- # Make MSVC properly report the value of the __cplusplus preprocessor macro
- # Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
- # of the C++ standard chosen above
- if(MSVC_VERSION GREATER 1913)
- string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
- endif()
-elseif(
- CMAKE_COMPILER_IS_GNUCC OR
- CMAKE_C_COMPILER_ID MATCHES "Clang" OR
- CMAKE_C_COMPILER_ID MATCHES "Intel"
-)
- string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
-else()
- message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
+# 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)
+# Do not enable compiler specific language extentions.
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+# Make MSVC properly report the value of the __cplusplus preprocessor macro
+# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
+# of the C++ standard chosen above.
+if(MSVC AND MSVC_VERSION GREATER 1913)
+ string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
# Visual Studio has all standards it supports available by default
@@ -1858,6 +1900,9 @@ elseif(WITH_CYCLES_STANDALONE)
if(WITH_CUDA_DYNLOAD)
add_subdirectory(extern/cuew)
endif()
+ if(WITH_HIP_DYNLOAD)
+ add_subdirectory(extern/hipew)
+ endif()
if(NOT WITH_SYSTEM_GLEW)
add_subdirectory(extern/glew)
endif()
@@ -1932,6 +1977,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
+ info_cfg_option(WITH_INPUT_IME)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_OPENCOLORIO)
@@ -1991,6 +2037,7 @@ if(FIRST_RUN)
endif()
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)