Skip to content

The examples a target compiles - #103

Merged
theAndreas merged 2 commits into
mainfrom
examples-per-target
Nov 16, 2026
Merged

theAndreas merged 2 commits into
mainfrom
examples-per-target

Conversation

@theAndreas

Copy link
Copy Markdown
Owner

A project of several targets can now have an example for one board alone. Until now every example was compiled for every target, and read by clang-tidy with every target's flags, so an example that needs, say, a timer only the Mega has would break the build for the Uno.

A target now names the examples it compiles, in EXAMPLES of tools/project.sh; without it, it compiles all of them, as before. Building the examples, the table of sizes and clang-tidy follow that list. A misspelt name in it fails, and so does an example that no target compiles, so that nothing goes unchecked without a word.

For a project: nothing changes unless it sets EXAMPLES. AtmegaTimer will use it for an example of the Mega's Timer3 to Timer5.

How it was checked: tests/check.sh --targets now gives the project an example that stops the compiler on any board but the Mega, which the Uno leaves out. It failed before the change, at the Uno compiling that example, and passes now: lint, tidy, cppcheck, headers, examples and self-check. A misspelt name and an example no target compiles were checked by hand, and each fails with its message.

An example of one board alone, as one of a timer only the Mega has,
stops the compiler for any other board, so a project of several targets
could have none: make examples compiled every example for every target,
and make tidy read every one with each target's flags. EXAMPLES in
target_settings() names the examples a target compiles, all of them if
not set; make examples, the table of sizes and clang-tidy take those
alone. A name that is no folder of examples/ fails, and so does an
example no target compiles.

tests/check.sh --targets gives the project an example for the Mega
alone, which the Uno leaves out.
@theAndreas
theAndreas merged commit aa0b453 into main Nov 16, 2026
1 check passed
@theAndreas
theAndreas deleted the examples-per-target branch November 16, 2026 12:30
@theAndreas theAndreas mentioned this pull request Nov 16, 2026
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