graphics/Blender: Add support for embree

Signed-off-by: Christoph Willing <chris.willing@linux.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Christoph Willing 2021-02-13 20:55:54 +10:00 committed by Willy Sudiarto Raharjo
parent 86d17abb9f
commit 3a66f7c213
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
4 changed files with 93 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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.