mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-24 06:48:18 -07:00
Bug: https://bugs.gentoo.org/933213 Closes: https://bugs.gentoo.org/881179 Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com> Part-of: https://github.com/gentoo/gentoo/pull/41967 Signed-off-by: Sam James <sam@gentoo.org>
129 lines
2.8 KiB
Bash
129 lines
2.8 KiB
Bash
# Copyright 1999-2025 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=8
|
|
|
|
inherit cmake cuda flag-o-matic toolchain-funcs
|
|
MY_PV=$(ver_cut 1-2)
|
|
|
|
DESCRIPTION="NVIDIA Ray Tracing Engine"
|
|
HOMEPAGE="https://developer.nvidia.com/rtx/ray-tracing/optix"
|
|
SRC_URI="
|
|
!headers-only? (
|
|
amd64? (
|
|
https://developer.download.nvidia.com/designworks/optix/secure/${PV}/NVIDIA-OptiX-SDK-${PV}-linux64-x86_64.sh
|
|
)
|
|
arm64? (
|
|
https://developer.download.nvidia.com/designworks/optix/secure/${PV}/NVIDIA-OptiX-SDK-${PV}-linux64-aarch64.sh
|
|
)
|
|
)
|
|
headers-only? (
|
|
https://github.com/NVIDIA/optix-dev/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
|
|
)
|
|
"
|
|
S="${WORKDIR}"
|
|
|
|
LICENSE="NVIDIA-SDK"
|
|
SLOT="0/$(ver_cut 1)"
|
|
KEYWORDS="~amd64 ~arm64"
|
|
IUSE="+headers-only"
|
|
RESTRICT="bindist mirror !headers-only? ( fetch ) test"
|
|
|
|
RDEPEND=">=x11-drivers/nvidia-drivers-570"
|
|
|
|
pkg_nofetch() {
|
|
einfo "Please download ${A} from:"
|
|
einfo " ${HOMEPAGE}"
|
|
einfo "and move it to your distfiles directory."
|
|
}
|
|
|
|
src_unpack() {
|
|
if use headers-only; then
|
|
default
|
|
else
|
|
skip="$(grep -a ^tail "${DISTDIR}/${A}" | tail -n1 | cut -d' ' -f 3)"
|
|
tail -n "${skip}" "${DISTDIR}/${A}" | tar -zx -f -
|
|
assert "unpacking ${A} failed"
|
|
fi
|
|
}
|
|
|
|
src_prepare() {
|
|
if use headers-only; then
|
|
default
|
|
else
|
|
export CMAKE_USE_DIR="${WORKDIR}/SDK"
|
|
sed -e "s/CMAKE_CXX_STANDARD 11/CMAKE_CXX_STANDARD 17/" -i "SDK/CMakeLists.txt" || die
|
|
|
|
sed \
|
|
-e "s/SAMPLES_NVCC_FLAGS/CUDA_NVCC_FLAGS/g" \
|
|
-e "s/-arch sm_60/\${CUDA_NVCC_FLAGS}/g" \
|
|
-i SDK/optixNeuralTexture/CMakeLists.txt || die
|
|
|
|
cmake_src_prepare
|
|
fi
|
|
}
|
|
|
|
src_configure() {
|
|
use headers-only && return
|
|
|
|
filter-lto
|
|
|
|
# cmake-4 #951350
|
|
: "${CMAKE_POLICY_VERSION_MINIMUM:=3.10}"
|
|
export CMAKE_POLICY_VERSION_MINIMUM
|
|
|
|
# allow slotted install
|
|
: "${CUDA_PATH:=${ESYSROOT}/opt/cuda}"
|
|
export CUDA_PATH
|
|
|
|
local -x CUDAHOSTCXX="$(cuda_gccdir)"
|
|
local -x CUDAHOSTLD="$(tc-getCXX)"
|
|
local mycmakeargs=(
|
|
-DCUDA_HOST_COMPILER="$(cuda_gccdir)"
|
|
-DGLFW_INSTALL="no"
|
|
-DCUDA_CHECK_DEPENDENCIES_DURING_COMPILE="yes"
|
|
-DOPTIX_OPTIXIR_BUILD_CONFIGURATION="${CMAKE_BUILD_TYPE}"
|
|
)
|
|
|
|
if [[ -v CUDAARCHS ]]; then
|
|
local optix_CUDAARCHS="$(echo "${CUDAARCHS}" | tr ';' '\n' | sort | head -n1)"
|
|
|
|
mycmakeargs+=(
|
|
-DCUDA_MIN_SM_TARGET="sm_${optix_CUDAARCHS}"
|
|
-DCUDA_MIN_SM_COMPUTE_TARGET="compute_${optix_CUDAARCHS}"
|
|
)
|
|
fi
|
|
|
|
cmake_src_configure
|
|
}
|
|
|
|
src_compile() {
|
|
use headers-only && return
|
|
|
|
cmake_src_compile
|
|
}
|
|
|
|
src_test() {
|
|
use headers-only && return
|
|
|
|
cmake_src_test
|
|
}
|
|
|
|
src_install() {
|
|
insinto "/opt/${PN}"
|
|
|
|
if use headers-only; then
|
|
cd "${PN}-dev-${PV}" || die
|
|
doins -r include/
|
|
|
|
dodoc README.md
|
|
return
|
|
fi
|
|
|
|
# missing a install target so cmake_src_install fails
|
|
cmake_run_in "${BUILD_DIR}" cmake -P cmake_install.cmake
|
|
|
|
local DOCS=( "doc/OptiX_"{API_Reference,Programming_Guide}"_${PV}.pdf" )
|
|
einstalldocs
|
|
}
|