| @@ -44,6 +44,7 @@ if (Test-Path $cudaMingw) { | |||||
| Write-Host "Building with SDRplay + cuFFT support..." -ForegroundColor Cyan | 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 "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 "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' | $gccHost = Join-Path $gcc 'g++.exe' | ||||
| if (!(Test-Path $gccHost)) { | if (!(Test-Path $gccHost)) { | ||||
| @@ -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 | |||||
| @@ -43,4 +43,5 @@ Prefer a GCC/NVCC-oriented build path: | |||||
| - `go test ./...` passes | - `go test ./...` passes | ||||
| - `go test -tags cufft ./internal/demod/gpudemod` passes with NVCC/MSVC setup | - `go test -tags cufft ./internal/demod/gpudemod` passes with NVCC/MSVC setup | ||||
| - `build-sdrplay.ps1` has progressed past the original invalid `#cgo LDFLAGS` issue | - `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 | |||||