Skip to content

fix(cmake): GPU spectrum unbuildable without Qt6GuiPrivate (Windows/aqt → CPU fallback) + duplicate qt_add_shaders crashes configure #3560

Description

@svabi79

Summary

The QRhi GPU spectrum/waterfall path (AETHER_GPU_SPECTRUM, default ON) cannot be built on any Qt install that lacks the Qt6GuiPrivate CMake package — which includes standard Windows/macOS deployments installed via aqtinstall. Two distinct defects in CMakeLists.txt combine so that affected users either (a) silently fall back to CPU QPainter software rasterization, or (b) hit a hard configure-time failure if the GPU path is forced on. CI never catches this because CI runs Qt 6.4 (Ubuntu 24.04), where the feature auto-disables before either defect is reached.

Impact

  • Windows / macOS users with aqt-style Qt installs get CPU software rendering, even on high-end GPUs. The ultra-wideband spectrum is rasterized single-threaded on the CPU; horizontal frequency scrolling in fullscreen stutters badly (observed on i9-13900K + RTX 4090 — the GPU sits idle). The Help → About "Renderer" line reads CPU QPainter.
  • A latent configure-crash hides in the GPU-enabled path. Any environment where AETHER_GPU_SPECTRUM actually turns ON (Qt ≥ 6.7 with private headers reachable) fails at cmake configure, before compilation — see defect 2.

Mechanics

Defect 1 — detection only handles Debian; Windows/macOS aqt installs fall through

CMakeLists.txt (the if(NOT Qt6GuiPrivate_FOUND) block) probes only Debian multi-arch paths (/usr/include/<multiarch>/qt6). On a Qt install where the Qt6GuiPrivate CMake config is absent but the private headers ARE present on disk (e.g. D:/Qt6/6.8.3/msvc2022_64/include/QtGui/6.8.3/QtGui/private/), the probe finds nothing, so AETHER_GPU_SPECTRUM is set OFF and the build quietly uses CPU QPainter. This is the same class of bug as #3157 (hardcoded x86_64), one layer out: the probe assumes a Debian filesystem layout.

Defect 2 — duplicate qt_add_shaders(AetherSDR "aether_shaders" ...)

There are two identical top-level if(AETHER_GPU_SPECTRUM) blocks, each calling qt_add_shaders(AetherSDR "aether_shaders" ...) (origin/main lines ~1173 and ~1571). qt_add_shaders creates a target named after its second argument; calling it twice with the same name is a hard CMake error ("another target with the same name already exists"). Both blocks run whenever the GPU path is genuinely enabled, so configure fails before a single object compiles. The second block's macOS fallback also has an off-by-one include path ("${_pd}/.." instead of "${_pd}"), so #include <rhi/qrhi.h> would not resolve even if it were reached.

Why CI is green

AETHER_GPU_SPECTRUM auto-disables on Qt < 6.7 (Qt6_VERSION VERSION_LESS "6.7"). CI's Docker image ships Qt 6.4, so both defects sit in a code path CI never enters. The feature is documented as "defaults ON, works on Linux," but in practice only builds with CPU rendering on the tested config.

Reproduction

  1. Install Qt 6.8.x for msvc2022_64 (or any Qt ≥ 6.7 without the Qt6GuiPrivate CMake package — confirm with ls <qt>/lib/cmake/ | grep GuiPrivate → empty).
  2. Configure on Windows. Observe -- GPU spectrum rendering disabled — Qt6GuiPrivate not found, despite the private headers existing under <qt>/include/QtGui/<ver>/QtGui/private/.
  3. Build, run, open Help → About → Renderer shows CPU QPainter.
  4. (Defect 2) Force the GPU path by making the Debian probe succeed / providing Qt6::GuiPrivatecmake aborts at the second qt_add_shaders with a duplicate-target error.

Proposed solution

  1. Generalize the private-header detection so it also derives the Qt include root from the Qt6::Gui target's INTERFACE_INCLUDE_DIRECTORIES and probes <root>/QtGui/<ver>/QtGui/private/. This covers Windows/macOS SDK layouts in addition to the existing Debian paths, reusing the existing DEBIAN_GPU_FIX_REQUIREDtarget_include_directories plumbing.
  2. Remove the duplicate GPU block, folding its (corrected) macOS rhi-header fallback into the first block, so qt_add_shaders is invoked exactly once.

PR to follow.

Environment

  • Windows 11, Qt 6.8.3 (msvc2022_64), VS 2022 Build Tools, RTX 4090
  • Confirmed: <qt>/lib/cmake/ has no Qt6GuiPrivate / Qt6CorePrivate / Qt6WidgetsPrivate; private headers present; qsb.exe and Qt6ShaderTools present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions