Skip to content

Add Windows/MinGW build support for RADE and Opus#550

Merged
ten9876 merged 1 commit into
aethersdr:mainfrom
boydsoftprez:fix/windows-mingw-build
Apr 2, 2026
Merged

Add Windows/MinGW build support for RADE and Opus#550
ten9876 merged 1 commit into
aethersdr:mainfrom
boydsoftprez:fix/windows-mingw-build

Conversation

@boydsoftprez

Copy link
Copy Markdown
Collaborator

Summary

The RADE/Opus integration assumed a POSIX build environment (autotools, <sys/types.h>, libm). This PR adds full Windows build support so AetherSDR can be compiled with MinGW or MSVC toolchains while retaining the existing Linux/macOS build path.

Changes

CMakeLists.txt

  • Use /w (MSVC) or -w (GCC/MinGW) for RADE source warning suppression — the previous hardcoded -w flag is not valid for MSVC
  • Add IS_BUILDING_RADE_API=1 to the main target's compile definitions (was only set on the RADE sources, causing missing symbol errors when the main target includes RADE headers)
  • Conditionally link libm only on non-Windows — MSVC provides math functions in the CRT; linking -lm on MSVC produces linker errors

third_party/radae/cmake/BuildOpus.cmake

  • Add a Windows-specific ExternalProject path that builds Opus via its native CMake build system instead of autotools. The autotools path (./configure && make) requires MSYS2/Cygwin on Windows and fails under MinGW-w64
  • Handles both MSVC (opus.lib) and MinGW (libopus.a) library naming conventions
  • Enables OPUS_DRED and OPUS_OSCE for the neural codec features used by RADE

third_party/radae/cmake/PatchOpusNnet.cmake (new file)

  • Pure-CMake replacement for the Unix patch command used by the autotools build to apply RADE_EXPORT attributes to Opus dnn/nnet.h
  • Downloads and extracts the Opus neural network model data (fargan_data.h, plc_data.h, lace_data.h etc.) with a fallback mirror URL — the autotools build does this via autogen.sh, which doesn't run under the CMake path
  • Works on all platforms without requiring patch(1)

third_party/radae/src/kiss_fft.h / rade_api.h

  • Replace #include <sys/types.h> with #include <stddef.h> on Windows — sys/types.h is a POSIX header not available in the MSVC standard library. stddef.h provides the needed size_t type portably.

Test Plan

  • Build on Windows with MinGW-w64 (GCC 14+) — verify RADE/Opus compiles and links
  • Build on Windows with MSVC (Visual Studio 2022) — verify /w flag and opus.lib naming
  • Build on Linux (existing CI) — verify no regression in autotools Opus path
  • Build on macOS — verify no regression in universal binary path
  • Run AetherSDR on Windows — verify RADE digital voice encode/decode works
  • Verify Opus neural network model data downloads and extracts correctly on first build

🤖 Generated with Claude Code

@ten9876

ten9876 commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the thorough Windows build support — this is well done. The CMake-based Opus build path, the PatchOpusNnet.cmake to replace patch(1), the model download fallback mirror, and the <stddef.h> portability fixes are all solid.

Merging.

73, Jeremy KK7GWY & Claude (AI dev partner)

@ten9876 ten9876 enabled auto-merge (squash) April 2, 2026 01:47
The RADE/Opus integration assumed a POSIX build environment (autotools,
sys/types.h, libm). This adds Windows support via three changes:

CMakeLists.txt:
- Use /w (MSVC) or -w (GCC/MinGW) for RADE source warning suppression
- Add IS_BUILDING_RADE_API=1 to main target compile definitions
- Conditionally link libm only on non-Windows (MSVC provides math
  functions in the CRT)

BuildOpus.cmake:
- Add Windows-specific ExternalProject path that builds Opus via its
  native CMake build system instead of autotools (which requires
  MSYS2/Cygwin on Windows)
- Handle both MSVC (opus.lib) and MinGW (libopus.a) library naming
- Enable OPUS_DRED and OPUS_OSCE for neural codec features

PatchOpusNnet.cmake (new):
- Pure-CMake replacement for the Unix `patch` command used by the
  autotools build to apply RADE_EXPORT attributes to Opus dnn/nnet.h
- Downloads and extracts Opus neural network model data (fargan, plc,
  lace weights) with fallback mirror URL
- Works on all platforms without requiring patch(1)

kiss_fft.h / rade_api.h:
- Replace <sys/types.h> with <stddef.h> on Windows (sys/types.h is a
  POSIX header not available in MSVC)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ten9876 ten9876 force-pushed the fix/windows-mingw-build branch from 1a7eae5 to 433de69 Compare April 2, 2026 01:48
@ten9876 ten9876 merged commit 2265522 into aethersdr:main Apr 2, 2026
2 checks passed
@boydsoftprez boydsoftprez deleted the fix/windows-mingw-build branch April 2, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants