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:
Diffstat (limited to 'build_files')
-rw-r--r--build_files/build_environment/CMakeLists.txt2
-rw-r--r--build_files/build_environment/cmake/check_software.cmake14
-rw-r--r--build_files/build_environment/cmake/download.cmake3
-rw-r--r--build_files/build_environment/cmake/epoxy.cmake25
-rw-r--r--build_files/build_environment/cmake/glew.cmake16
-rw-r--r--build_files/build_environment/cmake/harvest.cmake7
-rw-r--r--build_files/build_environment/cmake/python.cmake1
-rw-r--r--build_files/build_environment/cmake/sse2neon.cmake4
-rw-r--r--build_files/build_environment/cmake/versions.cmake21
-rwxr-xr-xbuild_files/build_environment/install_deps.sh35
-rw-r--r--build_files/build_environment/patches/cmakelists_glew.txt2
-rw-r--r--build_files/build_environment/patches/dpcpp.diff18
-rw-r--r--build_files/build_environment/patches/epoxy.diff19
-rw-r--r--build_files/build_environment/patches/python_windows.diff24
-rw-r--r--build_files/cmake/Modules/FindEpoxy.cmake47
-rw-r--r--build_files/cmake/Modules/FindGLEW.cmake58
-rw-r--r--build_files/cmake/Modules/FindLibEpoxy.cmake47
-rw-r--r--build_files/cmake/Modules/FindOpenGLES.cmake80
-rw-r--r--build_files/cmake/Modules/FindPythonLibsUnix.cmake16
-rw-r--r--build_files/cmake/Modules/GTest.cmake3
-rw-r--r--build_files/cmake/Modules/GTestTesting.cmake6
-rw-r--r--build_files/cmake/buildinfo.cmake4
-rw-r--r--build_files/cmake/cmake_static_check_cppcheck.py61
-rw-r--r--build_files/cmake/config/blender_lite.cmake3
-rw-r--r--build_files/cmake/config/blender_release.cmake4
-rw-r--r--build_files/cmake/config/bpy_module.cmake92
-rw-r--r--build_files/cmake/have_features.cmake33
-rw-r--r--build_files/cmake/macros.cmake86
-rw-r--r--build_files/cmake/packaging.cmake6
-rw-r--r--build_files/cmake/platform/platform_apple.cmake100
-rw-r--r--build_files/cmake/platform/platform_unix.cmake204
-rw-r--r--build_files/cmake/platform/platform_win32.cmake25
-rw-r--r--build_files/cmake/platform/platform_win32_bundle_crt.cmake26
-rw-r--r--build_files/cmake/project_source_info.py4
-rwxr-xr-xbuild_files/utils/make_bpy_wheel.py222
-rwxr-xr-xbuild_files/utils/make_source_archive.py66
-rwxr-xr-xbuild_files/utils/make_utils.py84
37 files changed, 978 insertions, 490 deletions
diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt
index 856fe7b32ff..ee8a9a26c53 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -53,8 +53,8 @@ include(cmake/imath.cmake)
include(cmake/openexr.cmake)
include(cmake/brotli.cmake)
include(cmake/freetype.cmake)
+include(cmake/epoxy.cmake)
include(cmake/freeglut.cmake)
-include(cmake/glew.cmake)
include(cmake/alembic.cmake)
include(cmake/opensubdiv.cmake)
include(cmake/sdl.cmake)
diff --git a/build_files/build_environment/cmake/check_software.cmake b/build_files/build_environment/cmake/check_software.cmake
index 080c1e52973..cc8fead6f81 100644
--- a/build_files/build_environment/cmake/check_software.cmake
+++ b/build_files/build_environment/cmake/check_software.cmake
@@ -12,21 +12,13 @@ if(UNIX)
automake
bison
${_libtoolize_name}
+ meson
+ ninja
pkg-config
tclsh
yasm
)
- if(NOT APPLE)
- set(_required_software
- ${_required_software}
-
- # Needed for Mesa.
- meson
- ninja
- )
- endif()
-
foreach(_software ${_required_software})
find_program(_software_find NAMES ${_software})
if(NOT _software_find)
@@ -57,7 +49,7 @@ if(UNIX)
" apt install autoconf automake libtool yasm tcl ninja-build meson python3-mako\n"
"\n"
"On macOS (with homebrew):\n"
- " brew install autoconf automake bison flex libtool pkg-config yasm\n"
+ " brew install autoconf automake bison flex libtool meson ninja pkg-config yasm\n"
"\n"
"Other platforms:\n"
" Install equivalent packages.\n")
diff --git a/build_files/build_environment/cmake/download.cmake b/build_files/build_environment/cmake/download.cmake
index 547bf77f8dd..6f0dd80ea6a 100644
--- a/build_files/build_environment/cmake/download.cmake
+++ b/build_files/build_environment/cmake/download.cmake
@@ -36,7 +36,7 @@ download_source(BLOSC)
download_source(PTHREADS)
download_source(OPENEXR)
download_source(FREETYPE)
-download_source(GLEW)
+download_source(EPOXY)
download_source(FREEGLUT)
download_source(ALEMBIC)
download_source(OPENSUBDIV)
@@ -94,6 +94,7 @@ download_source(GMP)
download_source(POTRACE)
download_source(HARU)
download_source(ZSTD)
+download_source(SSE2NEON)
download_source(FLEX)
download_source(BROTLI)
download_source(FMT)
diff --git a/build_files/build_environment/cmake/epoxy.cmake b/build_files/build_environment/cmake/epoxy.cmake
new file mode 100644
index 00000000000..4cd9158f2ac
--- /dev/null
+++ b/build_files/build_environment/cmake/epoxy.cmake
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+if(WIN32)
+ set(EPOXY_LIB_TYPE shared)
+else()
+ set(EPOXY_LIB_TYPE static)
+endif()
+ExternalProject_Add(external_epoxy
+ URL file://${PACKAGE_DIR}/${EPOXY_FILE}
+ DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ URL_HASH ${EPOXY_HASH_TYPE}=${EPOXY_HASH}
+ PREFIX ${BUILD_DIR}/epoxy
+ PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/epoxy/src/external_epoxy/ < ${PATCH_DIR}/epoxy.diff
+ CONFIGURE_COMMAND ${CONFIGURE_ENV} && meson setup --prefix ${LIBDIR}/epoxy --default-library ${EPOXY_LIB_TYPE} --libdir lib ${BUILD_DIR}/epoxy/src/external_epoxy-build ${BUILD_DIR}/epoxy/src/external_epoxy -Dtests=false
+ BUILD_COMMAND ninja
+ INSTALL_COMMAND ninja install
+)
+
+if(BUILD_MODE STREQUAL Release AND WIN32)
+ ExternalProject_Add_Step(external_epoxy after_install
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/epoxy/include ${HARVEST_TARGET}/epoxy/include
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/epoxy/bin/epoxy-0.dll ${HARVEST_TARGET}/epoxy/bin/epoxy-0.dll
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/epoxy/lib/epoxy.lib ${HARVEST_TARGET}/epoxy/lib/epoxy.lib
+ DEPENDEES install
+ )
+endif()
diff --git a/build_files/build_environment/cmake/glew.cmake b/build_files/build_environment/cmake/glew.cmake
deleted file mode 100644
index 0745ad01533..00000000000
--- a/build_files/build_environment/cmake/glew.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-set(GLEW_EXTRA_ARGS
- -DBUILD_UTILS=Off
- -DBUILD_SHARED_LIBS=Off
-)
-
-ExternalProject_Add(external_glew
- URL file://${PACKAGE_DIR}/${GLEW_FILE}
- DOWNLOAD_DIR ${DOWNLOAD_DIR}
- URL_HASH ${GLEW_HASH_TYPE}=${GLEW_HASH}
- PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_glew.txt ${BUILD_DIR}/glew/src/external_glew/CMakeLists.txt
- PREFIX ${BUILD_DIR}/glew
- CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glew ${DEFAULT_CMAKE_FLAGS} ${GLEW_EXTRA_ARGS}
- INSTALL_DIR ${LIBDIR}/glew
-)
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index 7ebad7a3da2..6ed98398fde 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -22,9 +22,6 @@ if(BUILD_MODE STREQUAL Release)
# freeglut-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
- # glew-> opengl
- ${CMAKE_COMMAND} -E copy ${LIBDIR}/glew/lib/libglew32.lib ${HARVEST_TARGET}/opengl/lib/glew.lib &&
- ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ &&
DEPENDS
)
endif()
@@ -75,8 +72,8 @@ harvest(fftw3/lib fftw3/lib "*.a")
harvest(flac/lib sndfile/lib "libFLAC.a")
harvest(freetype/include freetype/include "*.h")
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
-harvest(glew/include glew/include "*.h")
-harvest(glew/lib glew/lib "*.a")
+harvest(epoxy/include epoxy/include "*.h")
+harvest(epoxy/lib epoxy/lib "*.a")
harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
diff --git a/build_files/build_environment/cmake/python.cmake b/build_files/build_environment/cmake/python.cmake
index 3f45333ed3d..8fed10e9d72 100644
--- a/build_files/build_environment/cmake/python.cmake
+++ b/build_files/build_environment/cmake/python.cmake
@@ -27,6 +27,7 @@ if(WIN32)
PREFIX ${BUILD_DIR}/python
CONFIGURE_COMMAND ""
BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p x64 -c ${BUILD_MODE}
+ PATCH_COMMAND ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_windows.diff
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-stable --include-pip --include-dev --include-launchers --include-venv --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
)
diff --git a/build_files/build_environment/cmake/sse2neon.cmake b/build_files/build_environment/cmake/sse2neon.cmake
index 2216ad43d59..07fe1ac6f39 100644
--- a/build_files/build_environment/cmake/sse2neon.cmake
+++ b/build_files/build_environment/cmake/sse2neon.cmake
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_sse2neon
- GIT_REPOSITORY ${SSE2NEON_GIT}
- GIT_TAG ${SSE2NEON_GIT_HASH}
+ URL file://${PACKAGE_DIR}/${SSE2NEON_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
+ URL_HASH ${SSE2NEON_HASH_TYPE}=${SSE2NEON_HASH}
PREFIX ${BUILD_DIR}/sse2neon
CONFIGURE_COMMAND echo sse2neon - Nothing to configure
BUILD_COMMAND echo sse2neon - nothing to build
diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake
index d0bcdc21b20..95425300923 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -80,11 +80,11 @@ set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
set(FREETYPE_HASH_TYPE MD5)
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
-set(GLEW_VERSION 1.13.0)
-set(GLEW_URI http://prdownloads.sourceforge.net/glew/glew/${GLEW_VERSION}/glew-${GLEW_VERSION}.tgz)
-set(GLEW_HASH 7cbada3166d2aadfc4169c4283701066)
-set(GLEW_HASH_TYPE MD5)
-set(GLEW_FILE glew-${GLEW_VERSION}.tgz)
+set(EPOXY_VERSION 1.5.10)
+set(EPOXY_URI https://github.com/anholt/libepoxy/archive/refs/tags/${EPOXY_VERSION}.tar.gz)
+set(EPOXY_HASH f0730aad115c952e77591fcc805b1dc1)
+set(EPOXY_HASH_TYPE MD5)
+set(EPOXY_FILE libepoxy-${EPOXY_VERSION}.tar.gz)
set(FREEGLUT_VERSION 3.0.0)
set(FREEGLUT_URI http://prdownloads.sourceforge.net/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz)
@@ -488,8 +488,11 @@ set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
-set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
-set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
+set(SSE2NEON_VERSION fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
+set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
+set(SSE2NEON_HASH 0780253525d299c31775ef95853698d03db9c7739942af8570000f4a25a5d605)
+set(SSE2NEON_HASH_TYPE SHA256)
+set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
set(BROTLI_VERSION v1.0.9)
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSION}.tar.gz)
@@ -503,9 +506,9 @@ set(LEVEL_ZERO_HASH c39bb05a8e5898aa6c444e1704105b93d3f1888b9c333f8e7e73825ffbfb
set(LEVEL_ZERO_HASH_TYPE SHA256)
set(LEVEL_ZERO_FILE level-zero-${LEVEL_ZERO_VERSION}.tar.gz)
-set(DPCPP_VERSION 20220620)
+set(DPCPP_VERSION 20220812)
set(DPCPP_URI https://github.com/intel/llvm/archive/refs/tags/sycl-nightly/${DPCPP_VERSION}.tar.gz)
-set(DPCPP_HASH a5f41abd5229d28afa92cbd8a5d8d786ee698bf239f722929fd686276bad692c)
+set(DPCPP_HASH 0e3c95346c295f5cf80f3a42d80b1c49481955898530242636ddc002627248d6)
set(DPCPP_HASH_TYPE SHA256)
set(DPCPP_FILE DPCPP-${DPCPP_VERSION}.tar.gz)
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 4ffdbf2d162..287a7a0c962 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -136,7 +136,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
Build and install the OpenImageDenoise libraries.
--with-nanovdb
- Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB).
+ Build and install NanoVDB together with OpenVDB.
--with-jack
Install the jack libraries.
@@ -385,7 +385,7 @@ CLANG_FORMAT_VERSION="10.0"
CLANG_FORMAT_VERSION_MIN="6.0"
CLANG_FORMAT_VERSION_MEX="14.0"
-PYTHON_VERSION="3.10.2"
+PYTHON_VERSION="3.10.6"
PYTHON_VERSION_SHORT="3.10"
PYTHON_VERSION_MIN="3.10"
PYTHON_VERSION_MEX="3.12"
@@ -425,7 +425,7 @@ PYTHON_ZSTANDARD_VERSION_MIN="0.15.2"
PYTHON_ZSTANDARD_VERSION_MEX="0.20.0"
PYTHON_ZSTANDARD_NAME="zstandard"
-PYTHON_NUMPY_VERSION="1.22.0"
+PYTHON_NUMPY_VERSION="1.23.2"
PYTHON_NUMPY_VERSION_MIN="1.14"
PYTHON_NUMPY_VERSION_MEX="2.0"
PYTHON_NUMPY_NAME="numpy"
@@ -453,8 +453,8 @@ PYTHON_MODULES_PIP=(
)
-BOOST_VERSION="1.78.0"
-BOOST_VERSION_SHORT="1.78"
+BOOST_VERSION="1.80.0"
+BOOST_VERSION_SHORT="1.80"
BOOST_VERSION_MIN="1.49"
BOOST_VERSION_MEX="2.0"
BOOST_FORCE_BUILD=false
@@ -496,7 +496,7 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
_with_built_openexr=false
-OIIO_VERSION="2.3.13.0"
+OIIO_VERSION="2.3.18.0"
OIIO_VERSION_SHORT="2.3"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MEX="2.4.0"
@@ -534,10 +534,10 @@ OSD_SKIP=false
# OpenVDB needs to be compiled for now
OPENVDB_BLOSC_VERSION="1.21.1"
-OPENVDB_VERSION="9.0.0"
-OPENVDB_VERSION_SHORT="9.0"
+OPENVDB_VERSION="9.1.0"
+OPENVDB_VERSION_SHORT="9.1"
OPENVDB_VERSION_MIN="9.0"
-OPENVDB_VERSION_MEX="9.1"
+OPENVDB_VERSION_MEX="9.2"
OPENVDB_FORCE_BUILD=false
OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false
@@ -1193,7 +1193,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
* libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
- * libsdl2, libglew, libpugixml, libpotrace, [libgmp], fontconfig, [libharu/libhpdf].\""
+ * libsdl2, libepoxy, libpugixml, libpotrace, [libgmp], fontconfig, [libharu/libhpdf].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -2919,6 +2919,10 @@ compile_OPENVDB() {
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
+ # Unfortunately OpenVDB currently forces using recent oneTBB over older versions when it finds it,
+ # even when TBB_ROOT is specified. So have to prevent any check for system library -
+ # in the hope it will not break in some other cases.
+ cmake_d="$cmake_d -D DISABLE_CMAKE_SEARCH_PATHS=ON"
if [ "$WITH_NANOVDB" = true ]; then
cmake_d="$cmake_d -D USE_NANOVDB=ON"
@@ -2931,7 +2935,6 @@ compile_OPENVDB() {
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
- cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
fi
if [ -d $INST/tbb ]; then
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
@@ -3195,7 +3198,7 @@ _init_opencollada() {
_inst_shortcut=$INST/opencollada
}
-_update_deps_collada() {
+_update_deps_opencollada() {
:
}
@@ -4062,7 +4065,7 @@ install_DEB() {
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
- libopenal-dev libglew-dev yasm \
+ libopenal-dev libepoxy-dev yasm \
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev"
@@ -4772,7 +4775,7 @@ install_RPM() {
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wayland-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
- glew-devel yasm patch \
+ libepoxy-devel yasm patch \
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
gmp-devel pugixml-devel potrace-devel libharu-devel libzstd-devel pystring-devel"
@@ -5412,7 +5415,7 @@ install_ARCH() {
fi
_packages="$BASE_DEVEL git cmake fontconfig flex \
- libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
+ libxi libxcursor libxrandr libxinerama libepoxy libpng libtiff wget openal \
$OPENJPEG_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \
zstd pystring"
@@ -6215,7 +6218,7 @@ print_info() {
fi
if [ -d $INST/nanovdb ]; then
_1="-D WITH_NANOVDB=ON"
- _2="-D NANOVDB_ROOT_DIR=$INST/nanovdb"
+ _2="-D NANOVDB_ROOT_DIR=$INST/openvdb"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
diff --git a/build_files/build_environment/patches/cmakelists_glew.txt b/build_files/build_environment/patches/cmakelists_glew.txt
deleted file mode 100644
index ec36d4bde63..00000000000
--- a/build_files/build_environment/patches/cmakelists_glew.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-cmake_minimum_required (VERSION 2.4)
-add_subdirectory(build/cmake) \ No newline at end of file
diff --git a/build_files/build_environment/patches/dpcpp.diff b/build_files/build_environment/patches/dpcpp.diff
index 9dbe032de0c..4a65a6c6cf0 100644
--- a/build_files/build_environment/patches/dpcpp.diff
+++ b/build_files/build_environment/patches/dpcpp.diff
@@ -1,21 +1,3 @@
-diff -Naur external_dpcpp.orig/sycl/source/CMakeLists.txt external_dpcpp/sycl/source/CMakeLists.txt
---- external_dpcpp.orig/sycl/source/CMakeLists.txt 2022-05-20 04:19:45.067771362 +0000
-+++ external_dpcpp/sycl/source/CMakeLists.txt 2022-05-20 04:21:49.708025048 +0000
-@@ -66,10 +66,10 @@
- target_compile_options(${LIB_OBJ_NAME} PUBLIC
- -fvisibility=hidden -fvisibility-inlines-hidden)
- set(linker_script "${CMAKE_CURRENT_SOURCE_DIR}/ld-version-script.txt")
-- set(abi_linker_script "${CMAKE_CURRENT_SOURCE_DIR}/abi_replacements_linux.txt")
-- target_link_libraries(
-- ${LIB_NAME} PRIVATE "-Wl,${abi_linker_script}")
-- set_target_properties(${LIB_NAME} PROPERTIES LINK_DEPENDS ${abi_linker_script})
-+# set(abi_linker_script "${CMAKE_CURRENT_SOURCE_DIR}/abi_replacements_linux.txt")
-+# target_link_libraries(
-+# ${LIB_NAME} PRIVATE "-Wl,${abi_linker_script}")
-+# set_target_properties(${LIB_NAME} PROPERTIES LINK_DEPENDS ${abi_linker_script})
- target_link_libraries(
- ${LIB_NAME} PRIVATE "-Wl,--version-script=${linker_script}")
- set_target_properties(${LIB_NAME} PROPERTIES LINK_DEPENDS ${linker_script})
diff -Naur llvm-sycl-nightly-20220501.orig\opencl/CMakeLists.txt llvm-sycl-nightly-20220501\opencl/CMakeLists.txt
--- llvm-sycl-nightly-20220501.orig/opencl/CMakeLists.txt 2022-04-29 13:47:11 -0600
+++ llvm-sycl-nightly-20220501/opencl/CMakeLists.txt 2022-05-21 15:25:06 -0600
diff --git a/build_files/build_environment/patches/epoxy.diff b/build_files/build_environment/patches/epoxy.diff
new file mode 100644
index 00000000000..b0c3d7ea1dc
--- /dev/null
+++ b/build_files/build_environment/patches/epoxy.diff
@@ -0,0 +1,19 @@
+--- a/src/dispatch_wgl.c 2022-08-04 17:45:13.144924705 +0200
++++ b/src/dispatch_wgl.c 2022-08-04 17:45:47.657482971 +0200
+@@ -78,6 +78,8 @@
+ if (!first_context_current) {
+ first_context_current = true;
+ } else {
++ /* BLENDER: disable slow dispatch table switching. */
++#if 0
+ if (!already_switched_to_dispatch_table) {
+ already_switched_to_dispatch_table = true;
+ gl_switch_to_dispatch_table();
+@@ -86,6 +88,7 @@
+
+ gl_init_dispatch_table();
+ wgl_init_dispatch_table();
++#endif
+ }
+ }
+
diff --git a/build_files/build_environment/patches/python_windows.diff b/build_files/build_environment/patches/python_windows.diff
new file mode 100644
index 00000000000..f9c89a90fde
--- /dev/null
+++ b/build_files/build_environment/patches/python_windows.diff
@@ -0,0 +1,24 @@
+diff -Naur orig/PCbuild/get_externals.bat Python-3.10.2/PCbuild/get_externals.bat
+--- orig/PCbuild/get_externals.bat 2022-01-13 11:52:14 -0700
++++ Python-3.10.2/PCbuild/get_externals.bat 2022-08-17 11:24:42 -0600
+@@ -51,7 +51,7 @@
+ echo.Fetching external libraries...
+
+ set libraries=
+-set libraries=%libraries% bzip2-1.0.6
++set libraries=%libraries% bzip2-1.0.8
+ if NOT "%IncludeLibffiSrc%"=="false" set libraries=%libraries% libffi-3.3.0
+ if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.1m
+ set libraries=%libraries% sqlite-3.35.5.0
+ diff -Naur orig/PCbuild/python.props external_python/PCbuild/python.props
+--- orig/PCbuild/python.props 2022-01-13 11:52:14 -0700
++++ external_python/PCbuild/python.props 2022-08-17 11:38:38 -0600
+@@ -58,7 +58,7 @@
+ <ExternalsDir Condition="$(ExternalsDir) == ''">$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`))</ExternalsDir>
+ <ExternalsDir Condition="!HasTrailingSlash($(ExternalsDir))">$(ExternalsDir)\</ExternalsDir>
+ <sqlite3Dir>$(ExternalsDir)sqlite-3.35.5.0\</sqlite3Dir>
+- <bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
++ <bz2Dir>$(ExternalsDir)bzip2-1.0.8\</bz2Dir>
+ <lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
+ <libffiDir>$(ExternalsDir)libffi-3.3.0\</libffiDir>
+ <libffiOutDir>$(ExternalsDir)libffi-3.3.0\$(ArchName)\</libffiOutDir>
diff --git a/build_files/cmake/Modules/FindEpoxy.cmake b/build_files/cmake/Modules/FindEpoxy.cmake
new file mode 100644
index 00000000000..7cd26e45398
--- /dev/null
+++ b/build_files/cmake/Modules/FindEpoxy.cmake
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2022 Blender Foundation.
+
+# This module defines
+# Epoxy_INCLUDE_DIRS, where to find epoxy/gl.h
+# Epoxy_LIBRARY, where to find the epoxy library.
+# Epoxy_ROOT_DIR, The base directory to search for epoxy.
+# This can also be an environment variable.
+# Epoxy_FOUND, If false, do not try to use epoxy.
+
+IF(NOT EPOXY_ROOT_DIR AND NOT $ENV{EPOXY_ROOT_DIR} STREQUAL "")
+ SET(EPOXY_ROOT_DIR $ENV{EPOXY_ROOT_DIR})
+ENDIF()
+
+FIND_PATH(Epoxy_INCLUDE_DIR
+ NAMES
+ epoxy/gl.h
+ HINTS
+ ${EPOXY_ROOT_DIR}
+ PATH_SUFFIXES
+ include
+)
+
+FIND_LIBRARY(Epoxy_LIBRARY
+ NAMES
+ epoxy
+ HINTS
+ ${EPOXY_ROOT_DIR}
+ PATH_SUFFIXES
+ lib64 lib
+)
+
+# handle the QUIETLY and REQUIRED arguments and set Epoxy_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Epoxy DEFAULT_MSG
+ Epoxy_LIBRARY Epoxy_INCLUDE_DIR)
+
+IF(Epoxy_FOUND)
+ SET(Epoxy_INCLUDE_DIRS ${Epoxy_INCLUDE_DIR})
+ SET(Epoxy_LIBRARIES ${Epoxy_LIBRARY})
+ENDIF()
+
+MARK_AS_ADVANCED(
+ Epoxy_INCLUDE_DIR
+ Epoxy_LIBRARY
+)
diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake
deleted file mode 100644
index 33b989ec49e..00000000000
--- a/build_files/cmake/Modules/FindGLEW.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2014 Blender Foundation.
-
-# - Find GLEW library
-# Find the native Glew includes and library
-# This module defines
-# GLEW_INCLUDE_DIRS, where to find glew.h, Set when
-# GLEW_INCLUDE_DIR is found.
-# GLEW_ROOT_DIR, The base directory to search for Glew.
-# This can also be an environment variable.
-# GLEW_FOUND, If false, do not try to use Glew.
-#
-# also defined,
-# GLEW_LIBRARY, where to find the Glew library.
-
-# If GLEW_ROOT_DIR was defined in the environment, use it.
-IF(NOT GLEW_ROOT_DIR AND NOT $ENV{GLEW_ROOT_DIR} STREQUAL "")
- SET(GLEW_ROOT_DIR $ENV{GLEW_ROOT_DIR})
-ENDIF()
-
-SET(_glew_SEARCH_DIRS
- ${GLEW_ROOT_DIR}
-)
-
-FIND_PATH(GLEW_INCLUDE_DIR
- NAMES
- GL/glew.h
- HINTS
- ${_glew_SEARCH_DIRS}
- PATH_SUFFIXES
- include
-)
-
-FIND_LIBRARY(GLEW_LIBRARY
- NAMES
- GLEW
- HINTS
- ${_glew_SEARCH_DIRS}
- PATH_SUFFIXES
- lib64 lib
- )
-
-# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG
- GLEW_LIBRARY GLEW_INCLUDE_DIR)
-
-IF(GLEW_FOUND)
- SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
-ENDIF()
-
-MARK_AS_ADVANCED(
- GLEW_INCLUDE_DIR
- GLEW_LIBRARY
-)
-
-UNSET(_glew_SEARCH_DIRS)
diff --git a/build_files/cmake/Modules/FindLibEpoxy.cmake b/build_files/cmake/Modules/FindLibEpoxy.cmake
new file mode 100644
index 00000000000..1da52f95f68
--- /dev/null
+++ b/build_files/cmake/Modules/FindLibEpoxy.cmake
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2022 Blender Foundation.
+
+# This module defines
+# LibEpoxy_INCLUDE_DIRS, where to find epoxy/gl.h
+# LibEpoxy_LIBRARY, where to find the epoxy library.
+# LibEpoxy_ROOT_DIR, The base directory to search for libepoxy.
+# This can also be an environment variable.
+# LibEpoxy_FOUND, If false, do not try to use libepoxy.
+
+IF(NOT EPOXY_ROOT_DIR AND NOT $ENV{EPOXY_ROOT_DIR} STREQUAL "")
+ SET(EPOXY_ROOT_DIR $ENV{EPOXY_ROOT_DIR})
+ENDIF()
+
+FIND_PATH(LibEpoxy_INCLUDE_DIR
+ NAMES
+ epoxy/gl.h
+ HINTS
+ ${EPOXY_ROOT_DIR}
+ PATH_SUFFIXES
+ include
+)
+
+FIND_LIBRARY(LibEpoxy_LIBRARY
+ NAMES
+ epoxy
+ HINTS
+ ${EPOXY_ROOT_DIR}
+ PATH_SUFFIXES
+ lib64 lib
+)
+
+# handle the QUIETLY and REQUIRED arguments and set LibEpoxy_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibEpoxy DEFAULT_MSG
+ LibEpoxy_LIBRARY LibEpoxy_INCLUDE_DIR)
+
+IF(LibEpoxy_FOUND)
+ SET(LibEpoxy_INCLUDE_DIRS ${LibEpoxy_INCLUDE_DIR})
+ SET(LibEpoxy_LIBRARIES ${LibEpoxy_LIBRARY})
+ENDIF()
+
+MARK_AS_ADVANCED(
+ LibEpoxy_INCLUDE_DIR
+ LibEpoxy_LIBRARY
+)
diff --git a/build_files/cmake/Modules/FindOpenGLES.cmake b/build_files/cmake/Modules/FindOpenGLES.cmake
deleted file mode 100644
index 5e82984bed6..00000000000
--- a/build_files/cmake/Modules/FindOpenGLES.cmake
+++ /dev/null
@@ -1,80 +0,0 @@
-# SPDX-License-Identifier: BSD-3-Clause
-# Copyright 2014 Blender Foundation.
-
-# - Try to find OpenGLES
-# Once done this will define
-#
-# OPENGLES_FOUND - system has OpenGLES and EGL
-# OPENGL_EGL_FOUND - system has EGL
-# OPENGLES_INCLUDE_DIR - the GLES include directory
-# OPENGLES_LIBRARY - the GLES library
-# OPENGLES_EGL_INCLUDE_DIR - the EGL include directory
-# OPENGLES_EGL_LIBRARY - the EGL library
-# OPENGLES_LIBRARIES - all libraries needed for OpenGLES
-# OPENGLES_INCLUDES - all includes needed for OpenGLES
-
-# If OPENGLES_ROOT_DIR was defined in the environment, use it.
-IF(NOT OPENGLES_ROOT_DIR AND NOT $ENV{OPENGLES_ROOT_DIR} STREQUAL "")
- SET(OPENGLES_ROOT_DIR $ENV{OPENGLES_ROOT_DIR})
-ENDIF()
-
-SET(_opengles_SEARCH_DIRS
- ${OPENGLES_ROOT_DIR}
-)
-
-FIND_PATH(OPENGLES_INCLUDE_DIR
- NAMES
- GLES2/gl2.h
- HINTS
- ${_opengles_SEARCH_DIRS}
-)
-
-FIND_LIBRARY(OPENGLES_LIBRARY
- NAMES
- GLESv2
- PATHS
- ${_opengles_SEARCH_DIRS}
- PATH_SUFFIXES
- lib64 lib
-)
-
-FIND_PATH(OPENGLES_EGL_INCLUDE_DIR
- NAMES
- EGL/egl.h
- HINTS
- ${_opengles_SEARCH_DIRS}
-)
-
-FIND_LIBRARY(OPENGLES_EGL_LIBRARY
- NAMES
- EGL
- HINTS
- ${_opengles_SEARCH_DIRS}
- PATH_SUFFIXES
- lib64 lib
-)
-
-IF(OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
- SET(OPENGL_EGL_FOUND "YES")
-ELSE()
- SET(OPENGL_EGL_FOUND "NO")
-ENDIF()
-
-IF(OPENGLES_LIBRARY AND OPENGLES_INCLUDE_DIR AND
- OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
- SET(OPENGLES_LIBRARIES ${OPENGLES_LIBRARY} ${OPENGLES_LIBRARIES}
- ${OPENGLES_EGL_LIBRARY})
- SET(OPENGLES_INCLUDES ${OPENGLES_INCLUDE_DIR} ${OPENGLES_EGL_INCLUDE_DIR})
- SET(OPENGLES_FOUND "YES")
-ELSE()
- SET(OPENGLES_FOUND "NO")
-ENDIF()
-
-MARK_AS_ADVANCED(
- OPENGLES_EGL_INCLUDE_DIR
- OPENGLES_EGL_LIBRARY
- OPENGLES_LIBRARY
- OPENGLES_INCLUDE_DIR
-)
-
-UNSET(_opengles_SEARCH_DIRS)
diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
index 1e88621303f..0afe1299330 100644
--- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake
+++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
@@ -34,11 +34,17 @@ SET(PYTHON_VERSION 3.10 CACHE STRING "Python Version (major and minor only)")
MARK_AS_ADVANCED(PYTHON_VERSION)
-# See: http://docs.python.org/extending/embedding.html#linking-requirements
-# for why this is needed
-SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
-MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
-
+if(APPLE)
+ if(WITH_PYTHON_MODULE)
+ set(PYTHON_LINKFLAGS "-undefined dynamic_lookup")
+ else()
+ set(PYTHON_LINKFLAGS)
+ endif()
+else()
+ # See: http://docs.python.org/extending/embedding.html#linking-requirements
+ SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
+ MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
+endif()
# if the user passes these defines as args, we don't want to overwrite
SET(_IS_INC_DEF OFF)
diff --git a/build_files/cmake/Modules/GTest.cmake b/build_files/cmake/Modules/GTest.cmake
index a38550958fd..5c7fabdcff7 100644
--- a/build_files/cmake/Modules/GTest.cmake
+++ b/build_files/cmake/Modules/GTest.cmake
@@ -268,7 +268,8 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
-#------------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
+
function(gtest_add_tests)
if(ARGC LESS 1)
diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake
index 92ce403d5f3..5ffd158361e 100644
--- a/build_files/cmake/Modules/GTestTesting.cmake
+++ b/build_files/cmake/Modules/GTestTesting.cmake
@@ -40,12 +40,10 @@ macro(BLENDER_SRC_GTEST_EX)
set(MANIFEST "${CMAKE_BINARY_DIR}/tests.exe.manifest")
endif()
- add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
- add_definitions(${GFLAGS_DEFINES})
- add_definitions(${GLOG_DEFINES})
-
add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST})
setup_platform_linker_flags(${TARGET_NAME})
+ target_compile_definitions(${TARGET_NAME} PRIVATE ${GFLAGS_DEFINES})
+ target_compile_definitions(${TARGET_NAME} PRIVATE ${GLOG_DEFINES})
target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}")
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}")
target_link_libraries(${TARGET_NAME} ${ARG_EXTRA_LIBS} ${PLATFORM_LINKLIBS})
diff --git a/build_files/cmake/buildinfo.cmake b/build_files/cmake/buildinfo.cmake
index 53e22ed23ad..b0640acbe96 100644
--- a/build_files/cmake/buildinfo.cmake
+++ b/build_files/cmake/buildinfo.cmake
@@ -150,10 +150,10 @@ endif()
# BUILD_PLATFORM is taken from CMake
# but BUILD_DATE and BUILD_TIME are platform dependent
if(NOT BUILD_DATE)
- STRING(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
+ string(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
endif()
if(NOT BUILD_TIME)
- STRING(TIMESTAMP BUILD_TIME "%H:%M:%S" UTC)
+ string(TIMESTAMP BUILD_TIME "%H:%M:%S" UTC)
endif()
# Write a file with the BUILD_HASH define
diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py
index 79f9498ce2e..d9271ff8268 100644
--- a/build_files/cmake/cmake_static_check_cppcheck.py
+++ b/build_files/cmake/cmake_static_check_cppcheck.py
@@ -10,40 +10,77 @@ import tempfile
from typing import (
Any,
List,
+ Tuple,
)
+USE_VERBOSE = (os.environ.get("VERBOSE", None) is not None)
+# Could make configurable.
+USE_VERBOSE_PROGRESS = True
-USE_QUIET = (os.environ.get("QUIET", None) is not None)
+CHECKER_BIN = "cppcheck"
CHECKER_IGNORE_PREFIX = [
"extern",
]
-CHECKER_BIN = "cppcheck"
+CHECKER_EXCLUDE_SOURCE_FILES = set(os.path.join(*f.split("/")) for f in (
+ # These files hang (taking longer than 5min with v2.8.2 at time of writing).
+ # All other files process in under around 10seconds.
+ "source/blender/editors/space_text/text_format_pov.c",
+ "source/blender/editors/space_text/text_format_pov_ini.c",
+))
CHECKER_ARGS = [
- # not sure why this is needed, but it is.
- "-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"),
- "--suppress=*:%s/extern/glew/include/GL/glew.h:241" % project_source_info.SOURCE_DIR,
- "--max-configs=1", # speeds up execution
- # "--check-config", # when includes are missing
- "--enable=all", # if you want sixty hundred pedantic suggestions
+ # Speed up execution.
+ # As Blender has many defines, the total number of configurations is large making execution unreasonably slow.
+ # This could be increased but do so with care.
+ "--max-configs=1",
+
+ # Enable this when includes are missing.
+ # "--check-config",
+
+ # Shows many pedantic issues, some are quite useful.
+ "--enable=all",
+
+ # Also shows useful messages, even if some are false-positives.
+ "--inconclusive",
# Quiet output, otherwise all defines/includes are printed (overly verbose).
# Only enable this for troubleshooting (if defines are not set as expected for example).
- "--quiet",
+ *(() if USE_VERBOSE else ("--quiet",))
# NOTE: `--cppcheck-build-dir=<dir>` is added later as a temporary directory.
]
-if USE_QUIET:
- CHECKER_ARGS.append("--quiet")
+
+def source_info_filter(
+ source_info: List[Tuple[str, List[str], List[str]]],
+) -> List[Tuple[str, List[str], List[str]]]:
+ source_dir = project_source_info.SOURCE_DIR
+ if not source_dir.endswith(os.sep):
+ source_dir += os.sep
+ source_info_result = []
+ for i, item in enumerate(source_info):
+ c = item[0]
+ if c.startswith(source_dir):
+ c_relative = c[len(source_dir):]
+ if c_relative in CHECKER_EXCLUDE_SOURCE_FILES:
+ CHECKER_EXCLUDE_SOURCE_FILES.remove(c_relative)
+ continue
+ source_info_result.append(item)
+ if CHECKER_EXCLUDE_SOURCE_FILES:
+ sys.stderr.write("Error: exclude file(s) are missing: %r\n" % list(sorted(CHECKER_EXCLUDE_SOURCE_FILES)))
+ sys.exit(1)
+ return source_info_result
def cppcheck() -> None:
source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
+ # Apply exclusion.
+ source_info = source_info_filter(source_info)
+
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = (
@@ -60,7 +97,7 @@ def cppcheck() -> None:
process_functions = []
def my_process(i: int, c: str, cmd: List[str]) -> subprocess.Popen[Any]:
- if not USE_QUIET:
+ if USE_VERBOSE_PROGRESS:
percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index c98dfe27285..38997e2139b 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -7,8 +7,6 @@
# cmake -C../blender/build_files/cmake/config/blender_lite.cmake ../blender
#
-set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
-
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
set(WITH_BLENDER_THUMBNAILER OFF CACHE BOOL "" FORCE)
@@ -35,6 +33,7 @@ set(WITH_IMAGE_OPENEXR OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_WEBP OFF CACHE BOOL "" FORCE)
+set(WITH_INPUT_IME OFF CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_IO_STL OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake
index 3661b1de805..793d1cb0853 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -87,7 +87,5 @@ if(NOT APPLE)
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_HIP_BINARIES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEVICE_ONEAPI ON CACHE BOOL "" FORCE)
-
- # Disable AoT kernels compilations until buildbot can deliver them in a reasonable time.
- set(WITH_CYCLES_ONEAPI_BINARIES OFF CACHE BOOL "" FORCE)
+ set(WITH_CYCLES_ONEAPI_BINARIES ON CACHE BOOL "" FORCE)
endif()
diff --git a/build_files/cmake/config/bpy_module.cmake b/build_files/cmake/config/bpy_module.cmake
index c4be5c2e61f..7bd5c3fc1a1 100644
--- a/build_files/cmake/config/bpy_module.cmake
+++ b/build_files/cmake/config/bpy_module.cmake
@@ -8,41 +8,81 @@
set(WITH_PYTHON_MODULE ON CACHE BOOL "" FORCE)
-# install into the systems python dir
-set(WITH_INSTALL_PORTABLE OFF CACHE BOOL "" FORCE)
-# no point int copying python into python
+# -----------------------------------------------------------------------------
+# Installation Configuration.
+#
+# NOTE: `WITH_INSTALL_PORTABLE` always defaults to ON when building as a Python module and
+# isn't set here as it makes changing the setting impractical.
+# Python-developers could prefer either ON/OFF depending on their usage:
+#
+# - When using the system's Python, disabling will install into their `site-packages`,
+# allowing them to run Python from any directory and `import bpy`.
+# - When using Blender's bundled Python in `./../lib/` it will install there
+# which isn't especially useful as it requires running Python from this directory too.
+#
+# So default `WITH_INSTALL_PORTABLE` to ON, and developers who don't use Python from `./../lib/`
+# can disable it if they wish to install into their systems Python.
+
+# There is no point in copying python into Python.
set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE)
-# disable audio, its possible some devs may want this but for now disable
-# so the python module doesn't hold the audio device and loads quickly.
+# Depends on Python install, do this to quiet warning.
+set(WITH_DRACO OFF CACHE BOOL "" FORCE)
+
+if(WIN32)
+ set(WITH_WINDOWS_BUNDLE_CRT OFF CACHE BOOL "" FORCE)
+endif()
+
+
+# -----------------------------------------------------------------------------
+# Library Compatibility.
+
+# JEMALLOC does not work with `dlopen()` of Python modules:
+# https://github.com/jemalloc/jemalloc/issues/1237
+set(WITH_MEM_JEMALLOC OFF CACHE BOOL "" FORCE)
+
+
+# -----------------------------------------------------------------------------
+# Application Support.
+
+# Not useful to include with the Python module.
+# Although a way to extract this from Python could be handle,
+# this would be better exposed directly via the Python API.
+set(WITH_BLENDER_THUMBNAILER OFF CACHE BOOL "" FORCE)
+
+
+# -----------------------------------------------------------------------------
+# Audio Support.
+
+# Disable audio, its possible some developers may want this but for now disable
+# so the Python module doesn't hold the audio device and loads quickly.
set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
-set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
-set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
-set(WITH_COREAUDIO OFF CACHE BOOL "" FORCE)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
-set(WITH_PULSEAUDIO OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
-set(WITH_WASAPI OFF CACHE BOOL "" FORCE)
+if(UNIX AND NOT APPLE)
+ set(WITH_PULSEAUDIO OFF CACHE BOOL "" FORCE)
+endif()
+if(WIN32)
+ set(WITH_WASAPI OFF CACHE BOOL "" FORCE)
+endif()
+if(APPLE)
+ set(WITH_COREAUDIO OFF CACHE BOOL "" FORCE)
+endif()
+
-# other features which are not especially useful as a python module
-set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
-set(WITH_BULLET OFF CACHE BOOL "" FORCE)
+# -----------------------------------------------------------------------------
+# Input Device Support.
+
+# Other features which are not especially useful as a python module.
set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
-set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
-set(WITH_NANOVDB OFF CACHE BOOL "" FORCE)
-set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
-set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
-set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
+if(WIN32 OR APPLE)
+ set(WITH_INPUT_IME OFF CACHE BOOL "" FORCE)
+endif()
-# Depends on Python install, do this to quiet warning.
-set(WITH_DRACO OFF CACHE BOOL "" FORCE)
-# Jemalloc does not work with dlopen() of Python modules:
-# https://github.com/jemalloc/jemalloc/issues/1237
-set(WITH_MEM_JEMALLOC OFF CACHE BOOL "" FORCE)
+# -----------------------------------------------------------------------------
+# Language Support.
-if(WIN32)
- set(WITH_WINDOWS_BUNDLE_CRT OFF CACHE BOOL "" FORCE)
-endif()
+set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/have_features.cmake b/build_files/cmake/have_features.cmake
new file mode 100644
index 00000000000..dc3b61849ea
--- /dev/null
+++ b/build_files/cmake/have_features.cmake
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright 2022 Blender Foundation. All rights reserved.
+
+# This file is used to test the system for headers & symbols.
+# Variables should use the `HAVE_` prefix.
+# Defines should use the same name as the CMAKE variable.
+
+include(CheckSymbolExists)
+
+# Used for: `intern/guardedalloc/intern/mallocn_intern.h`.
+# Function `malloc_stats` is only available on GLIBC,
+# so check that before defining `HAVE_MALLOC_STATS`.
+check_symbol_exists(malloc_stats "malloc.h" HAVE_MALLOC_STATS_H)
+
+# Used for: `source/creator/creator_signals.c`.
+# The function `feenableexcept` is not present non-GLIBC systems,
+# hence we need to check if it's available in the `fenv.h` file.
+set(HAVE_FEENABLEEXCEPT OFF)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ check_symbol_exists(feenableexcept "fenv.h" HAVE_FEENABLEEXCEPT)
+endif()
+
+# Used for: `source/blender/blenlib/intern/system.c`.
+# `execinfo` is not available on non-GLIBC systems (at least not on MUSL-LIBC),
+# so check the presence of the header before including it and using the it for back-trace.
+set(HAVE_EXECINFO_H OFF)
+if(NOT MSVC)
+ include(CheckIncludeFiles)
+ check_include_files("execinfo.h" HAVE_EXECINFO_H)
+ if(HAVE_EXECINFO_H)
+ add_definitions(-DHAVE_EXECINFO_H)
+ endif()
+endif()
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 5508e8f2104..d41024759fc 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -134,12 +134,11 @@ endfunction()
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
# use it instead of include_directories()
-function(blender_include_dirs
- includes
- )
+function(absolute_include_dirs
+ includes_absolute)
set(_ALL_INCS "")
- foreach(_INC ${ARGV})
+ foreach(_INC ${ARGN})
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
list(APPEND _ALL_INCS ${_ABS_INC})
# for checking for invalid includes, disable for regular use
@@ -147,22 +146,24 @@ function(blender_include_dirs
# message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
# endif()
endforeach()
- include_directories(${_ALL_INCS})
+
+ set(${includes_absolute} ${_ALL_INCS} PARENT_SCOPE)
endfunction()
-function(blender_include_dirs_sys
- includes
+function(blender_target_include_dirs
+ name
)
- set(_ALL_INCS "")
- foreach(_INC ${ARGV})
- get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
- list(APPEND _ALL_INCS ${_ABS_INC})
- # if(NOT EXISTS "${_ABS_INC}/")
- # message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
- # endif()
- endforeach()
- include_directories(SYSTEM ${_ALL_INCS})
+ absolute_include_dirs(_ALL_INCS ${ARGN})
+ target_include_directories(${name} PRIVATE ${_ALL_INCS})
+endfunction()
+
+function(blender_target_include_dirs_sys
+ name
+ )
+
+ absolute_include_dirs(_ALL_INCS ${ARGN})
+ target_include_directories(${name} SYSTEM PRIVATE ${_ALL_INCS})
endfunction()
# Set include paths for header files included with "*.h" syntax.
@@ -268,13 +269,11 @@ function(blender_add_lib__impl
# message(STATUS "Configuring library ${name}")
- # include_directories(${includes})
- # include_directories(SYSTEM ${includes_sys})
- blender_include_dirs("${includes}")
- blender_include_dirs_sys("${includes_sys}")
-
add_library(${name} ${sources})
+ blender_target_include_dirs(${name} ${includes})
+ blender_target_include_dirs_sys(${name} ${includes_sys})
+
# On Windows certain libraries have two sets of binaries: one for debug builds and one for
# release builds. The root of this requirement goes into ABI, I believe, but that's outside
# of a scope of this comment.
@@ -382,7 +381,7 @@ function(blender_add_test_suite)
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Figure out the release dir, as some tests need files from there.
- GET_BLENDER_TEST_INSTALL_DIR(TEST_INSTALL_DIR)
+ get_blender_test_install_dir(TEST_INSTALL_DIR)
if(APPLE)
set(_test_release_dir ${TEST_INSTALL_DIR}/Blender.app/Contents/Resources/${BLENDER_VERSION})
else()
@@ -425,21 +424,21 @@ function(blender_add_test_lib
# This duplicates logic that's also in GTestTesting.cmake, macro BLENDER_SRC_GTEST_EX.
# TODO(Sybren): deduplicate after the general approach in D7649 has been approved.
- LIST(APPEND includes
+ list(APPEND includes
${CMAKE_SOURCE_DIR}/tests/gtests
)
- LIST(APPEND includes_sys
+ list(APPEND includes_sys
${GLOG_INCLUDE_DIRS}
${GFLAGS_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/extern/gtest/include
${CMAKE_SOURCE_DIR}/extern/gmock/include
)
- add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
- add_definitions(${GFLAGS_DEFINES})
- add_definitions(${GLOG_DEFINES})
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}")
+ target_compile_definitions(${name} PRIVATE ${GFLAGS_DEFINES})
+ target_compile_definitions(${name} PRIVATE ${GLOG_DEFINES})
+
set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name})
blender_add_test_suite(
@@ -469,16 +468,16 @@ function(blender_add_test_executable
## Otherwise external projects will produce warnings that we cannot fix.
remove_strict_flags()
- include_directories(${includes})
- include_directories(${includes_sys})
-
- BLENDER_SRC_GTEST_EX(
+ blender_src_gtest_ex(
NAME ${name}
SRC "${sources}"
EXTRA_LIBS "${library_deps}"
SKIP_ADD_TEST
)
+ blender_target_include_dirs(${name}_test ${includes})
+ blender_target_include_dirs_sys(${name}_test ${includes_sys})
+
blender_add_test_suite(
TARGET ${name}_test
SUITE_NAME ${name}
@@ -513,6 +512,11 @@ function(setup_platform_linker_flags
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS}")
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " ${PLATFORM_LINKFLAGS_RELEASE}")
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " ${PLATFORM_LINKFLAGS_DEBUG}")
+
+ get_target_property(target_type ${target} TYPE)
+ if (target_type STREQUAL "EXECUTABLE")
+ set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS_EXECUTABLE}")
+ endif()
endfunction()
# Platform specific libraries for targets.
@@ -760,7 +764,7 @@ function(ADD_CHECK_C_COMPILER_FLAG
include(CheckCCompilerFlag)
- CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
+ check_c_compiler_flag("${_FLAG}" "${_CACHE_VAR}")
if(${_CACHE_VAR})
# message(STATUS "Using CFLAG: ${_FLAG}")
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}" PARENT_SCOPE)
@@ -777,7 +781,7 @@ function(ADD_CHECK_CXX_COMPILER_FLAG
include(CheckCXXCompilerFlag)
- CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
+ check_cxx_compiler_flag("${_FLAG}" "${_CACHE_VAR}")
if(${_CACHE_VAR})
# message(STATUS "Using CXXFLAG: ${_FLAG}")
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}" PARENT_SCOPE)
@@ -795,9 +799,11 @@ function(get_blender_version)
# - BLENDER_VERSION_PATCH
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
- # So cmake depends on BKE_blender.h, beware of inf-loops!
- CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h
- ${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender_version.h.done)
+ # So CMAKE depends on `BKE_blender.h`, beware of infinite-loops!
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h
+ ${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender_version.h.done
+ )
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
@@ -1208,16 +1214,8 @@ endmacro()
macro(without_system_libs_begin)
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
- if(APPLE)
- # Avoid searching for headers in frameworks (like Mono), and libraries in LIBDIR.
- set(CMAKE_FIND_FRAMEWORK NEVER)
- endif()
endmacro()
macro(without_system_libs_end)
unset(CMAKE_IGNORE_PATH)
- if(APPLE)
- # FIRST is the default.
- set(CMAKE_FIND_FRAMEWORK FIRST)
- endif()
endmacro()
diff --git a/build_files/cmake/packaging.cmake b/build_files/cmake/packaging.cmake
index f6073eba82e..2f2e90dc934 100644
--- a/build_files/cmake/packaging.cmake
+++ b/build_files/cmake/packaging.cmake
@@ -17,9 +17,9 @@ set(CPACK_PACKAGE_VENDOR ${PROJECT_VENDOR})
set(CPACK_PACKAGE_CONTACT ${PROJECT_CONTACT})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
-SET(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
-SET(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
-SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
+set(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
+set(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
+set(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
# Get the build revision, note that this can get out-of-sync, so for packaging run cmake first.
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index f84be3c5238..27fcaf823e8 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -21,9 +21,25 @@ function(print_found_status
endif()
endfunction()
+# Utility to install precompiled shared libraries.
+macro(add_bundled_libraries library)
+ if(EXISTS ${LIBDIR})
+ set(_library_dir ${LIBDIR}/${library}/lib)
+ file(GLOB _all_library_versions ${_library_dir}/*\.dylib*)
+ list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions})
+ list(APPEND PLATFORM_BUNDLED_LIBRARY_DIRS ${_library_dir})
+ unset(_all_library_versions)
+ unset(_library_dir)
+ endif()
+endmacro()
+
# ------------------------------------------------------------------------
# Find system provided libraries.
+# Avoid searching for headers since this would otherwise override our lib
+# directory as well as PYTHON_ROOT_DIR.
+set(CMAKE_FIND_FRAMEWORK NEVER)
+
# Find system ZLIB, not the pre-compiled one supplied with OpenCollada.
set(ZLIB_ROOT /usr)
find_package(ZLIB REQUIRED)
@@ -63,6 +79,11 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
endif()
+# Optionally use system Python if PYTHON_ROOT_DIR is specified.
+if(WITH_PYTHON AND (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
+ find_package(PythonLibsUnix REQUIRED)
+endif()
+
# Prefer lib directory paths
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
@@ -111,34 +132,8 @@ if(WITH_CODEC_SNDFILE)
unset(_sndfile_VORBISENC_LIBRARY)
endif()
-if(WITH_PYTHON)
- # Use precompiled libraries by default.
- set(PYTHON_VERSION 3.10)
- if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
- # Normally cached but not since we include them with blender.
- set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
- set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}")
- set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}.a)
- set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
- else()
- # Module must be compiled against Python framework.
- set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
- set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}")
- set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}")
- set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}")
- unset(_py_framework)
- endif()
-
- # uncached vars
- set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
- set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
-
- # needed for Audaspace, numpy is installed into python site-packages
- set(PYTHON_NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
-
- if(NOT EXISTS "${PYTHON_EXECUTABLE}")
- message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
- endif()
+if(WITH_PYTHON AND NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
+ find_package(PythonLibsUnix REQUIRED)
endif()
if(WITH_FFTW3)
@@ -201,11 +196,6 @@ if(WITH_JACK)
string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp")
endif()
-if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
- # force cmake to link right framework
- string(APPEND PLATFORM_LINKFLAGS " /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
-endif()
-
if(WITH_OPENCOLLADA)
find_package(OpenCOLLADA)
find_library(PCRE_LIBRARIES NAMES pcre HINTS ${LIBDIR}/opencollada/lib)
@@ -226,6 +216,9 @@ if(WITH_SDL)
endif()
endif()
+set(EPOXY_ROOT_DIR ${LIBDIR}/epoxy)
+find_package(Epoxy REQUIRED)
+
set(PNG_ROOT ${LIBDIR}/png)
find_package(PNG REQUIRED)
@@ -359,10 +352,6 @@ endif()
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
- # Increase stack size for Embree, only works for executables.
- if(NOT WITH_PYTHON_MODULE)
- string(APPEND PLATFORM_LINKFLAGS " -Wl,-stack_size,0x100000")
- endif()
# Embree static library linking can mix up SSE and AVX symbols, causing
# crashes on macOS systems with older CPUs that don't have AVX. Using
@@ -412,6 +401,7 @@ if(WITH_OPENMP)
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
+ add_bundled_libraries(openmp)
endif()
endif()
@@ -446,6 +436,9 @@ if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()
+# Restore to default.
+set(CMAKE_FIND_FRAMEWORK FIRST)
+
# ---------------------------------------------------------------------
# Set compiler and linker flags.
@@ -478,6 +471,9 @@ string(APPEND PLATFORM_LINKFLAGS
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
string(APPEND PLATFORM_LINKFLAGS " -stdlib=libc++")
+# Make stack size more similar to Embree, required for Embree.
+string(APPEND PLATFORM_LINKFLAGS_EXECUTABLE " -Wl,-stack_size,0x100000")
+
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
@@ -501,17 +497,27 @@ if(WITH_COMPILER_CCACHE)
endif()
endif()
-# For binaries that are built but not installed (also not distributed) (datatoc,
-# makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
-# CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next to each binary.
-#
-# For the installed Python module and installed Blender executable, CMAKE_INSTALL_RPATH
-# is modified to find the dylib in an adjacent folder. Install step puts the libraries there.
-set(CMAKE_SKIP_BUILD_RPATH FALSE)
-list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
+if(WITH_COMPILER_ASAN)
+ list(APPEND PLATFORM_BUNDLED_LIBRARIES ${COMPILER_ASAN_LIBRARY})
+endif()
-set(CMAKE_SKIP_INSTALL_RPATH FALSE)
-list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib")
+if(PLATFORM_BUNDLED_LIBRARIES)
+ # For the installed Python module and installed Blender executable, we set the
+ # rpath to the location where install step will copy the shared libraries.
+ set(CMAKE_SKIP_INSTALL_RPATH FALSE)
+ if(WITH_PYTHON_MODULE)
+ list(APPEND CMAKE_INSTALL_RPATH "@loader_path/lib")
+ else()
+ list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/lib")
+ endif()
+
+ # For binaries that are built but not installed (like makesdan or tests), we add
+ # the original directory of all shared libraries to the rpath. This is needed because
+ # these can be in different folders, and because the build and install folder may be
+ # different.
+ set(CMAKE_SKIP_BUILD_RPATH FALSE)
+ list(APPEND CMAKE_BUILD_RPATH ${PLATFORM_BUNDLED_LIBRARY_DIRS})
+endif()
# Same as `CFBundleIdentifier` in Info.plist.
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.blenderfoundation.blender")
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 0d7ed9d618c..bfbc6b76b40 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -16,9 +16,16 @@ if(NOT DEFINED LIBDIR)
# Choose the best suitable libraries.
if(EXISTS ${LIBDIR_NATIVE_ABI})
set(LIBDIR ${LIBDIR_NATIVE_ABI})
+ set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
elseif(EXISTS ${LIBDIR_CENTOS7_ABI})
set(LIBDIR ${LIBDIR_CENTOS7_ABI})
set(WITH_CXX11_ABI OFF)
+ if(WITH_MEM_JEMALLOC)
+ # jemalloc provides malloc hooks.
+ set(WITH_LIBC_MALLOC_HOOK_WORKAROUND False)
+ else()
+ set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
+ endif()
if(CMAKE_COMPILER_IS_GNUCC AND
CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3)
@@ -81,6 +88,15 @@ macro(find_package_wrapper)
endif()
endmacro()
+# Utility to install precompiled shared libraries.
+macro(add_bundled_libraries library)
+ if(EXISTS ${LIBDIR})
+ file(GLOB _all_library_versions ${LIBDIR}/${library}/lib/*\.so*)
+ list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions})
+ unset(_all_library_versions)
+ endif()
+endmacro()
+
# ----------------------------------------------------------------------------
# Precompiled Libraries
#
@@ -95,12 +111,13 @@ find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Zstd REQUIRED)
+find_package_wrapper(Epoxy REQUIRED)
function(check_freetype_for_brotli)
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIRS})
- check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI
- "freetype/config/ftconfig.h" HAVE_BROTLI)
+ check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI "freetype/config/ftconfig.h" HAVE_BROTLI)
+ unset(CMAKE_REQUIRED_INCLUDES)
if(NOT HAVE_BROTLI)
unset(HAVE_BROTLI CACHE)
message(FATAL_ERROR "Freetype needs to be compiled with brotli support!")
@@ -126,14 +143,38 @@ if(NOT WITH_SYSTEM_FREETYPE)
endif()
if(WITH_PYTHON)
- # No way to set py35, remove for now.
- # find_package(PythonLibs)
+ # This could be used, see: D14954 for details.
+ # `find_package(PythonLibs)`
- # Use our own instead, since without py is such a rare case,
- # require this package
- # XXX Linking errors with debian static python :/
-# find_package_wrapper(PythonLibsUnix REQUIRED)
+ # Use our own instead, since without Python is such a rare case,
+ # require this package.
+ # XXX: Linking errors with Debian static Python (sigh).
+ # find_package_wrapper(PythonLibsUnix REQUIRED)
find_package(PythonLibsUnix REQUIRED)
+
+ if(WITH_PYTHON_MODULE AND NOT WITH_INSTALL_PORTABLE)
+ # Installing into `site-packages`, warn when installing into `./../lib/`
+ # which script authors almost certainly don't want.
+ if(EXISTS ${LIBDIR})
+ cmake_path(IS_PREFIX LIBDIR "${PYTHON_SITE_PACKAGES}" NORMALIZE _is_prefix)
+ if(_is_prefix)
+ message(WARNING "
+Building Blender with the following configuration:
+ - WITH_PYTHON_MODULE=ON
+ - WITH_INSTALL_PORTABLE=OFF
+ - LIBDIR=\"${LIBDIR}\"
+ - PYTHON_SITE_PACKAGES=\"${PYTHON_SITE_PACKAGES}\"
+In this case you may want to either:
+ - Use the system Python's site-packages, see:
+ python -c \"import site; print(site.getsitepackages()[0])\"
+ - Set WITH_INSTALL_PORTABLE=ON to create a stand-alone \"bpy\" module
+ which you will need to ensure is in Python's module search path.
+Proceeding with PYTHON_SITE_PACKAGES install target, you have been warned!"
+ )
+ endif()
+ unset(_is_prefix)
+ endif()
+ endif()
endif()
if(WITH_IMAGE_OPENEXR)
@@ -643,46 +684,125 @@ endif()
if(WITH_GHOST_WAYLAND)
find_package(PkgConfig)
- pkg_check_modules(wayland-client REQUIRED wayland-client>=1.12)
- pkg_check_modules(wayland-egl REQUIRED wayland-egl)
- pkg_check_modules(wayland-scanner REQUIRED wayland-scanner)
- pkg_check_modules(xkbcommon REQUIRED xkbcommon)
- pkg_check_modules(wayland-cursor REQUIRED wayland-cursor)
+ pkg_check_modules(wayland-client wayland-client>=1.12)
+ pkg_check_modules(wayland-egl wayland-egl)
+ pkg_check_modules(wayland-scanner wayland-scanner)
+ pkg_check_modules(xkbcommon xkbcommon)
+ pkg_check_modules(wayland-cursor wayland-cursor)
+ pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
+
+ if(${wayland-protocols_FOUND})
+ pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
+ else()
+ # CentOS 7 packages have too old a version, a newer version exist in the
+ # precompiled libraries.
+ find_path(WAYLAND_PROTOCOLS_DIR
+ NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
+ PATH_SUFFIXES share/wayland-protocols
+ PATHS ${LIBDIR}/wayland-protocols
+ )
- if(WITH_GHOST_WAYLAND_DBUS)
- pkg_check_modules(dbus REQUIRED dbus-1)
+ if(EXISTS ${WAYLAND_PROTOCOLS_DIR})
+ set(wayland-protocols_FOUND ON)
+ endif()
endif()
- if(WITH_GHOST_WAYLAND_LIBDECOR)
- pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
+ if (NOT ${wayland-client_FOUND})
+ message(STATUS "wayland-client not found, disabling WITH_GHOST_WAYLAND")
+ set(WITH_GHOST_WAYLAND OFF)
+ endif()
+ if (NOT ${wayland-egl_FOUND})
+ message(STATUS "wayland-egl not found, disabling WITH_GHOST_WAYLAND")
+ set(WITH_GHOST_WAYLAND OFF)
+ endif()
+ if (NOT ${wayland-scanner_FOUND})
+ message(STATUS "wayland-scanner not found, disabling WITH_GHOST_WAYLAND")
+ set(WITH_GHOST_WAYLAND OFF)
+ endif()
+ if (NOT ${wayland-cursor_FOUND})
+ message(STATUS "wayland-cursor not found, disabling WITH_GHOST_WAYLAND")
+ set(WITH_GHOST_WAYLAND OFF)
+ endif()
+ if (NOT ${wayland-protocols_FOUND})
+ message(STATUS "wayland-protocols not found, disabling WITH_GHOST_WAYLAND")
+ set(WITH_GHOST_WAYLAND OFF)
+ endif()
+ if (NOT ${xkbcommon_FOUND})
+ message(STATUS "xkbcommon not found, disabling WITH_GHOST_WAYLAND")
+ set(WITH_GHOST_WAYLAND OFF)
endif()
- list(APPEND PLATFORM_LINKLIBS
- ${xkbcommon_LINK_LIBRARIES}
- )
+ if(WITH_GHOST_WAYLAND)
+ if(WITH_GHOST_WAYLAND_DBUS)
+ pkg_check_modules(dbus REQUIRED dbus-1)
+ endif()
- if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
- list(APPEND PLATFORM_LINKLIBS
- ${wayland-client_LINK_LIBRARIES}
- ${wayland-egl_LINK_LIBRARIES}
- ${wayland-cursor_LINK_LIBRARIES}
- )
- endif()
+ if(WITH_GHOST_WAYLAND_LIBDECOR)
+ pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
+ endif()
- if(WITH_GHOST_WAYLAND_DBUS)
list(APPEND PLATFORM_LINKLIBS
- ${dbus_LINK_LIBRARIES}
+ ${xkbcommon_LINK_LIBRARIES}
)
- add_definitions(-DWITH_GHOST_WAYLAND_DBUS)
- endif()
- if(WITH_GHOST_WAYLAND_LIBDECOR)
if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
list(APPEND PLATFORM_LINKLIBS
- ${libdecor_LIBRARIES}
+ ${wayland-client_LINK_LIBRARIES}
+ ${wayland-egl_LINK_LIBRARIES}
+ ${wayland-cursor_LINK_LIBRARIES}
+ )
+ endif()
+
+ if(WITH_GHOST_WAYLAND_DBUS)
+ list(APPEND PLATFORM_LINKLIBS
+ ${dbus_LINK_LIBRARIES}
+ )
+ add_definitions(-DWITH_GHOST_WAYLAND_DBUS)
+ endif()
+
+ if(WITH_GHOST_WAYLAND_LIBDECOR)
+ if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
+ list(APPEND PLATFORM_LINKLIBS
+ ${libdecor_LIBRARIES}
+ )
+ endif()
+ add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
+ endif()
+
+ pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
+
+ # When using dynamic loading, headers generated
+ # from older versions of `wayland-scanner` aren't compatible.
+ if(WITH_GHOST_WAYLAND_DYNLOAD)
+ execute_process(
+ COMMAND ${WAYLAND_SCANNER} --version
+ # The version is written to the `stderr`.
+ ERROR_VARIABLE _wayland_scanner_out
+ ERROR_STRIP_TRAILING_WHITESPACE
)
+ if(NOT "${_wayland_scanner_out}" STREQUAL "")
+ string(
+ REGEX REPLACE
+ "^wayland-scanner[ \t]+([0-9]+)\.([0-9]+).*"
+ "\\1.\\2"
+ _wayland_scanner_ver
+ "${_wayland_scanner_out}"
+ )
+ if("${_wayland_scanner_ver}" VERSION_LESS "1.20")
+ message(
+ FATAL_ERROR
+ "Found ${WAYLAND_SCANNER} version \"${_wayland_scanner_ver}\", "
+ "the minimum version is 1.20!"
+ )
+ endif()
+ unset(_wayland_scanner_ver)
+ else()
+ message(WARNING "Unable to access the version from ${WAYLAND_SCANNER}, continuing.")
+ endif()
+ unset(_wayland_scanner_out)
endif()
- add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
+ # End wayland-scanner version check.
+
endif()
endif()
@@ -956,6 +1076,7 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED)
set(CMAKE_REQUIRED_LIBRARIES atomic)
check_cxx_source_compiles("${_source}" ATOMIC_OPS_WITH_LIBATOMIC)
+ unset(CMAKE_REQUIRED_LIBRARIES)
if(ATOMIC_OPS_WITH_LIBATOMIC)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -latomic" PARENT_SCOPE)
@@ -968,4 +1089,17 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED)
endif()
endfunction()
-CONFIGURE_ATOMIC_LIB_IF_NEEDED()
+configure_atomic_lib_if_needed()
+
+if(PLATFORM_BUNDLED_LIBRARIES)
+ # For the installed Python module and installed Blender executable, we set the
+ # rpath to the relative path where the install step will copy the shared libraries.
+ set(CMAKE_SKIP_INSTALL_RPATH FALSE)
+ list(APPEND CMAKE_INSTALL_RPATH $ORIGIN/lib)
+
+ # For executables that are built but not installed (mainly tests) we set an absolute
+ # rpath to the lib folder. This is needed because these can be in different folders,
+ # and because the build and install folder may be different.
+ set(CMAKE_SKIP_BUILD_RPATH FALSE)
+ list(APPEND CMAKE_BUILD_RPATH $ORIGIN/lib ${CMAKE_INSTALL_PREFIX_WITH_CONFIG}/lib)
+endif()
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index e81582f0460..eeec4760b80 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -26,7 +26,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "/clang:-fopenmp")
set(OpenMP_CXX_FLAGS "/clang:-fopenmp")
- GET_FILENAME_COMPONENT(LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE)
+ get_filename_component(LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE)
set(CLANG_OPENMP_DLL "${LLVMROOT}/bin/libomp.dll")
set(CLANG_OPENMP_LIB "${LLVMROOT}/lib/libomp.lib")
if(NOT EXISTS "${CLANG_OPENMP_DLL}")
@@ -323,6 +323,13 @@ if(NOT JPEG_FOUND)
set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
endif()
+set(EPOXY_ROOT_DIR ${LIBDIR}/epoxy)
+windows_find_package(Epoxy REQUIRED)
+if(NOT EPOXY_FOUND)
+ set(Epoxy_INCLUDE_DIRS ${LIBDIR}/epoxy/include)
+ set(Epoxy_LIBRARIES ${LIBDIR}/epoxy/lib/epoxy.lib)
+endif()
+
set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC3.lib)
@@ -497,12 +504,16 @@ if(WITH_JACK)
endif()
if(WITH_PYTHON)
- set(PYTHON_VERSION 3.10) # CACHE STRING)
+ # Cache version for make_bpy_wheel.py to detect.
+ unset(PYTHON_VERSION CACHE)
+ set(PYTHON_VERSION "3.10" CACHE STRING "Python version")
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
set(PYTHON_LIBRARY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}.lib)
set(PYTHON_LIBRARY_DEBUG ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}_d.lib)
+ set(PYTHON_EXECUTABLE ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/bin/python$<$<CONFIG:Debug>:_d>.exe)
+
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/include)
set(PYTHON_NUMPY_INCLUDE_DIRS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib/site-packages/numpy/core/include)
set(NUMPY_FOUND ON)
@@ -756,7 +767,7 @@ if(WITH_TBB)
endif()
# used in many places so include globally, like OpenGL
-blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
+include_directories(SYSTEM "${PTHREADS_INCLUDE_DIRS}")
set(WINTAB_INC ${LIBDIR}/wintab/include)
@@ -863,8 +874,8 @@ endif()
if(WINDOWS_PYTHON_DEBUG)
# Include the system scripts in the blender_python_system_scripts project.
- FILE(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
- ADD_CUSTOM_TARGET(blender_python_system_scripts SOURCES ${inFiles})
+ file(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
+ add_custom_target(blender_python_system_scripts SOURCES ${inFiles})
foreach(_source IN ITEMS ${inFiles})
get_filename_component(_source_path "${_source}" PATH)
string(REPLACE "${CMAKE_SOURCE_DIR}/release/scripts/" "" _source_path "${_source_path}")
@@ -884,8 +895,8 @@ if(WINDOWS_PYTHON_DEBUG)
endif()
file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT)
- FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
- ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles})
+ file(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
+ add_custom_target(blender_python_user_scripts SOURCES ${inFiles})
foreach(_source IN ITEMS ${inFiles})
get_filename_component(_source_path "${_source}" PATH)
string(REPLACE "${USER_SCRIPTS_ROOT}" "" _source_path "${_source_path}")
diff --git a/build_files/cmake/platform/platform_win32_bundle_crt.cmake b/build_files/cmake/platform/platform_win32_bundle_crt.cmake
index f5dd0c8c7bc..f197498d97b 100644
--- a/build_files/cmake/platform/platform_win32_bundle_crt.cmake
+++ b/build_files/cmake/platform/platform_win32_bundle_crt.cmake
@@ -3,20 +3,22 @@
# First generate the manifest for tests since it will not need the dependency on the CRT.
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/tests.exe.manifest @ONLY)
-if(WITH_WINDOWS_BUNDLE_CRT)
- set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
- set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
- set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
-
- # This sometimes can change when updates are installed and the compiler version
- # changes, so test if it exists and if not, give InstallRequiredSystemLibraries
- # another chance to figure out the path.
- if(MSVC_REDIST_DIR AND NOT EXISTS "${MSVC_REDIST_DIR}")
- unset(MSVC_REDIST_DIR CACHE)
- endif()
+# Always detect system libraries, since they are also used by oneAPI.
+# But don't always install them, only for WITH_WINDOWS_BUNDLE_CRT=ON.
+set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
+set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
+set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
+
+# This sometimes can change when updates are installed and the compiler version
+# changes, so test if it exists and if not, give InstallRequiredSystemLibraries
+# another chance to figure out the path.
+if(MSVC_REDIST_DIR AND NOT EXISTS "${MSVC_REDIST_DIR}")
+ unset(MSVC_REDIST_DIR CACHE)
+endif()
- include(InstallRequiredSystemLibraries)
+include(InstallRequiredSystemLibraries)
+if(WITH_WINDOWS_BUNDLE_CRT)
# ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles
# redirects for this dll, for details see T88813.
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py
index a544f5733f0..f29d068044c 100644
--- a/build_files/cmake/project_source_info.py
+++ b/build_files/cmake/project_source_info.py
@@ -30,6 +30,8 @@ from typing import (
cast,
)
+import shlex
+
SOURCE_DIR = join(dirname(__file__), "..", "..")
SOURCE_DIR = normpath(SOURCE_DIR)
@@ -160,7 +162,7 @@ def build_info(
for c in compilers:
args = args.replace(c, fake_compiler)
- args = args.split()
+ args = shlex.split(args)
# end
# remove compiler
diff --git a/build_files/utils/make_bpy_wheel.py b/build_files/utils/make_bpy_wheel.py
new file mode 100755
index 00000000000..ba1d0f21937
--- /dev/null
+++ b/build_files/utils/make_bpy_wheel.py
@@ -0,0 +1,222 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+"""
+Make Python wheel package (`*.whl`) file from Blender built with 'WITH_PYTHON_MODULE' enabled.
+
+Example
+=======
+
+If the "bpy" module was build on Linux using the command:
+
+ make bpy lite
+
+The command to package it as a wheel is:
+
+ ./build_files/utils/make_bpy_wheel.py ../build_linux_bpy_lite/bin --output-dir=./
+
+This will create a `*.whl` file in the current directory.
+"""
+
+import argparse
+import make_utils
+import os
+import re
+import platform
+import string
+import setuptools # type: ignore
+import sys
+
+from typing import (
+ Generator,
+ List,
+ Optional,
+ Sequence,
+ Tuple,
+)
+
+
+# ------------------------------------------------------------------------------
+# Generic Functions
+
+def find_dominating_file(
+ path: str,
+ search: Sequence[str],
+) -> str:
+ while True:
+ for d in search:
+ if os.path.exists(os.path.join(path, d)):
+ return os.path.join(path, d)
+ path_next = os.path.normpath(os.path.join(path, ".."))
+ if path == path_next:
+ break
+ path = path_next
+ return ""
+
+
+# ------------------------------------------------------------------------------
+# CMake Cache Access
+
+def cmake_cache_var_iter(filepath_cmake_cache: str) -> Generator[Tuple[str, str, str], None, None]:
+ import re
+ re_cache = re.compile(r"([A-Za-z0-9_\-]+)?:?([A-Za-z0-9_\-]+)?=(.*)$")
+ with open(filepath_cmake_cache, "r", encoding="utf-8") as cache_file:
+ for l in cache_file:
+ match = re_cache.match(l.strip())
+ if match is not None:
+ var, type_, val = match.groups()
+ yield (var, type_ or "", val)
+
+
+def cmake_cache_var(filepath_cmake_cache: str, var: str) -> Optional[str]:
+ for var_iter, type_iter, value_iter in cmake_cache_var_iter(filepath_cmake_cache):
+ if var == var_iter:
+ return value_iter
+ return None
+
+
+def cmake_cache_var_or_exit(filepath_cmake_cache: str, var: str) -> str:
+ value = cmake_cache_var(filepath_cmake_cache, var)
+ if value is None:
+ sys.stderr.write("Unable to find %r in %r, abort!\n" % (var, filepath_cmake_cache))
+ sys.exit(1)
+ return value
+
+
+# ------------------------------------------------------------------------------
+# Argument Parser
+
+def argparse_create() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
+ parser.add_argument(
+ "install_dir",
+ metavar='INSTALL_DIR',
+ type=str,
+ help="The installation directory containing the \"bpy\" package.",
+ )
+ parser.add_argument(
+ "--build-dir",
+ metavar='BUILD_DIR',
+ default=None,
+ help="The build directory containing 'CMakeCache.txt' (search parent directories of INSTALL_DIR when omitted).",
+ required=False,
+ )
+ parser.add_argument(
+ "--output-dir",
+ metavar='OUTPUT_DIR',
+ default=None,
+ help="The destination directory for the '*.whl' file (use INSTALL_DIR when omitted).",
+ required=False,
+ )
+
+ return parser
+
+
+# ------------------------------------------------------------------------------
+# Main Function
+
+def main() -> None:
+
+ # Parse arguments.
+ args = argparse_create().parse_args()
+
+ install_dir = os.path.abspath(args.install_dir)
+ output_dir = os.path.abspath(args.output_dir) if args.output_dir else install_dir
+
+ if args.build_dir:
+ build_dir = os.path.abspath(args.build_dir)
+ filepath_cmake_cache = os.path.join(build_dir, "CMakeCache.txt")
+ del build_dir
+ if not os.path.exists(filepath_cmake_cache):
+ sys.stderr.write("File not found %r, abort!\n" % filepath_cmake_cache)
+ sys.exit(1)
+ else:
+ filepath_cmake_cache = find_dominating_file(install_dir, ("CMakeCache.txt",))
+ if not filepath_cmake_cache:
+ # Should never fail.
+ sys.stderr.write("Unable to find CMakeCache.txt in or above %r, abort!\n" % install_dir)
+ sys.exit(1)
+
+ # Get the major and minor Python version.
+ python_version = cmake_cache_var_or_exit(filepath_cmake_cache, "PYTHON_VERSION")
+ python_version_number = (
+ tuple(int("".join(c for c in digit if c in string.digits)) for digit in python_version.split(".")) +
+ # Support version without a minor version "3" (add zero).
+ tuple((0, 0, 0))
+ )
+ python_version_str = "%d.%d" % python_version_number[:2]
+
+ # Get Blender version.
+ blender_version_str = str(make_utils.parse_blender_version())
+
+ # Set platform tag following conventions.
+ if sys.platform == "darwin":
+ target = cmake_cache_var_or_exit(filepath_cmake_cache, "CMAKE_OSX_DEPLOYMENT_TARGET").split(".")
+ machine = cmake_cache_var_or_exit(filepath_cmake_cache, "CMAKE_OSX_ARCHITECTURES")
+ platform_tag = "macosx_%d_%d_%s" % (int(target[0]), int(target[1]), machine)
+ elif sys.platform == "win32":
+ platform_tag = "win_%s" % (platform.machine().lower())
+ elif sys.platform == "linux":
+ glibc = os.confstr("CS_GNU_LIBC_VERSION")
+ if glibc is None:
+ sys.stderr.write("Unable to find \"CS_GNU_LIBC_VERSION\", abort!\n")
+ sys.exit(1)
+ glibc = "%s_%s" % tuple(glibc.split()[1].split(".")[:2])
+ platform_tag = "manylinux_%s_%s" % (glibc, platform.machine().lower())
+ else:
+ sys.stderr.write("Unsupported platform: %s, abort!\n" % (sys.platform))
+ sys.exit(1)
+
+ os.chdir(install_dir)
+
+ # Include all files recursively.
+ def package_files(root_dir: str) -> List[str]:
+ paths = []
+ for path, dirs, files in os.walk(root_dir):
+ paths += [os.path.join("..", path, f) for f in files]
+ return paths
+
+ # Ensure this wheel is marked platform specific.
+ class BinaryDistribution(setuptools.dist.Distribution): # type: ignore
+ def has_ext_modules(self) -> bool:
+ return True
+
+ # Build wheel.
+ sys.argv = [sys.argv[0], "bdist_wheel"]
+
+ setuptools.setup(
+ name="bpy",
+ version=blender_version_str,
+ install_requires=["cython", "numpy", "requests", "zstandard"],
+ python_requires="==%d.%d.*" % (python_version_number[0], python_version_number[1]),
+ packages=["bpy"],
+ package_data={"": package_files("bpy")},
+ distclass=BinaryDistribution,
+ options={"bdist_wheel": {"plat_name": platform_tag}},
+
+ description="Blender as a Python module",
+ license="GPL-3.0",
+ author="Blender Foundation",
+ author_email="bf-committers@blender.org",
+ url="https://www.blender.org"
+ )
+
+ if not os.path.exists(output_dir):
+ os.makedirs(output_dir)
+
+ # Move wheel to output directory.
+ dist_dir = os.path.join(install_dir, "dist")
+ for f in os.listdir(dist_dir):
+ if f.endswith(".whl"):
+ # No apparent way to override this ABI version with setuptools, so rename.
+ sys_py = "cp%d%d" % (sys.version_info.major, sys.version_info.minor)
+ sys_py_abi = sys_py + sys.abiflags
+ blender_py = "cp%d%d" % (python_version_number[0], python_version_number[1])
+
+ renamed_f = f.replace(sys_py_abi, blender_py).replace(sys_py, blender_py)
+
+ os.rename(os.path.join(dist_dir, f), os.path.join(output_dir, renamed_f))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/build_files/utils/make_source_archive.py b/build_files/utils/make_source_archive.py
index befd6d84534..71fe7788b90 100755
--- a/build_files/utils/make_source_archive.py
+++ b/build_files/utils/make_source_archive.py
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
import argparse
-import dataclasses
+import make_utils
import os
import re
import subprocess
@@ -19,6 +19,8 @@ from typing import Iterable, TextIO, Optional, Any, Union
SKIP_NAMES = {
".gitignore",
".gitmodules",
+ ".gitattributes",
+ ".git-blame-ignore-revs",
".arcconfig",
".svn",
}
@@ -50,7 +52,7 @@ def main() -> None:
print(f"Output dir: {curdir}")
- version = parse_blender_version(blender_srcdir)
+ version = make_utils.parse_blender_version()
tarball = tarball_path(curdir, version, cli_args)
manifest = manifest_path(tarball)
packages_dir = packages_path(curdir, cli_args)
@@ -62,53 +64,7 @@ def main() -> None:
print("Done!")
-@dataclasses.dataclass
-class BlenderVersion:
- version: int # 293 for 2.93.1
- patch: int # 1 for 2.93.1
- cycle: str # 'alpha', 'beta', 'release', maybe others.
-
- @property
- def is_release(self) -> bool:
- return self.cycle == "release"
-
- def __str__(self) -> str:
- """Convert to version string.
-
- >>> str(BlenderVersion(293, 1, "alpha"))
- '2.93.1-alpha'
- >>> str(BlenderVersion(327, 0, "release"))
- '3.27.0'
- """
- version_major = self.version // 100
- version_minor = self.version % 100
- as_string = f"{version_major}.{version_minor}.{self.patch}"
- if self.is_release:
- return as_string
- return f"{as_string}-{self.cycle}"
-
-
-def parse_blender_version(blender_srcdir: Path) -> BlenderVersion:
- version_path = blender_srcdir / "source/blender/blenkernel/BKE_blender_version.h"
-
- version_info = {}
- line_re = re.compile(r"^#define (BLENDER_VERSION[A-Z_]*)\s+([0-9a-z]+)$")
-
- with version_path.open(encoding="utf-8") as version_file:
- for line in version_file:
- match = line_re.match(line.strip())
- if not match:
- continue
- version_info[match.group(1)] = match.group(2)
-
- return BlenderVersion(
- int(version_info["BLENDER_VERSION"]),
- int(version_info["BLENDER_VERSION_PATCH"]),
- version_info["BLENDER_VERSION_CYCLE"],
- )
-
-
-def tarball_path(output_dir: Path, version: BlenderVersion, cli_args: Any) -> Path:
+def tarball_path(output_dir: Path, version: make_utils.BlenderVersion, cli_args: Any) -> Path:
extra = ""
if cli_args.include_packages:
extra = "-with-libraries"
@@ -148,7 +104,7 @@ def packages_path(current_directory: Path, cli_args: Any) -> Optional[Path]:
def create_manifest(
- version: BlenderVersion,
+ version: make_utils.BlenderVersion,
outpath: Path,
blender_srcdir: Path,
packages_dir: Optional[Path],
@@ -170,9 +126,9 @@ def main_files_to_manifest(blender_srcdir: Path, outfile: TextIO) -> None:
def submodules_to_manifest(
- blender_srcdir: Path, version: BlenderVersion, outfile: TextIO
+ blender_srcdir: Path, version: make_utils.BlenderVersion, outfile: TextIO
) -> None:
- skip_addon_contrib = version.is_release
+ skip_addon_contrib = version.is_release()
assert not blender_srcdir.is_absolute()
for line in git_command("-C", blender_srcdir, "submodule"):
@@ -200,7 +156,11 @@ def packages_to_manifest(outfile: TextIO, packages_dir: Path) -> None:
def create_tarball(
- version: BlenderVersion, tarball: Path, manifest: Path, blender_srcdir: Path, packages_dir: Optional[Path]
+ version: make_utils.BlenderVersion,
+ tarball: Path,
+ manifest: Path,
+ blender_srcdir: Path,
+ packages_dir: Optional[Path],
) -> None:
print(f'Creating archive: "{tarball}" ...', end="", flush=True)
command = ["tar"]
diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py
index e4c676474b5..564930617ff 100755
--- a/build_files/utils/make_utils.py
+++ b/build_files/utils/make_utils.py
@@ -9,9 +9,15 @@ import re
import shutil
import subprocess
import sys
+from pathlib import Path
+from typing import (
+ Sequence,
+ Optional,
+)
-def call(cmd, exit_on_error=True, silent=False):
+
+def call(cmd: Sequence[str], exit_on_error: bool = True, silent: bool = False) -> int:
if not silent:
print(" ".join(cmd))
@@ -29,7 +35,7 @@ def call(cmd, exit_on_error=True, silent=False):
return retcode
-def check_output(cmd, exit_on_error=True):
+def check_output(cmd: Sequence[str], exit_on_error: bool = True) -> str:
# Flush to ensure correct order output on Windows.
sys.stdout.flush()
sys.stderr.flush()
@@ -46,14 +52,14 @@ def check_output(cmd, exit_on_error=True):
return output.strip()
-def git_branch_exists(git_command, branch):
+def git_branch_exists(git_command: str, branch: str) -> bool:
return (
call([git_command, "rev-parse", "--verify", branch], exit_on_error=False, silent=True) == 0 or
call([git_command, "rev-parse", "--verify", "remotes/origin/" + branch], exit_on_error=False, silent=True) == 0
)
-def git_branch(git_command):
+def git_branch(git_command: str) -> str:
# Get current branch name.
try:
branch = subprocess.check_output([git_command, "rev-parse", "--abbrev-ref", "HEAD"])
@@ -64,7 +70,7 @@ def git_branch(git_command):
return branch.strip().decode('utf8')
-def git_tag(git_command):
+def git_tag(git_command: str) -> Optional[str]:
# Get current tag name.
try:
tag = subprocess.check_output([git_command, "describe", "--exact-match"], stderr=subprocess.STDOUT)
@@ -74,18 +80,19 @@ def git_tag(git_command):
return tag.strip().decode('utf8')
-def git_branch_release_version(branch, tag):
- release_version = re.search("^blender-v(.*)-release$", branch)
- if release_version:
- release_version = release_version.group(1)
+def git_branch_release_version(branch: str, tag: str) -> Optional[str]:
+ re_match = re.search("^blender-v(.*)-release$", branch)
+ release_version = None
+ if re_match:
+ release_version = re_match.group(1)
elif tag:
- release_version = re.search(r"^v([0-9]*\.[0-9]*).*", tag)
- if release_version:
- release_version = release_version.group(1)
+ re_match = re.search(r"^v([0-9]*\.[0-9]*).*", tag)
+ if re_match:
+ release_version = re_match.group(1)
return release_version
-def svn_libraries_base_url(release_version, branch=None):
+def svn_libraries_base_url(release_version: Optional[str], branch: Optional[str] = None) -> str:
if release_version:
svn_branch = "tags/blender-" + release_version + "-release"
elif branch:
@@ -95,9 +102,58 @@ def svn_libraries_base_url(release_version, branch=None):
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"
-def command_missing(command):
+def command_missing(command: str) -> bool:
# Support running with Python 2 for macOS
if sys.version_info >= (3, 0):
return shutil.which(command) is None
else:
return False
+
+
+class BlenderVersion:
+ def __init__(self, version: int, patch: int, cycle: str):
+ # 293 for 2.93.1
+ self.version = version
+ # 1 for 2.93.1
+ self.patch = patch
+ # 'alpha', 'beta', 'release', maybe others.
+ self.cycle = cycle
+
+ def is_release(self) -> bool:
+ return self.cycle == "release"
+
+ def __str__(self) -> str:
+ """Convert to version string.
+
+ >>> str(BlenderVersion(293, 1, "alpha"))
+ '2.93.1-alpha'
+ >>> str(BlenderVersion(327, 0, "release"))
+ '3.27.0'
+ """
+ version_major = self.version // 100
+ version_minor = self.version % 100
+ as_string = f"{version_major}.{version_minor}.{self.patch}"
+ if self.is_release():
+ return as_string
+ return f"{as_string}-{self.cycle}"
+
+
+def parse_blender_version() -> BlenderVersion:
+ blender_srcdir = Path(__file__).absolute().parent.parent.parent
+ version_path = blender_srcdir / "source/blender/blenkernel/BKE_blender_version.h"
+
+ version_info = {}
+ line_re = re.compile(r"^#define (BLENDER_VERSION[A-Z_]*)\s+([0-9a-z]+)$")
+
+ with version_path.open(encoding="utf-8") as version_file:
+ for line in version_file:
+ match = line_re.match(line.strip())
+ if not match:
+ continue
+ version_info[match.group(1)] = match.group(2)
+
+ return BlenderVersion(
+ int(version_info["BLENDER_VERSION"]),
+ int(version_info["BLENDER_VERSION_PATCH"]),
+ version_info["BLENDER_VERSION_CYCLE"],
+ )