feat(tools): add -j/--jobs option to idf.py

Add a global -j/--jobs option to idf.py that sets the number of parallel
build jobs passed to the underlying build tool. Previously parallelism was
only configurable via the IDF_PY_BUILD_JOBS environment variable, and only
for the Ninja generator.

The option applies to both Ninja and Make and defaults to IDF_PY_BUILD_JOBS
when not given, so the environment variable keeps working as before.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nebojša Cvetković
2026-07-22 16:02:52 +01:00
co-authored by Claude Opus 4.8
parent 055ba9d3f9
commit db6b310447
6 changed files with 31 additions and 15 deletions
+7 -1
View File
@@ -77,7 +77,13 @@ In the above list, the ``cmake`` command configures the project and generates bu
It's not necessary to run ``cmake`` more than once. After the first build, you only need to run ``ninja`` each time. ``ninja`` will automatically re-invoke ``cmake`` if the project needs reconfiguration.
When using ``idf.py`` with the Ninja generator, you can cap the number of parallel build jobs by setting the ``IDF_PY_BUILD_JOBS`` environment variable. For example:
You can control the number of parallel build jobs passed to the underlying build tool (Ninja or Make) with the ``-j``/``--jobs`` option of ``idf.py``. For example:
.. code-block:: bash
idf.py -j 6 build
The same value can be set with the ``IDF_PY_BUILD_JOBS`` environment variable, which is used as the default when ``-j``/``--jobs`` is not given:
.. code-block:: bash
+7 -1
View File
@@ -77,7 +77,13 @@ idf.py
没有必要多次运行 ``cmake``。第一次构建后,往后每次只需运行 ``ninja`` 即可。如果项目需要重新配置,``ninja`` 会自动重新调用 ``cmake``。
使用 Ninja 生成器配合 ``idf.py`` 时,可以通过设置环境变量 ``IDF_PY_BUILD_JOBS`` 来限制并行构建任务数。例如:
使用 ``idf.py`` 时,可以通过 ``-j``/``--jobs`` 选项来控制传递给底层构建工具(Ninja 或 Make)的并行构建任务数。例如:
.. code-block:: bash
idf.py -j 6 build
也可以通过设置环境变量 ``IDF_PY_BUILD_JOBS`` 来指定该值,当未提供 ``-j``/``--jobs`` 时,该环境变量将作为默认值使用:
.. code-block:: bash