graphics/OpenSubdiv: Option for CUDA support

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 2023-06-01 17:19:58 +10:00 committed by Willy Sudiarto Raharjo
parent 8320f13649
commit 6287500841
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
3 changed files with 34 additions and 3 deletions

View File

@ -0,0 +1,18 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -590,8 +590,14 @@ if(CUDA_FOUND)
if (NOT DEFINED OSD_CUDA_NVCC_FLAGS)
if (CUDA_VERSION_MAJOR LESS 6)
set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_11 )
- else()
+ elseif (CUDA_VERSION_MAJOR LESS 9)
set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_20 )
+ elseif (CUDA_VERSION_MAJOR LESS 11)
+ set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_30 )
+ elseif (CUDA_VERSION_MAJOR LESS 12)
+ set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_35 )
+ else()
+ set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_50 )
endif()
endif()
endif()

View File

@ -3,7 +3,7 @@
# Slackware build script for Opensubdiv
# Copyright 2019 J. "MUFTI" Scheurich Stuttgart/Germany
# Copyright 2021-3 Christoph Willing Brisbane/Australia
# Copyright 2021-2023 Christoph Willing Brisbane/Australia
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -32,7 +32,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=OpenSubdiv
VERSION=${VERSION:-3.5.0}
SRCVER=$(echo $VERSION | tr . _)
BUILD=${BUILD:-2}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -75,6 +75,8 @@ rm -rf $PRGNAM-$SRCVER
tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
cd $PRGNAM-$SRCVER
sed -i -e '/${OPENGL_gl_LIBRARY}/a${OPENGL_glx_LIBRARY}' CMakeLists.txt
patch -p1 < $CWD/CUDA-compatibility.patch
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
@ -82,6 +84,9 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
cuda="-DNO_CUDA=ON";
[ "${ENABLE_CUDA:-no}" = "yes" ] && cuda=""
mkdir -p build
cd build
cmake \
@ -90,6 +95,8 @@ cd build
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_LIBDIR_BASE=lib${LIBDIRSUFFIX} \
-DCMAKE_DOCDIR_BASE=doc/$PRGNAM-$VERSION \
-DNO_CLEW=ON \
$cuda \
-DCMAKE_BUILD_TYPE=Release ..
make

View File

@ -6,5 +6,11 @@ framerates.
Additional utility is available in OpenSubdiv when the following SBo
packages are installed and detected at build time:
tbb cudatoolkit glfw3
tbb glfw3 ptex
Some graphics cards are not supported with the existing version of
the cudatoolkit at SBo. Therefore CUDA backend support is not enabled
by default in this SlackBuild. It must be explicitly enabled (as well
as cudatoolkit being installed) to use it in the build e.g.
ENABLE_CUDA=yes bash OpenSubdiv.SlackBuild