build: libavr rides as the pinned submodule

The submodule replaces FetchContent and the unpinned forge fallback;
LIBAVR_ROOT stays as the tandem-development override, the presets take the
toolchain file from the submodule, and the Studio project's include path
anchors there — correct by construction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-28 00:29:38 +02:00
parent 2cdf56f8d6
commit 5afe29359c
6 changed files with 28 additions and 22 deletions

View File

@@ -12,10 +12,13 @@ log) is gone: the Beta equation and the cubic fan curve are evaluated
consteval into flash tables — the firmware itself never touches floating
point.
Build against a libavr checkout:
libavr rides as the `libavr/` submodule, pinned to the commit this firmware
builds against; `LIBAVR_ROOT` (cache or environment) overrides it for
development against a working tree:
```sh
LIBAVR_ROOT=/path/to/libavr cmake --preset atmega328p-generated
git submodule update --init libavr
cmake --preset atmega328p-generated
cmake --build --preset atmega328p-generated
```
@@ -25,15 +28,13 @@ cmake --build --preset atmega328p-generated
builds the same firmware — byte-identical `.text` and `.data` to the CMake
build — from the same sources, with the flags mirrored by hand.
Studio expects libavr checked out **beside this repo**, and finds it at
`$(MSBuildProjectDirectory)\..\..\libavr\include`anchored to the project
rather than written relative to the generated makefile, which runs from the
configuration's output directory and would need a different number of `..`.
Unlike the CMake build there is no `LIBAVR_ROOT` to point elsewhere: an
environment variable set in a shell is not visible to Studio launched from the
Start menu, which fails as a missing `libavr/libavr.hpp` rather than as anything
about the variable. Pinning libavr as a submodule is the better answer and is on
libavr's task list.
Studio finds libavr in the **submodule**, at
`$(MSBuildProjectDirectory)\..\libavr\include`correct by construction, and
anchored to the project rather than written relative to the generated makefile,
which runs from the configuration's output directory and would need a different
number of `..`. Unlike the CMake build there is no `LIBAVR_ROOT` to point
elsewhere: an environment variable set in a shell is not visible to Studio
launched from the Start menu which is what the submodule answers.
It also needs a GCC 16.1 toolchain registered as flavour `avr-g++-16.1.0`;
nothing older can compile `-std=c++26`.