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

42 行
1.6KB

  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. if (-not (Test-Path (Join-Path $gcc 'g++.exe'))) {
  7. throw "g++ not found at $gcc"
  8. }
  9. $env:PATH = "$gcc;" + $env:PATH
  10. $env:CGO_ENABLED = '1'
  11. $env:CC = 'gcc'
  12. $env:CXX = 'g++'
  13. # SDRplay
  14. $env:CGO_CFLAGS = '-IC:\PROGRA~1\SDRplay\API\inc'
  15. $env:CGO_LDFLAGS = '-LC:\PROGRA~1\SDRplay\API\x64 -lsdrplay_api'
  16. # CUDA runtime / cuFFT
  17. $cudaInc = 'C:\CUDA\include'
  18. $cudaBin = 'C:\CUDA\bin'
  19. if (-not (Test-Path $cudaInc)) { $cudaInc = 'C:\PROGRA~1\NVIDIA~2\CUDA\v13.2\include' }
  20. if (-not (Test-Path $cudaBin)) { $cudaBin = 'C:\PROGRA~1\NVIDIA~2\CUDA\v13.2\bin' }
  21. $cudaMingw = Join-Path $PSScriptRoot 'cuda-mingw'
  22. if (Test-Path $cudaInc) { $env:CGO_CFLAGS = "$env:CGO_CFLAGS -I$cudaInc" }
  23. if (Test-Path $cudaBin) { $env:PATH = "$cudaBin;" + $env:PATH }
  24. if (Test-Path $cudaMingw) { $env:CGO_LDFLAGS = "$env:CGO_LDFLAGS -L$cudaMingw -lcudart64_13 -lcufft64_12 -lkernel32" }
  25. Write-Host 'Building SDRplay + cuFFT app (Windows DLL path)...' -ForegroundColor Cyan
  26. go build -tags "sdrplay,cufft" ./cmd/sdrd
  27. if ($LASTEXITCODE -ne 0) { throw 'build failed' }
  28. $dllSrc = Join-Path $PSScriptRoot 'internal\demod\gpudemod\build\gpudemod_kernels.dll'
  29. $dllDst = Join-Path $PSScriptRoot 'gpudemod_kernels.dll'
  30. if (Test-Path $dllSrc) {
  31. Copy-Item $dllSrc $dllDst -Force
  32. Write-Host "Copied DLL to $dllDst" -ForegroundColor Green
  33. } else {
  34. Write-Host 'WARNING: gpudemod_kernels.dll not found; build succeeded but runtime GPU demod will not load.' -ForegroundColor Yellow
  35. }
  36. Write-Host 'Done.' -ForegroundColor Green