Wideband autonomous SDR analysis engine forked from sdr-visual-suite
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

63 行
2.3KB

  1. $ErrorActionPreference = 'Stop'
  2. $gcc = 'C:\msys64\mingw64\bin'
  3. if (-not (Test-Path (Join-Path $gcc 'gcc.exe'))) {
  4. throw "gcc not found at $gcc"
  5. }
  6. $msvcCl = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64'
  7. if (-not (Test-Path (Join-Path $msvcCl 'cl.exe'))) {
  8. throw "cl.exe not found at $msvcCl"
  9. }
  10. $env:PATH = "$gcc;$msvcCl;" + $env:PATH
  11. $env:CGO_ENABLED = '1'
  12. # SDRplay
  13. $env:CGO_CFLAGS = '-IC:\PROGRA~1\SDRplay\API\inc'
  14. $env:CGO_LDFLAGS = '-LC:\PROGRA~1\SDRplay\API\x64 -lsdrplay_api'
  15. # CUDA (cuFFT)
  16. # Prefer C:\CUDA if present (no spaces)
  17. $cudaInc = 'C:\CUDA\include'
  18. $cudaLib = 'C:\CUDA\lib\x64'
  19. $cudaBin = 'C:\CUDA\bin'
  20. if (-not (Test-Path $cudaInc)) {
  21. $cudaInc = 'C:\PROGRA~1\NVIDIA GPU Computing Toolkit\CUDA\v13.2\include'
  22. $cudaLib = 'C:\PROGRA~1\NVIDIA GPU Computing Toolkit\CUDA\v13.2\lib\x64'
  23. $cudaBin = 'C:\PROGRA~1\NVIDIA GPU Computing Toolkit\CUDA\v13.2\bin'
  24. }
  25. if (Test-Path $cudaInc) {
  26. $env:CGO_CFLAGS = "$env:CGO_CFLAGS -I$cudaInc"
  27. }
  28. if (Test-Path $cudaBin) {
  29. $env:PATH = "$cudaBin;" + $env:PATH
  30. }
  31. $cudaMingw = Join-Path $PSScriptRoot 'cuda-mingw'
  32. if (Test-Path $cudaMingw) {
  33. # Use MinGW import libs to avoid MSVC .lib linking issues
  34. $env:CGO_LDFLAGS = "$env:CGO_LDFLAGS -L$cudaMingw"
  35. } elseif (Test-Path $cudaLib) {
  36. # Fallback to CUDA lib path (requires compatible toolchain)
  37. $env:CGO_LDFLAGS = "$env:CGO_LDFLAGS -L$cudaLib -lcufft -lcudart"
  38. }
  39. Write-Host "Building with SDRplay + cuFFT support..." -ForegroundColor Cyan
  40. Write-Host "WARNING: this path still performs final Go linking through MinGW GCC." -ForegroundColor Yellow
  41. Write-Host "If CUDA kernel artifacts are MSVC-built, final link may fail due to mixed toolchains." -ForegroundColor Yellow
  42. Write-Host "Use build-cuda-windows.ps1 for CUDA artifact prep; use this script for the current MinGW-oriented app build path." -ForegroundColor Yellow
  43. $gccHost = Join-Path $gcc 'g++.exe'
  44. if (!(Test-Path $gccHost)) {
  45. throw "g++.exe not found at $gccHost"
  46. }
  47. # Kernel build currently relies on nvcc + MSVC host compiler availability.
  48. powershell -ExecutionPolicy Bypass -File tools\build-gpudemod-kernel.ps1
  49. if ($LASTEXITCODE -ne 0) { throw "kernel build failed" }
  50. go build -tags "sdrplay,cufft" ./cmd/sdrd
  51. if ($LASTEXITCODE -ne 0) { throw "build failed" }
  52. Write-Host "Done." -ForegroundColor Green