# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

DESCRIPTION="The oneAPI Level Zero Ray Tracing Support library is an open source project used by Intel(R) oneAPI Level Zero as the implementation of the RTAS extension ZE_extension_rtas"
HOMEPAGE="https://github.com/intel/level-zero-raytracing-support"
if [[ ${PV} = *9999* ]] ; then
    EGIT_REPO_URI="https://github.com/intel/level-zero-raytracing-support.git"
    inherit git-r3
else
    SRC_URI="https://github.com/intel/level-zero-raytracing-support/archive/refs/tags/v${PV}.tar.gz"
    S="${WORKDIR}/level-zero-raytracing-support-${PV}"

    KEYWORDS="~amd64 ~x86"
fi

LICENSE="Apache-2.0"
SLOT="0"
IUSE=""

RDEPEND="
    sys-libs/glibc
    dev-cpp/tbb
"

DEPEND="${RDEPEND}"

BDEPEND="
	sys-devel/gcc
	dev-build/ninja
"

src_prepare() {
	default
	cmake_src_prepare
	# Apply any necessary patches here
}

src_configure() {
   	CMAKE_BUILD_TYPE=Release

	local mycmakeargs=(
	    -G Ninja
		-D CMAKE_BUILD_TYPE=Release
		-DCMAKE_POLICY_VERSION_MINIMUM=3.5
	)
	cmake_src_configure
}

src_compile() {
	cmake_src_compile
}

src_install() {
	cmake_src_install
}

pkg_postinst() {
	elog "level-zero-gpu-raytracing has been installed."
}