public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Joonas Niilola" <juippis@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/opensubdiv/files/, media-libs/opensubdiv/
Date: Mon, 22 Nov 2021 14:11:12 +0000 (UTC)	[thread overview]
Message-ID: <1637590219.fc0a2d9cd04c458e48543abea41bba7882913e93.juippis@gentoo> (raw)

commit:     fc0a2d9cd04c458e48543abea41bba7882913e93
Author:     Alexander Golubev <fatzer2 <AT> gmail <DOT> com>
AuthorDate: Sat Nov  6 23:14:33 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Mon Nov 22 14:10:19 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc0a2d9c

media-libs/opensubdiv: use cuda eclass

* Utilize cuda eclass and let it handle gcc selection instead of forcing
  an outdated version.
* Add a fix to provide sane defaults when compiling against a recent
  enough CUDA versions.
* Add an option to pass user-specified NVCCFLAGS and prevent cmake from
  overriding them.

Closes: https://bugs.gentoo.org/744517
Closes: https://bugs.gentoo.org/751382
Signed-off-by: Alexander Golubev <fatzer2 <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/22852
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 ...opensubdiv-3.4.4-add-CUDA11-compatibility.patch | 19 +++++
 media-libs/opensubdiv/opensubdiv-3.4.4-r2.ebuild   | 93 ++++++++++++++++++++++
 2 files changed, 112 insertions(+)

diff --git a/media-libs/opensubdiv/files/opensubdiv-3.4.4-add-CUDA11-compatibility.patch b/media-libs/opensubdiv/files/opensubdiv-3.4.4-add-CUDA11-compatibility.patch
new file mode 100644
index 000000000000..8f5bfab43a92
--- /dev/null
+++ b/media-libs/opensubdiv/files/opensubdiv-3.4.4-add-CUDA11-compatibility.patch
@@ -0,0 +1,19 @@
+From: "Alexander Golubev" <fatzer2@gmail.com>
+
+Set correct default minimal -arch for CUDA 9 and 11
+--- OpenSubdiv-3_4_4/CMakeLists.txt     2021-11-07 02:01:07.899484952 +0300
++++ OpenSubdiv-3_4_4/CMakeLists.txt.new 2021-11-07 02:01:23.402764409 +0300
+@@ -587,8 +587,12 @@
+         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 )
++            else()
++                set( OSD_CUDA_NVCC_FLAGS --gpu-architecture compute_35 )
+             endif()
+         endif()
+     endif()

diff --git a/media-libs/opensubdiv/opensubdiv-3.4.4-r2.ebuild b/media-libs/opensubdiv/opensubdiv-3.4.4-r2.ebuild
new file mode 100644
index 000000000000..e175e9f49681
--- /dev/null
+++ b/media-libs/opensubdiv/opensubdiv-3.4.4-r2.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CMAKE_MAKEFILE_GENERATOR=emake
+
+inherit cmake cuda toolchain-funcs
+
+MY_PV="$(ver_rs "1-3" '_')"
+DESCRIPTION="An Open-Source subdivision surface library"
+HOMEPAGE="https://graphics.pixar.com/opensubdiv/docs/intro.html"
+SRC_URI="https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/OpenSubdiv-${MY_PV}"
+
+# Modfied Apache-2.0 license, where section 6 has been replaced.
+# See for example CMakeLists.txt for details.
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="cuda examples opencl openmp ptex tbb test tutorials"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	media-libs/glew:=
+	media-libs/glfw:=
+	x11-libs/libXinerama
+	cuda? ( dev-util/nvidia-cuda-toolkit:* )
+	opencl? ( virtual/opencl )
+	ptex? ( media-libs/ptex )
+"
+DEPEND="
+	${RDEPEND}
+	tbb? ( <dev-cpp/tbb-2021.4.0:= )
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.3.0-use-gnuinstalldirs.patch"
+	"${FILESDIR}/${PN}-3.4.3-install-tutorials-into-bin.patch"
+	"${FILESDIR}/${P}-add-CUDA11-compatibility.patch"
+)
+
+pkg_pretend() {
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+src_prepare() {
+	cmake_src_prepare
+
+	use cuda && cuda_src_prepare
+}
+
+src_configure() {
+	# GLTESTS are disabled as portage is unable to open a display during test phase
+	# TODO: virtx work?
+	local mycmakeargs=(
+		-DGLEW_LOCATION="${ESYSROOT}/usr/$(get_libdir)"
+		-DGLFW_LOCATION="${ESYSROOT}/usr/$(get_libdir)"
+		-DNO_CLEW=ON
+		-DNO_CUDA=$(usex !cuda)
+		# Docs needed Python 2 so disabled
+		# bug #815172
+		-DNO_DOC=ON
+		-DNO_EXAMPLES=$(usex !examples)
+		-DNO_GLTESTS=ON
+		-DNO_OMP=$(usex !openmp)
+		-DNO_OPENCL=$(usex !opencl)
+		-DNO_PTEX=$(usex !ptex)
+		-DNO_REGRESSION=$(usex !test)
+		-DNO_TBB=$(usex !tbb)
+		-DNO_TESTS=$(usex !test)
+		-DNO_TUTORIALS=$(usex !tutorials)
+	)
+
+	if use cuda; then
+		# old cmake CUDA module doesn't use environment variable to initialize flags
+		mycmakeargs+=( -DCUDA_NVCC_FLAGS="${NVCCFLAGS}" )
+
+		# check if user provided --gpu-architecture/-arch flag and prevent cmake from overriding it if so
+		for f in ${NVCCFLAGS}; do
+			if [[ ${f} == -arch* || ${f} == --gpu-architecture* ]]; then
+				mycmakeargs+=( -DOSD_CUDA_NVCC_FLAGS="" )
+				break
+			fi
+		done
+	fi
+
+	cmake_src_configure
+}


             reply	other threads:[~2021-11-22 14:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 14:11 Joonas Niilola [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-14  9:29 [gentoo-commits] repo/gentoo:master commit in: media-libs/opensubdiv/files/, media-libs/opensubdiv/ Joonas Niilola
2023-04-07 12:50 Miroslav Šulc
2022-03-20 17:01 David Seifert
2017-09-23  8:38 David Seifert
2016-10-22 23:26 David Seifert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1637590219.fc0a2d9cd04c458e48543abea41bba7882913e93.juippis@gentoo \
    --to=juippis@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox