Cycles: new Microfacet-based Hair BSDF with elliptical cross-section support #105600

Merged
Weizhen Huang merged 114 commits from weizhen/blender:microfacet_hair into main 2023-08-18 12:46:20 +02:00
7234 changed files with 1028306 additions and 1167424 deletions
Showing only changes of commit b5eca9c2c5 - Show all commits

View File

@ -1,5 +1,6 @@
# SPDX-FileCopyrightText: 2006 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation
# -----------------------------------------------------------------------------
# Early Initialization
@ -169,6 +170,13 @@ if(WIN32)
)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19")
# This changes the default value from Off to On, but will still allow people to manually change
# this setting through their CMakeCache.txt if they desire to do so.
set(CMAKE_OPTIMIZE_DEPENDENCIES ON CACHE INTERNAL "")
endif()
# -----------------------------------------------------------------------------
# Declare Options
@ -509,6 +517,7 @@ mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
mark_as_advanced(WITH_CYCLES_PRECOMPUTE)
mark_as_advanced(CYCLES_TEST_DEVICES)
# NVIDIA CUDA & OptiX
if(NOT APPLE)
@ -631,18 +640,23 @@ if(UNIX AND NOT APPLE)
endif()
# OpenGL
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
# GPU Module
option(WITH_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF)
option(WITH_RENDERDOC "Use Renderdoc API to capture frames" OFF)
mark_as_advanced(
WITH_OPENGL
WITH_GPU_BUILDTIME_SHADER_BUILDER
WITH_RENDERDOC
)
# OpenGL
if(NOT APPLE)
option(WITH_OPENGL_BACKEND "Enable OpenGL support as graphic backend" ON)
mark_as_advanced(WITH_OPENGL_BACKEND)
else()
set(WITH_OPENGL_BACKEND OFF)
endif()
# Vulkan
option(WITH_VULKAN_BACKEND "Enable Vulkan as graphics backend (only for development)" OFF)
option(WITH_VULKAN_GUARDEDALLOC "Use guardedalloc for host allocations done inside Vulkan (development option)" OFF)
@ -652,7 +666,6 @@ mark_as_advanced(
)
# Metal
if(APPLE)
option(WITH_METAL_BACKEND "Use Metal for graphics instead of (or as well as) OpenGL on macOS." ON)
mark_as_advanced(WITH_METAL_BACKEND)
@ -680,7 +693,7 @@ if(UNIX)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(WITH_LINKER_LLD "Use ld.lld linker which is usually faster than ld.gold" OFF)
mark_as_advanced(WITH_LINKER_LLD)
option(WITH_LINKER_MOLD "Use ld.mold linker which is usually faster than ld.gold & ld.lld. Needs \"sold\" subscription on macOS." OFF)
option(WITH_LINKER_MOLD "Use ld.mold linker which is usually faster than ld.gold & ld.lld" OFF)
mark_as_advanced(WITH_LINKER_MOLD)
endif()
endif()
@ -914,10 +927,9 @@ set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
# NanoVDB requires OpenVDB to convert the data structure
set_and_warn_dependency(WITH_OPENVDB WITH_NANOVDB OFF)
# OpenVDB, Alembic and Vulkan, OSL uses 'half' or 'imath' from OpenEXR
# OpenVDB, Alembic and OSL uses 'half' or 'imath' from OpenEXR
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_ALEMBIC OFF)
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_VULKAN_BACKEND OFF)
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_CYCLES_OSL OFF)
# auto enable openimageio for cycles
@ -1241,14 +1253,6 @@ if(WITH_OPENVDB)
list(APPEND OPENVDB_LIBRARIES ${BOOST_LIBRARIES} ${TBB_LIBRARIES})
endif()
# -----------------------------------------------------------------------------
# Configure OpenGL
if(WITH_OPENGL)
add_definitions(-DWITH_OPENGL)
endif()
# -----------------------------------------------------------------------------
# Configure Metal
@ -1285,6 +1289,9 @@ if(WITH_OPENMP)
add_definitions("${OpenMP_C_FLAGS}")
find_library_static(OpenMP_LIBRARIES gomp ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
mark_as_advanced(
OpenMP_LIBRARIES
)
endif()
endif()
@ -1567,6 +1574,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_check_c_compiler_flag(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
add_check_c_compiler_flag(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
add_check_c_compiler_flag(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
add_check_c_compiler_flag(C_WARNINGS C_WARN_UNDEF -Wundef)
add_check_c_compiler_flag(C_WARNINGS C_WARN_UNDEF_PREFIX -Wundef-prefix)
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.
@ -1581,6 +1590,10 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# Apple Clang (tested on version 12) doesn't support this flag while LLVM Clang 11 does.
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override)
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNDEF_PREFIX -Wundef-prefix)
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNUSED_PARAMETER -Wunused-parameter)
# gives too many unfixable warnings
# add_check_c_compiler_flag(C_WARNINGS C_WARN_UNUSED_MACROS -Wunused-macros)
# add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
@ -1625,6 +1638,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_BITWISE_INSTEAD_OF_LOGICAL -Wno-bitwise-instead-of-logical)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_IMPLICIT_CONST_INT_FLOAT_CONVERSION -Wno-implicit-const-int-float-conversion)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEF -Wno-undef)
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEF_PREFIX -Wno-undef-prefix)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
@ -1740,6 +1755,8 @@ endif()
if(WITH_COMPILER_SHORT_FILE_MACRO)
# Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
set(C_PREFIX_MAP_FLAGS "")
set(CXX_PREFIX_MAP_FLAGS "")
add_check_c_compiler_flag(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
add_check_cxx_compiler_flag(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP)
@ -1774,6 +1791,8 @@ if(WITH_COMPILER_SHORT_FILE_MACRO)
)
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)
endif()
unset(C_PREFIX_MAP_FLAGS)
unset(CXX_PREFIX_MAP_FLAGS)
endif()
# Include warnings first, so its possible to disable them with user defined flags

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2011-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
# This Makefile does an out-of-source CMake build in ../build_`OS`_`CPU`
@ -57,6 +59,7 @@ Static Source Code Checking
* check_cppcheck: Run blender source through cppcheck (C & C++).
* check_clang_array: Run blender source through clang array checking script (C & C++).
* check_struct_comments: Check struct member comments are correct (C & C++).
* check_deprecated: Check if there is any deprecated code to remove.
* check_descriptions: Check for duplicate/invalid descriptions.
* check_licenses: Check license headers follow the SPDX license specification,
@ -466,6 +469,13 @@ check_cppcheck: .FORCE
"$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt"
check_struct_comments: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) \
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang.py" \
--checks=struct_comments --match=".*" --jobs=$(NPROCS)
check_clang_array: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \

