Files
esp-idf/tools/idf_py_actions/constants.py
Nebojša Cvetković db6b310447 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>
2026-07-22 16:02:52 +01:00

56 lines
1.6 KiB
Python

# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import collections
import multiprocessing
import os
import platform
GENERATORS: dict[str, str | dict | list] = collections.OrderedDict(
[
# - command: build command line
# - version: version command line
# - dry_run: command to run in dry run mode
# - verbose_flag: verbose flag
# - force_progression: one liner status of the progress
(
'Ninja',
{
'command': ['ninja'],
'version': ['ninja', '--version'],
'dry_run': ['ninja', '-n'],
'verbose_flag': '-v',
# as opposed to printing the status updates each in a in new line
'force_progression': True,
},
),
]
)
if os.name != 'nt':
MAKE_CMD = 'gmake' if platform.system() == 'FreeBSD' else 'make'
GENERATORS['Unix Makefiles'] = {
# Make, unlike Ninja, does not parallelize by default; run_target() applies this as -j.
'default_jobs': multiprocessing.cpu_count() + 2,
'command': [MAKE_CMD],
'version': [MAKE_CMD, '--version'],
'dry_run': [MAKE_CMD, '-n'],
'verbose_flag': 'VERBOSE=1',
'force_progression': False,
}
URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf'
SUPPORTED_TARGETS = [
'esp32',
'esp32s2',
'esp32c3',
'esp32s3',
'esp32c2',
'esp32c6',
'esp32h2',
'esp32p4',
'esp32c5',
'esp32c61',
]
PREVIEW_TARGETS = ['linux', 'esp32h21', 'esp32h4', 'esp32s31']