classes: add cuda-gcc.bbclass

for redirecting the gcc toolchain used by nvcc (and,
if necessary, directly compiled CC/C++ code) for
compatibility with CUDA.  This class can be inherited
by recipes that need to compile CUDA-compatible code
but do not need the CUDA toolkit dependencies.

The class sets variables CC_FOR_CUDA and CXX_FOR_CUDA.
Recipes needing to use this version of the compiler
must set CC and/or CXX to point to these variables.

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2021-12-13 08:34:59 -08:00
committed by Matt Madison
parent a4291ab85e
commit f9881e05d4

8
classes/cuda-gcc.bbclass Normal file
View File

@@ -0,0 +1,8 @@
# CUDA requires gcc/g++ 8, so add that compiler and its runtime as
# dependencies, and set CC_FOR_CUDA and CXX_FOR_CUDA to point to that compiler.
DEPENDS:append:cuda = " virtual/${TARGET_PREFIX}cuda-gcc gcc-8-runtime"
CUDA_HOST_TOOLCHAIN_SUFFIX ??= ""
CUDA_HOST_TOOLCHAIN_SUFFIX:cuda = "-8.5.0"
CC_FOR_CUDA ?= "${CCACHE}${HOST_PREFIX}gcc${CUDA_HOST_TOOLCHAIN_SUFFIX} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
CXX_FOR_CUDA ?= "${CCACHE}${HOST_PREFIX}g++${CUDA_HOST_TOOLCHAIN_SUFFIX} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
PACKAGE_ARCH:cuda = "${TEGRA_PKGARCH}"