瀏覽代碼

docs: clarify Windows CUDA build paths

master
Jan Svabenik 2 天之前
父節點
當前提交
9c66a91826
共有 3 個檔案被更改,包括 36 行新增1 行删除
  1. +1
    -0
      build-sdrplay.ps1
  2. +33
    -0
      build-windows-cuda-app.ps1
  3. +2
    -1
      docs/build-cuda.md

+ 1
- 0
build-sdrplay.ps1 查看文件

@@ -44,6 +44,7 @@ if (Test-Path $cudaMingw) {
Write-Host "Building with SDRplay + cuFFT support..." -ForegroundColor Cyan
Write-Host "WARNING: this path still performs final Go linking through MinGW GCC." -ForegroundColor Yellow
Write-Host "If CUDA kernel artifacts are MSVC-built, final link may fail due to mixed toolchains." -ForegroundColor Yellow
Write-Host "Use build-cuda-windows.ps1 for CUDA artifact prep; use this script for the current MinGW-oriented app build path." -ForegroundColor Yellow

$gccHost = Join-Path $gcc 'g++.exe'
if (!(Test-Path $gccHost)) {


+ 33
- 0
build-windows-cuda-app.ps1 查看文件

@@ -0,0 +1,33 @@
$ErrorActionPreference = 'Stop'

$msvcClDir = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64'
$vcvars = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat'
$cudaBin = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2\bin'
$cudaInc = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2\include'
$sdrplayInc = 'C:\PROGRA~1\SDRplay\API\inc'
$sdrplayLib = 'C:\PROGRA~1\SDRplay\API\x64'
$cudaMingw = Join-Path $PSScriptRoot 'cuda-mingw'

if (!(Test-Path (Join-Path $msvcClDir 'cl.exe'))) { throw "cl.exe not found at $msvcClDir" }
if (!(Test-Path $vcvars)) { throw "vcvars64.bat not found at $vcvars" }
if (!(Test-Path (Join-Path $cudaBin 'nvcc.exe'))) { throw "nvcc.exe not found at $cudaBin" }

$env:PATH = "$msvcClDir;$cudaBin;" + $env:PATH
$env:CGO_ENABLED = '1'
$env:CC = 'cl.exe'
$env:CXX = 'cl.exe'
$env:CGO_CFLAGS = "-I$cudaInc -I$sdrplayInc"
$env:CGO_LDFLAGS = "-L$sdrplayLib -lsdrplay_api -L$cudaMingw"

Write-Host "Preparing CUDA kernel artifacts..." -ForegroundColor Cyan
powershell -ExecutionPolicy Bypass -File tools\build-gpudemod-kernel.ps1
if ($LASTEXITCODE -ne 0) { throw "kernel build failed" }

Write-Host "Building Windows CUDA app with MSVC-oriented CGO path..." -ForegroundColor Cyan
Write-Host "NOTE: This path is experimental. Go's CGO runtime still emits GCC-style warning flags that MSVC rejects in this environment." -ForegroundColor Yellow
& cmd.exe /c "call `"$vcvars`" && go build -x -tags `"sdrplay,cufft`" ./cmd/sdrd"
if ($LASTEXITCODE -ne 0) {
throw "windows cuda app build failed (current blocker: Go CGO emits GCC-style flags that cl.exe rejects, e.g. -Werror / -Wall / -fno-stack-protector)"
}

Write-Host "Done." -ForegroundColor Green

+ 2
- 1
docs/build-cuda.md 查看文件

@@ -43,4 +43,5 @@ Prefer a GCC/NVCC-oriented build path:
- `go test ./...` passes
- `go test -tags cufft ./internal/demod/gpudemod` passes with NVCC/MSVC setup
- `build-sdrplay.ps1` has progressed past the original invalid `#cgo LDFLAGS` issue
- Remaining Windows blocker is now a toolchain mismatch between MSVC-built CUDA artifacts and MinGW final linking
- Remaining Windows blocker in the default path is a toolchain mismatch between MSVC-built CUDA artifacts and MinGW final linking
- Experimental full-MSVC CGO path (`build-windows-cuda-app.ps1`) also currently blocks because Go's CGO runtime emits GCC-style flags (`-Wall`, `-Werror`, `-fno-stack-protector`) that `cl.exe` rejects in this environment

Loading…
取消
儲存