Skip to content

fix(build): compile cleanly as a standalone ESP-IDF component - #2511

Merged
zackees merged 4 commits into
FastLED:masterfrom
swoboda1337:idf-component-build-fixes
May 30, 2026
Merged

zackees merged 4 commits into
FastLED:masterfrom
swoboda1337:idf-component-build-fixes

Conversation

@swoboda1337

@swoboda1337 swoboda1337 commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Three independent build-system bugs prevent FastLED from compiling when consumed
as a managed ESP-IDF component.

1. Unity-entry sources stripped from the fetched component

The IDF Component Manager filters the fetched git tree through a hardcoded
DEFAULT_EXCLUDE list in idf_component_tools/file_tools.py, which contains
**/build/**/*. That glob matches src/fl/build/ -- the directory holding
every unity-build entry .cpp file -- and silently drops it from the
distributed tree.

Fix: add a files.include rule to idf_component.yml. Manifest include
patterns run last in the filter pipeline and re-add paths after the defaults
strip them, so a single rule restores the unity entries without disabling any
other default filtering.

2. CMakeLists glob did not collect any sources

file(GLOB FastLED_SRCS "src/**/*.cpp") matched zero files because CMake's
file(GLOB) is not recursive and ** is not a wildcard. With 1. above
fixed, the unity entries are present on disk but the glob still found
nothing, so idf_component_register registered FastLED as CONFIG_ONLY and
IDF skipped compilation entirely -- producing undefined references for
every FastLED symbol at link time.

Fix: switch to file(GLOB_RECURSE ... "src/*.cpp").

3. Missing REQUIRES for I2S, MCPWM, and HTTP server components

FastLED's audio module includes <driver/i2s_std.h> (needs
esp_driver_i2s), the gpio_isr_rx driver includes <driver/mcpwm_cap.h>
(needs esp_driver_mcpwm), and the fl/stl/asio/http/server module
includes <esp_http_server.h> (needs esp_http_server). None of these
components were listed in REQUIRES, so when FastLED was compiled in the
IDF component scope their headers were out of scope and the unity TUs hit
fatal include errors.

Fix: add the three components to REQUIRES.

Summary by CodeRabbit

  • Chores
    • Updated build configuration and system dependencies to improve component integration and coverage.

Review Change Stack

The IDF Component Manager applies a hardcoded DEFAULT_EXCLUDE list to
the fetched git tree, which strips any directory called build/ via
the pattern '**/build/**/*'. This drops src/fl/build/, where every
unity-entry .cpp file lives.

Without those entries the fetched component has zero compilable
sources, FastLED's CMakeLists.txt GLOB returns nothing, and IDF
registers FastLED as a CONFIG_ONLY component -- producing undefined
references for every FastLED symbol at link time.

files.include patterns run last in the filter pipeline and re-add
paths after the default exclude removes them, so a single include
rule restores the unity entries without disabling any default
filtering.
file(GLOB) does not walk subdirectories and CMake does not treat `**`
as a recursive wildcard, so the previous src/**/*.cpp pattern matched
nothing. With no sources, idf_component_register registered FastLED
as a CONFIG_ONLY component -- IDF skipped compilation and every
FastLED symbol came out as an undefined reference at link time.

Switch to GLOB_RECURSE so the unity-entry .cpp files under
src/fl/build/ (and any future top-level src/ .cpp files) are picked
up reliably.
The audio module uses driver/i2s_std.h (esp_driver_i2s), the
gpio_isr_rx driver uses driver/mcpwm_cap.h (esp_driver_mcpwm), and
the asio/http server module uses esp_http_server.h. None of these
were in REQUIRES, so when FastLED is registered as a standalone ESP-IDF
managed component their headers were out of scope at compile time.
@coderabbitai

coderabbitai Bot commented May 27, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

FastLED's ESP-IDF component build configuration is updated to support additional hardware interfaces. The CMake build now recursively discovers source files and declares new framework dependencies. The component packaging configuration is updated to preserve generated build artifacts during distribution.

Changes

ESP-IDF Component Configuration

Layer / File(s) Summary
CMake source discovery and dependencies
CMakeLists.txt
Source file discovery switches to recursive glob from src/*.cpp. The idf_component_register call adds REQUIRES dependencies: esp_http_server, esp_lcd, esp_driver_i2s, esp_driver_mcpwm, esp_netif, and esp_wifi.
Component file packaging inclusion
idf_component.yml
A new top-level files.include section is added with ["src/fl/build/**/*"] to ensure build-time generated files are preserved during component packaging, overriding default **/build/**/* exclusions.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through CMake with glee,
Recursive globs and I2S to see,
Build artifacts bundled, safe and sound,
New drivers awakened—the fastest LED found!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The PR title 'fix(build): compile cleanly as a standalone ESP-IDF component' directly addresses the main objective of fixing the ESP-IDF Component Manager build. It accurately summarizes the primary change without being misleading or vague.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@swoboda1337 swoboda1337 changed the title Fix ESP-IDF Component Manager build of FastLED as a standalone managed component fix(build): compile cleanly as a standalone ESP-IDF managed component May 27, 2026
@swoboda1337 swoboda1337 changed the title fix(build): compile cleanly as a standalone ESP-IDF managed component fix(build): compile cleanly as a standalone ESP-IDF component May 27, 2026
@zackees
zackees merged commit 49f46c9 into FastLED:master May 30, 2026
1 check failed
@swoboda1337

Copy link
Copy Markdown
Contributor Author

Thanks!

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