build(liquid-dsp): MSVC enablement via clang-cl sub-build (closes #3049)#3073
build(liquid-dsp): MSVC enablement via clang-cl sub-build (closes #3049)#3073ten9876 wants to merge 2 commits into
Conversation
…uild (closes #3049) #3046 skipped liquid-dsp on Windows MSVC because cl.exe rejects C99 `_Complex` arithmetic that liquid-dsp's source code uses throughout (`liquid.h:473` error C2061 was just the first surface; the .c sources also use complex `+` / `*` operators that MSVC's C compiler doesn't support). This unblocks the Windows build path so future digital-mode consumers can use liquid-dsp on all three platforms. Approach: a separate ExternalProject_Add sub-build invokes CMake with `-DCMAKE_C_COMPILER=clang-cl.exe`. clang-cl is LLVM's MSVC-ABI- compatible frontend (ships with VS 2022's "C++ Clang Compiler for Windows" component) and supports `_Complex` natively while producing MSVC-compatible `.lib` output. The resulting `liquid.lib` links into the main AetherSDR/MSVC binary without ABI drama. Linux + macOS path unchanged — still `add_subdirectory` in-tree. Link line now uses `if(TARGET liquid-static)` instead of `$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:liquid-static>` so a Windows build without clang-cl (rare; only an unusually slim VS install) cleanly omits liquid-static rather than failing the link. Verified: - Linux x86_64 in-tree build still clean (this commit) - Windows clang-cl path needs CI to confirm (cannot test locally) If `clang-cl.exe` isn't on PATH the configure logs an informational "liquid-dsp: clang-cl not found" message and continues; the only consumer-visible effect is that `liquid-static` is absent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Windows CI on the previous commit failed at the ExternalProject configure
step:
CMake Error at C:/Program Files/CMake/share/cmake-3.31/Modules/Platform/
Windows-Clang.cmake:168 (message):
supported. Use either clang/clang++ or clang-cl as all C, C++, CUDA,
...
liquid-dsp's project() declares `LANGUAGES C CXX`, and CMake's
Windows-Clang platform module refuses to mix clang-cl for C with MSVC
cl.exe for C++ — both must use a clang variant. Setting only
CMAKE_C_COMPILER leaves the inner project's C++ language detection on
default cl.exe, which trips the consistency check.
Fix: also pass `-DCMAKE_CXX_COMPILER=${CLANG_CL_EXE}`. The C++ compiler
isn't actually invoked (BUILD_EXAMPLES / AUTOTESTS / BENCHMARKS / SANDBOX
all disabled, and liquid-dsp's library sources are pure C) but the
declared language is enough to trigger CMake's platform-module check.
Linux build still clean (this commit).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Closing — clang-cl was the wrong approach. The fundamental issue runs deeper than I originally claimed in the RFC discussion: clang-cl supports the C99 The right answer is mingw-w64-gcc in an ExternalProject — full C99 Filed updated plan in #3049 with the full lessons learned. Picking it back up there when we prioritize the Windows liquid-dsp enablement. 73, Jeremy KK7GWY & Claude (AI dev partner) |
Summary
Enables liquid-dsp on Windows MSVC by routing the liquid-dsp sub-build through clang-cl (LLVM's MSVC-ABI-compatible frontend, bundled with VS 2022's "C++ Clang Compiler for Windows" component). clang-cl supports C99 `_Complex` natively while producing MSVC-compatible `.lib` output, so the resulting `liquid.lib` links cleanly into the main AetherSDR/MSVC binary.
Closes #3049.
Why
#3046 vendored liquid-dsp Linux+macOS-only because cl.exe rejects C99 `_Complex` arithmetic used throughout liquid-dsp's source. Patching every internal `+` / `*` operator on complex values to MSVC's `_FCmulcc` / `_FCadd` intrinsics would be hundreds of edits diverged from upstream — high cost, high maintenance. Routing the sub-build through clang-cl is zero-edit-to-liquid-dsp and ABI-compatible with our MSVC AetherSDR build.
How
Verified locally
If clang-cl is missing
The configure logs `liquid-dsp: clang-cl not found on PATH; skipping` and continues. Only consumer-visible effect: `liquid-static` target is absent (matches today's MSVC behavior).
Test plan
73, Jeremy KK7GWY & Claude (AI dev partner)
🤖 Generated with Claude Code