From 3a66f7c213d3087f535f8f75b48565946f1246f5 Mon Sep 17 00:00:00 2001 From: Christoph Willing Date: Sat, 13 Feb 2021 20:55:54 +1000 Subject: graphics/Blender: Add support for embree Signed-off-by: Christoph Willing Signed-off-by: Willy Sudiarto Raharjo --- graphics/Blender/01_FindEmbree_so.diff | 75 ++++++++++++++++++++++++++++++++++ graphics/Blender/Blender.SlackBuild | 16 +++++++- graphics/Blender/Blender.info | 2 +- graphics/Blender/README | 3 ++ 4 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 graphics/Blender/01_FindEmbree_so.diff (limited to 'graphics') diff --git a/graphics/Blender/01_FindEmbree_so.diff b/graphics/Blender/01_FindEmbree_so.diff new file mode 100644 index 0000000000..6739f6852a --- /dev/null +++ b/graphics/Blender/01_FindEmbree_so.diff @@ -0,0 +1,75 @@ +--- build_files/cmake/Modules/FindEmbree.cmake.orig 2020-10-21 18:59:19.000000000 +1000 ++++ build_files/cmake/Modules/FindEmbree.cmake 2021-01-16 01:26:51.000000000 +1000 +@@ -7,19 +7,12 @@ + # EMBREE_ROOT_DIR, The base directory to search for Embree. + # This can also be an environment variable. + # EMBREEFOUND, If false, do not try to use Embree. +-# +-# also defined, but not for general use are +-# EMBREE_LIBRARY, where to find the Embree library. + + #============================================================================= + # Copyright 2018 Blender Foundation. + # +-# Distributed under the OSI-approved BSD License (the "License"); +-# see accompanying file Copyright.txt for details. +-# +-# This software is distributed WITHOUT ANY WARRANTY; without even the +-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +-# See the License for more information. ++# Distributed under the OSI-approved BSD 3-Clause License, ++# see accompanying file BSD-3-Clause-license.txt for details. + #============================================================================= + + # If EMBREE_ROOT_DIR was defined in the environment, use it. +@@ -44,9 +37,9 @@ + + SET(_embree_FIND_COMPONENTS + embree3 ++ embree_sse42 + embree_avx + embree_avx2 +- embree_sse42 + lexers + math + simd +@@ -66,29 +59,28 @@ + PATH_SUFFIXES + lib64 lib + ) ++ IF (NOT EMBREE_${UPPERCOMPONENT}_LIBRARY) ++ IF (EMBREE_EMBREE3_LIBRARY) ++ # If we can't find all the static libraries, try to fall back to the shared library if found. ++ # This allows building with a shared embree library ++ SET(_embree_LIBRARIES ${EMBREE_EMBREE3_LIBRARY}) ++ BREAK() ++ ENDIF () ++ ENDIF () + LIST(APPEND _embree_LIBRARIES "${EMBREE_${UPPERCOMPONENT}_LIBRARY}") + ENDFOREACH() + + +-FIND_LIBRARY(EMBREE_LIBRARY +- NAMES +- libembree3 +- HINTS +- ${_embree_SEARCH_DIRS} +- PATH_SUFFIXES +- lib64 lib +-) +- + # handle the QUIETLY and REQUIRED arguments and set EMBREE_FOUND to TRUE if + # all listed variables are TRUE + INCLUDE(FindPackageHandleStandardArgs) +-FIND_PACKAGE_HANDLE_STANDARD_ARGS(EMBREE DEFAULT_MSG ++FIND_PACKAGE_HANDLE_STANDARD_ARGS(Embree DEFAULT_MSG + _embree_LIBRARIES EMBREE_INCLUDE_DIR) + + IF(EMBREE_FOUND) + SET(EMBREE_LIBRARIES ${_embree_LIBRARIES}) + SET(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR}) +-ENDIF(EMBREE_FOUND) ++ENDIF() + + MARK_AS_ADVANCED( + EMBREE_INCLUDE_DIR diff --git a/graphics/Blender/Blender.SlackBuild b/graphics/Blender/Blender.SlackBuild index 06d9917ec5..4d8d8cb152 100644 --- a/graphics/Blender/Blender.SlackBuild +++ b/graphics/Blender/Blender.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for Blender -# Copyright 2015-2020 Christoph Willing, Brisbane Australia +# Copyright 2015-2021 Christoph Willing, Brisbane Australia # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -24,7 +24,7 @@ PRGNAM=Blender VERSION=${VERSION:-2.83.8} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} SRCNAM=blender @@ -69,6 +69,16 @@ if [ -d /usr/include/cuda ]; then fi fi +embree="" +if [ -d /usr/include/embree3 ]; then + # If embree is installed, assume we want to use it + embree="-DWITH_CYCLES_EMBREE=ON" + # However disable embree if requested by e.g. EMBREE=no + if [ ${EMBREE:-yes} != "yes" ]; then + embree="-DWITH_CYCLES_EMBREE=OFF" + fi +fi + set -e rm -rf $PKG @@ -77,6 +87,7 @@ cd $TMP rm -rf $SRCNAM-$VERSION tar xvf $CWD/$SRCNAM-$VERSION.tar.xz cd $SRCNAM-$VERSION +patch -p0 < $CWD/01_FindEmbree_so.diff chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ @@ -115,6 +126,7 @@ cd build -DWITH_SDL_DYNLOAD:BOOL=ON \ -DCMAKE_BUILD_TYPE=Release \ $cuda \ + $embree \ make make install DESTDIR=$PKG diff --git a/graphics/Blender/Blender.info b/graphics/Blender/Blender.info index a00c8f5457..26038a5885 100644 --- a/graphics/Blender/Blender.info +++ b/graphics/Blender/Blender.info @@ -5,6 +5,6 @@ DOWNLOAD="https://download.blender.org/source/blender-2.83.8.tar.xz" MD5SUM="1a920506a3a695d629d5f312b9b45c01" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="ffmpeg jack opencollada opus python-requests valgrind numpy3 SDL2 openimageio freealut tbb" +REQUIRES="ffmpeg jack opencollada opus python-requests valgrind numpy3 SDL2 openimageio freealut tbb embree" MAINTAINER="Christoph Willing" EMAIL="chris.willing@linux.com" diff --git a/graphics/Blender/README b/graphics/Blender/README index dfaa1243f0..aa1613683c 100644 --- a/graphics/Blender/README +++ b/graphics/Blender/README @@ -18,6 +18,9 @@ successful build. The CUDA handling above remains for cases which may: - require the existing cudatoolkit for other purposes (so need CUDA=no for Blender) +Support for embree may be disabled by passing EMBREE=no when building e.g. + EMBREE=no sh ./Blender.SlackBuild + Version 2.83.8 is the last SBo supported version of Blender for building from source code in Slackware64-14.2. A more recent compiler (gcc-9.3.1) is required for 2.90.x and later blender versions. -- cgit v1.2.3