feat: add compile_options support to idf.py build-file

Allow specifying extra compiler flags (warning flags, preprocessor
definitions, etc.) via a new 'compile_options' entry in the
idf-build-file frontmatter. The options are applied to the source
file via target_compile_options in the generated main component
CMakeLists, with CMake quoting so that flags like -DMSG="hello world"
reach the compiler exactly as written.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Ivan Grokhotkov (bot)
2026-07-21 22:04:41 +02:00
committed by Ivan Grokhotkov
co-authored by Claude Fable 5
parent 16275df0a1
commit b3a0e166fe
4 changed files with 143 additions and 1 deletions
@@ -67,6 +67,17 @@
- CONFIG_IDF_TARGET=esp32s3
- CONFIG_SPIRAM=y
``compile_options``
^^^^^^^^^^^^^^^^^^^
编译源文件时使用的额外编译器选项列表,例如警告标志或预处理器定义。
.. code-block:: yaml
compile_options:
- -Wconversion
- -DBUFFER_SIZE=1024
``dependencies``
^^^^^^^^^^^^^^^^