View File

@ -41,8 +41,8 @@ include(cmake/boost_build_options.cmake)
include(cmake/download.cmake)
include(cmake/macros.cmake)
if(ENABLE_MINGW64)
include(cmake/setup_mingw64.cmake)
if(ENABLE_MSYS2)
include(cmake/setup_msys2.cmake)
else()
set(mingw_LIBDIR ${LIBDIR})
endif()
@ -129,13 +129,10 @@ if(NOT APPLE)
include(cmake/level-zero.cmake)
endif()
if(NOT WIN32 OR ENABLE_MINGW64)
if(NOT WIN32 OR ENABLE_MSYS2)
include(cmake/gmp.cmake)
include(cmake/openjpeg.cmake)
if(NOT WIN32 OR BUILD_MODE STREQUAL Release)
if(WIN32)
include(cmake/zlib_mingw.cmake)
endif()
include(cmake/lame.cmake)
include(cmake/ogg.cmake)
include(cmake/vorbis.cmake)
@ -143,16 +140,12 @@ if(NOT WIN32 OR ENABLE_MINGW64)
include(cmake/opus.cmake)
include(cmake/vpx.cmake)
include(cmake/x264.cmake)
include(cmake/xvidcore.cmake)
include(cmake/aom.cmake)
include(cmake/ffmpeg.cmake)
include(cmake/fftw.cmake)
include(cmake/flac.cmake)
include(cmake/sndfile.cmake)
if(WIN32)
include(cmake/iconv.cmake)
endif()
if(UNIX)
include(cmake/flac.cmake)
if(NOT APPLE)
include(cmake/spnav.cmake)
include(cmake/jemalloc.cmake)
@ -181,4 +174,5 @@ include(cmake/shaderc.cmake)
include(cmake/vulkan.cmake)
include(cmake/pybind11.cmake)
include(cmake/harvest.cmake)
include(cmake/deps_html.cmake)
include(cmake/cve_check.cmake)

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2017-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(ALEMBIC_EXTRA_ARGS

View File

@ -1,15 +1,8 @@
# SPDX-FileCopyrightText: 2022-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# The default generator on windows is msbuild, which we do not
# want to use for this dep, as needs to build with mingw
set(AOM_GENERATOR "Ninja")
# The default flags are full of MSVC options given this will be
# building with mingw, it'll have an unhappy time with that and
# we need to clear them out.
set(AOM_CMAKE_FLAGS )
else()
set(AOM_GENERATOR "Unix Makefiles")
if(NOT WIN32)
set(AOM_CMAKE_FLAGS ${DEFAULT_CMAKE_FLAGS})
endif()
@ -34,7 +27,7 @@ ExternalProject_Add(external_aom
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/aom/src/external_aom < ${PATCH_DIR}/aom.diff
CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/aom/src/external_aom-build/ &&
${CMAKE_COMMAND} -G "${AOM_GENERATOR}" -DCMAKE_INSTALL_PREFIX=${LIBDIR}/aom ${AOM_CMAKE_FLAGS} ${AOM_EXTRA_ARGS} ${BUILD_DIR}/aom/src/external_aom/
${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/aom ${AOM_CMAKE_FLAGS} ${AOM_EXTRA_ARGS} ${BUILD_DIR}/aom/src/external_aom/
BUILD_COMMAND ${CMAKE_COMMAND} --build .
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install
INSTALL_DIR ${LIBDIR}/aom

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2012-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(BLOSC_EXTRA_ARGS

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2017-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(BOOST_ADDRESS_MODEL 64)

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2002-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(BROTLI_EXTRA_ARGS

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2002-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(BZIP2_PREFIX "${LIBDIR}/bzip2")

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2019-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(UNIX)

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
# CVE Check requirements

View File

@ -0,0 +1,7 @@
<html>
<body>
<table border=1>
@HTMLCONTENTS@
<table>
</body>
</html>

View File

@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2023 Ray Molenkamp
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This outputs an html file with the name, version and homepage for
# every dependency we have, this is used by the release manager to
# update the licensing document.
set(HTMLCONTENTS)
get_cmake_property(_variableNames VARIABLES)
foreach(_variableName ${_variableNames})
if(_variableName MATCHES "_URI$")
string(REPLACE "_URI" "" DEP_NAME ${_variableName})
set(DEP_VERSION "${${DEP_NAME}_VERSION}")
# First see if DEP_HOMEPAGE is set, if it is use that.
set(DEP_HOMEPAGE ${${DEP_NAME}_HOMEPAGE})
if(NOT DEP_HOMEPAGE)
# If the xxx_HOMEPAGE is not set but the URI for the archive is a known github format extract the reprository/project from the URI
string(REGEX MATCH "https:\/\/(.*)github\.com\/(.+)\/(archive|releases|release|tar.gz)\/(.*)" DEP_PROJECT "${${_variableName}}")
if(CMAKE_MATCH_2)
set(DEP_HOMEPAGE "https://www.github.com/${CMAKE_MATCH_2}")
else() # If that is also not set, error out to ensure this information is supplied
message(FATAL_ERROR "${DEP_NAME} No homepage set, please set ${DEP_NAME}_HOMEPAGE in versions.cmake")
endif()
endif()
set(HTMLCONTENTS "${HTMLCONTENTS}<tr><td>${DEP_NAME}</td><td>${DEP_VERSION}</td><td><a href=\"${DEP_HOMEPAGE}\" target=\"_blank\">${DEP_HOMEPAGE}</a></td></tr>\n")
endif()
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/cmake/deps.html.in ${CMAKE_CURRENT_BINARY_DIR}/deps.html @ONLY)

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2021-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
## Update and uncomment this in the release branch
@ -106,7 +108,6 @@ download_source(FLAC)
download_source(VPX)
download_source(OPUS)
download_source(X264)
download_source(XVIDCORE)
download_source(OPENJPEG)
download_source(FFMPEG)
download_source(FFTW)

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
# LLVM does not switch over to cpp17 until llvm 16 and building ealier versions with

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
# These are build time requirements for dpcpp

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2017-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the utility apps may use png/tiff/gif system libraries, but the

View File

@ -1,4 +1,7 @@
# SPDX-FileCopyrightText: 2022-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(EPOXY_LIB_TYPE shared)
else()

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2002-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(EXPAT_EXTRA_ARGS

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2002-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_ffi

View File

@ -1,9 +1,13 @@
# SPDX-FileCopyrightText: 2017-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(temp_LIBDIR ${mingw_LIBDIR})
else()
if(NOT WIN32)
set(temp_LIBDIR ${LIBDIR})
set(LIBDIR_FLAG "-L")
else()
set(temp_LIBDIR ${msys2_LIBDIR})
set(LIBDIR_FLAG "-LIBPATH:")
endif()
set(FFMPEG_CFLAGS "\
@ -15,28 +19,57 @@ set(FFMPEG_CFLAGS "\
-I${temp_LIBDIR}/opus/include \
-I${temp_LIBDIR}/vpx/include \
-I${temp_LIBDIR}/x264/include \
-I${temp_LIBDIR}/xvidcore/include \
-I${temp_LIBDIR}/zlib/include \
-I${temp_LIBDIR}/aom/include"
)
set(FFMPEG_LDFLAGS "\
-L${temp_LIBDIR}/lame/lib \
-L${temp_LIBDIR}/openjpeg/lib \
-L${temp_LIBDIR}/ogg/lib \
-L${temp_LIBDIR}/vorbis/lib \
-L${temp_LIBDIR}/theora/lib \
-L${temp_LIBDIR}/opus/lib \
-L${temp_LIBDIR}/vpx/lib \
-L${temp_LIBDIR}/x264/lib \
-L${temp_LIBDIR}/xvidcore/lib \
-L${temp_LIBDIR}/zlib/lib \
-L${temp_LIBDIR}/aom/lib"
${LIBDIR_FLAG}${temp_LIBDIR}/lame/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/openjpeg/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/ogg/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/vorbis/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/theora/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/opus/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/vpx/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/x264/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/zlib/lib \
${LIBDIR_FLAG}${temp_LIBDIR}/aom/lib"
)
set(FFMPEG_PATCH_FILE)
if(WIN32)
set(FFMPEG_CFLAGS "\
${FFMPEG_CFLAGS} \
-I${temp_LIBDIR}/openjpeg_msvc/include/openjpeg-2.5 \
-I${temp_LIBDIR}/opus/include/opus \
-DOPJ_STATIC \
-MD \
-UHAVE_UNISTD_H")
set(FFMPEG_LDFLAGS "\
${FFMPEG_LDFLAGS} \
${LIBDIR_FLAG}${temp_LIBDIR}/openjpeg_msvc/lib \
ucrt.lib")
# As we now use MSVC on windows, pkgconfig is not really a viable option for many packages
# so this patch removes those checks in favour of looking for the libs directly.
set(FFMPEG_PATCH_FILE ${PATCH_DIR}/ffmpeg_windows.diff)
else()
# OpenJpeg is compiled with pthread support on Linux, which is all fine and is what we
# want for maximum runtime performance, but due to static nature of that library we
# need to force ffmpeg to link against pthread, otherwise test program used by autoconf
# will fail. This patch does that in a way that is compatible with multiple distributions.
set(FFMPEG_PATCH_FILE ${PATCH_DIR}/ffmpeg.diff)
endif()
set(FFMPEG_EXTRA_FLAGS
--pkg-config-flags=--static
--extra-cflags=${FFMPEG_CFLAGS}
--extra-ldflags=${FFMPEG_LDFLAGS}
)
set(FFMPEG_ENV)
if(NOT WIN32)
set(FFMPEG_ENV "PKG_CONFIG_PATH=\
${temp_LIBDIR}/openjpeg/lib/pkgconfig:\
${temp_LIBDIR}/x264/lib/pkgconfig:\
@ -48,11 +81,11 @@ ${temp_LIBDIR}/openjpeg/lib/pkgconfig:\
${temp_LIBDIR}/opus/lib/pkgconfig:\
${temp_LIBDIR}/aom/lib/pkgconfig:"
)
endif()
unset(temp_LIBDIR)
if(WIN32)
set(FFMPEG_ENV set ${FFMPEG_ENV} &&)
set(FFMPEG_EXTRA_FLAGS
${FFMPEG_EXTRA_FLAGS}
--disable-static
@ -61,7 +94,31 @@ if(WIN32)
--disable-pthreads
--enable-libopenjpeg
--disable-mediafoundation
--toolchain=msvc
--target-os=win32
--disable-inline-asm
)
if(BLENDER_PLATFORM_ARM)
set(FFMPEG_EXTRA_FLAGS
${FFMPEG_EXTRA_FLAGS}
--arch=aarch64
--enable-cross-compile
--as=armasm64
)
set(GAS_PATH ${BUILD_DIR}/x264/src/external_x264/tools/)
string(REPLACE "/" "\\" GAS_PATH ${GAS_PATH})
set(ENV{PATH} "$ENV{PATH};${GAS_PATH}")
else()
set(FFMPEG_EXTRA_FLAGS
${FFMPEG_EXTRA_FLAGS}
--arch=x64
--target-os=win32
)
endif()
set(FFMPEG_CONFIGURE_COMMAND ${CONFIGURE_ENV_MSVC})
else()
set(FFMPEG_EXTRA_FLAGS
${FFMPEG_EXTRA_FLAGS}
@ -69,6 +126,8 @@ else()
--disable-shared
--enable-libopenjpeg
)
set(FFMPEG_CONFIGURE_COMMAND ${CONFIGURE_ENV_NO_PERL})
endif()
if(APPLE)
@ -88,13 +147,9 @@ ExternalProject_Add(external_ffmpeg
URL file://${PACKAGE_DIR}/${FFMPEG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FFMPEG_HASH_TYPE}=${FFMPEG_HASH}
# OpenJpeg is compiled with pthread support on Linux, which is all fine and is what we
# want for maximum runtime performance, but due to static nature of that library we
# need to force ffmpeg to link against pthread, otherwise test program used by autoconf
# will fail. This patch does that in a way that is compatible with multiple distributions.
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/ffmpeg/src/external_ffmpeg < ${PATCH_DIR}/ffmpeg.diff
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/ffmpeg/src/external_ffmpeg < ${FFMPEG_PATCH_FILE}
PREFIX ${BUILD_DIR}/ffmpeg
CONFIGURE_COMMAND ${CONFIGURE_ENV_NO_PERL} &&
CONFIGURE_COMMAND ${FFMPEG_CONFIGURE_COMMAND} &&
cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ &&
${FFMPEG_ENV} ${CONFIGURE_COMMAND_NO_TARGET} ${FFMPEG_EXTRA_FLAGS}
--disable-lzma
@ -118,7 +173,6 @@ ExternalProject_Add(external_ffmpeg
--enable-libmp3lame
--disable-librtmp
--enable-libx264
--enable-libxvid
--enable-libaom
--disable-libopencore-amrnb
--disable-libopencore-amrwb
@ -144,8 +198,8 @@ ExternalProject_Add(external_ffmpeg
--disable-outdev=alsa
--disable-crystalhd
--disable-sndio
BUILD_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make install
BUILD_COMMAND ${FFMPEG_CONFIGURE_COMMAND} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${FFMPEG_CONFIGURE_COMMAND} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make install
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/ffmpeg ${DEFAULT_CMAKE_FLAGS}
INSTALL_DIR ${LIBDIR}/ffmpeg
)
@ -157,8 +211,6 @@ endif()
add_dependencies(
external_ffmpeg
external_zlib
external_openjpeg
external_xvidcore
external_x264
external_opus
external_vpx
@ -167,17 +219,21 @@ add_dependencies(
external_ogg
external_lame
external_aom
external_sndfile
external_flac
)
if(WIN32)
add_dependencies(
external_ffmpeg
external_zlib_mingw
external_zlib
external_openjpeg_msvc
)
endif()
if(UNIX)
add_dependencies(
external_ffmpeg
external_nasm
external_openjpeg
)
endif()

View File

@ -1,46 +1,55 @@
# SPDX-FileCopyrightText: 2017-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(FFTW_EXTRA_ARGS)
macro(fftw_build FFTW_POSTFIX)
if(WIN32)
set(FFTW3_PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX} < ${PATCH_DIR}/fftw3.diff)
set(FFTW_EXTRA_ARGS --disable-static --enable-shared)
set(FFTW_INSTALL install-strip)
if("${FFTW_POSTFIX}" STREQUAL "float")
set(FFTW_EXTRA_ARGS -DENABLE_FLOAT=ON)
endif()
ExternalProject_Add(external_fftw3_${FFTW_POSTFIX}
URL file://${PACKAGE_DIR}/${FFTW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FFTW_HASH_TYPE}=${FFTW_HASH}
PREFIX ${BUILD_DIR}/fftw3
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/fftw3 ${FFTW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/fftw3
)
else()
set(FFTW_EXTRA_ARGS --enable-static)
set(FFTW_INSTALL install)
ExternalProject_Add(external_fftw3_${FFTW_POSTFIX}
URL file://${PACKAGE_DIR}/${FFTW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FFTW_HASH_TYPE}=${FFTW_HASH}
PREFIX ${BUILD_DIR}/fftw3
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && ${CONFIGURE_COMMAND} ${FFTW_EXTRA_ARGS} ${ARGN} --prefix=${mingw_LIBDIR}/fftw3
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && make ${FFTW_INSTALL}
INSTALL_DIR ${LIBDIR}/fftw3
)
endif()
ExternalProject_Add(external_fftw3_${FFTW_POSTFIX}
URL file://${PACKAGE_DIR}/${FFTW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FFTW_HASH_TYPE}=${FFTW_HASH}
PREFIX ${BUILD_DIR}/fftw3
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && ${CONFIGURE_COMMAND} ${FFTW_EXTRA_ARGS} ${ARGN} --prefix=${mingw_LIBDIR}/fftw3
PATCH_COMMAND ${FFTW3_PATCH_COMMAND}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3_${FFTW_POSTFIX}/ && make ${FFTW_INSTALL}
INSTALL_DIR ${LIBDIR}/fftw3
)
endmacro()
fftw_build(double)
fftw_build(float --enable-float)
if(MSVC)
set_target_properties(external_fftw3_double PROPERTIES FOLDER Mingw)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_fftw3_double after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3.dll.a ${HARVEST_TARGET}/fftw3/lib/libfftw3-3.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/bin/libfftw3-3.dll ${HARVEST_TARGET}/fftw3/lib/libfftw3-3.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/fftw3.lib ${HARVEST_TARGET}/fftw3/lib/fftw3.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/bin/fftw3.dll ${HARVEST_TARGET}/fftw3/lib/fftw3.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/include/fftw3.h ${HARVEST_TARGET}/fftw3/include/fftw3.h
DEPENDEES install
)
ExternalProject_Add_Step(external_fftw3_float after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3f.dll.a ${HARVEST_TARGET}/fftw3/lib/libfftw3f.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/bin/libfftw3f-3.dll ${HARVEST_TARGET}/fftw3/lib/libfftw3f-3.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/fftw3f.lib ${HARVEST_TARGET}/fftw3/lib/fftw3f.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/bin/fftw3f.dll ${HARVEST_TARGET}/fftw3/lib/fftw3f.dll
DEPENDEES install
)
)
endif()
endif()

View File

@ -1,16 +1,47 @@
# SPDX-FileCopyrightText: 2002-2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_flac
URL file://${PACKAGE_DIR}/${FLAC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FLAC_HASH_TYPE}=${FLAC_HASH}
PREFIX ${BUILD_DIR}/flac
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flac --disable-shared --enable-static
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && make install
INSTALL_DIR ${LIBDIR}/flac
)
if(NOT WIN32)
ExternalProject_Add(external_flac
URL file://${PACKAGE_DIR}/${FLAC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FLAC_HASH_TYPE}=${FLAC_HASH}
PREFIX ${BUILD_DIR}/flac
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flac --disable-shared --enable-static
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && make install
INSTALL_DIR ${LIBDIR}/flac
)
else()
set(FLAC_CXX_FLAGS "-DFLAC__NO_DLL=ON")
set(FLAC_EXTRA_ARGS
-DCMAKE_POLICY_DEFAULT_CMP0074=NEW
-DBUILD_PROGRAMS=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_DOCS=OFF
-DBUILD_TESTING=OFF
-DINSTALL_MANPAGES=OFF
-DOgg_ROOT=${LIBDIR}/ogg
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_C_FLAGS_RELEASE=${FLAC_CXX_FLAGS}
)
ExternalProject_Add(external_flac
URL file://${PACKAGE_DIR}/${FLAC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FLAC_HASH_TYPE}=${FLAC_HASH}
PREFIX ${BUILD_DIR}/flac
CMAKE_GENERATOR "Ninja"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/flac ${DEFAULT_CMAKE_FLAGS} ${FLAC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/flac
)
endif()
if(MSVC)
set_target_properties(external_flac PROPERTIES FOLDER Mingw)
add_dependencies(
external_flac
external_ogg
)
endif()

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2002-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_flex

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2002-2022 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
set(FLEXBISON_EXTRA_ARGS)

View File

@ -1,3 +1,5 @@
# SPDX-FileCopyrightText: 2022 Blender Foundation
#
# SPDX-License-Identifier: GPL