build(homebrew): fix build with cuda on linux (#5342)

This commit is contained in:
Dave Lane
2026-06-26 15:45:02 -04:00
committed by GitHub
parent e40d355f96
commit cc34eb1410
+3 -2
View File
@@ -231,7 +231,7 @@ class Sunshine < Formula
def add_cuda_args(args)
return unless OS.linux?
if build.with?(CUDA_FORMULA)
if build.with?("cuda")
configure_cuda(args)
else
args << "-DSUNSHINE_ENABLE_CUDA=OFF"
@@ -241,11 +241,12 @@ class Sunshine < Formula
def configure_cuda(args)
cuda_path = Formula["lizardbyte/homebrew/#{CUDA_FORMULA}"]
nvcc_path = "#{cuda_path.opt_bin}/nvcc"
nvcc_path = "#{cuda_path.opt_libexec}/homebrew/bin/nvcc"
gcc_path = Formula[GCC_FORMULA]
args << "-DSUNSHINE_ENABLE_CUDA=ON"
args << "-DCMAKE_CUDA_COMPILER:PATH=#{nvcc_path}"
args << "-DCMAKE_CUDA_TOOLKIT_ROOT_DIR:PATH=#{cuda_path.opt_libexec}"
args << "-DCMAKE_CUDA_HOST_COMPILER=#{gcc_path.opt_bin}/gcc-#{GCC_VERSION}"
ohai "CUDA enabled with nvcc at: #{nvcc_path}"
end