build(Linux): Cleanup CUDA compiler options for modern versions (#4162)

This commit is contained in:
Ehren Bendler
2025-08-19 10:05:25 -04:00
committed by GitHub
parent 9829d68a0c
commit 26e5f2f610
5 changed files with 30 additions and 39 deletions

View File

@ -110,7 +110,11 @@ LizardByte has the full documentation hosted on [Read the Docs](https://docs.liz
</td>
</tr>
<tr>
<td>Nvidia: GeForce GTX 1080 or higher</td>
<td>
Nvidia:<br>
&nbsp;&nbsp;Linux: GeForce RTX 2000 series or higher<br>
&nbsp;&nbsp;Windows: Geforce GTX 1080 or higher
</td>
</tr>
<tr>
<td rowspan="2">CPU</td>

View File

@ -21,45 +21,32 @@ if(${SUNSHINE_ENABLE_CUDA})
message(STATUS "CUDA Compiler Version: ${CMAKE_CUDA_COMPILER_VERSION}")
set(CMAKE_CUDA_ARCHITECTURES "")
# https://tech.amikelive.com/node-930/cuda-compatibility-of-nvidia-display-gpu-drivers/
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 6.5)
list(APPEND CMAKE_CUDA_ARCHITECTURES 10)
elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 6.5)
list(APPEND CMAKE_CUDA_ARCHITECTURES 50 52)
# https://docs.nvidia.com/cuda/archive/12.0.0/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 75 80 86 87 89 90)
else()
message(FATAL_ERROR
"Sunshine requires a minimum CUDA Compiler version of 12.0.
Found version: ${CMAKE_CUDA_COMPILER_VERSION}"
)
endif()
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 7.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 11)
elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER 7.6)
list(APPEND CMAKE_CUDA_ARCHITECTURES 60 61 62)
# https://docs.nvidia.com/cuda/archive/12.8.0/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8)
list(APPEND CMAKE_CUDA_ARCHITECTURES 100 101 120)
endif()
# https://docs.nvidia.com/cuda/archive/9.2/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 9.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 20)
elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 70)
# https://docs.nvidia.com/cuda/archive/12.9.0/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.9)
list(APPEND CMAKE_CUDA_ARCHITECTURES 103 121)
endif()
# https://docs.nvidia.com/cuda/archive/10.0/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 72 75)
endif()
# https://docs.nvidia.com/cuda/archive/11.0/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 30)
elseif(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 80)
endif()
# https://docs.nvidia.com/cuda/archive/11.8.0/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.8)
list(APPEND CMAKE_CUDA_ARCHITECTURES 86 87 89 90)
endif()
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 12.0)
list(APPEND CMAKE_CUDA_ARCHITECTURES 35)
# https://docs.nvidia.com/cuda/archive/13.0.0/cuda-compiler-driver-nvcc/index.html
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES 101)
list(APPEND CMAKE_CUDA_ARCHITECTURES 110)
else()
list(APPEND CMAKE_CUDA_ARCHITECTURES 50 52 53 60 61 62 70 72)
endif()
# sort the architectures

View File

@ -45,7 +45,7 @@ need to install CUDA.}
<tr>
<td rowspan="8">12.9.1</td>
<td rowspan="8">575.57.08</td>
<td rowspan="8">50;52;60;61;62;70;72;75;80;86;87;89;90</td>
<td rowspan="8">50;52;60;61;62;70;72;75;80;86;87;89;90;100;101;103;120;121</td>
<td>sunshine.AppImage</td>
</tr>
<tr>

View File

@ -202,7 +202,7 @@ namespace cuda {
return sws.load_ram(img, tex.array) || sws.convert(frame->data[0], frame->data[1], frame->linesize[0], frame->linesize[1], tex_obj(tex), stream.get());
}
int set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) {
int set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) override {
if (cuda_t::set_frame(frame, hw_frames_ctx)) {
return -1;
}
@ -929,7 +929,7 @@ namespace cuda {
return platf::capture_e::ok;
}
std::unique_ptr<platf::avcodec_encode_device_t> make_avcodec_encode_device(platf::pix_fmt_e pix_fmt) {
std::unique_ptr<platf::avcodec_encode_device_t> make_avcodec_encode_device(platf::pix_fmt_e pix_fmt) override {
return ::cuda::make_avcodec_encode_device(width, height, true);
}

View File

@ -16,8 +16,8 @@
#include "src/video_colorspace.h"
namespace platf {
class avcodec_encode_device_t;
class img_t;
struct avcodec_encode_device_t;
struct img_t;
} // namespace platf
namespace cuda {