diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-20 08:58:10 +0100 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2024-12-19 09:25:20 -0800 |
| commit | 8b9846d9a9d29b427860891c9b699eb4305e348b (patch) | |
| tree | 16e602e2e56fc175177eab9c56a0cbf97d5cda33 /mesonbuild/compilers | |
| parent | eb35d1a05f08f6969851cea81889e3beffdb9ec2 (diff) | |
| download | meson-8b9846d9a9d29b427860891c9b699eb4305e348b.tar.gz | |
mtest: move determine_worker_count to utils, generalize
It is useful to apply a limit to the number of processes even outside "meson test",
and specifically for clang tools. In preparation for this, generalize
determine_worker_count() to accept a variable MESON_NUM_PROCESSES instead of
MESON_TESTTHREADS, and use it throughout instead of multiprocessing.cpu_count().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers')
| -rw-r--r-- | mesonbuild/compilers/mixins/gnu.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 21a57b44f..976fa7871 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -8,7 +8,6 @@ from __future__ import annotations import abc import functools import os -import multiprocessing import pathlib import re import subprocess @@ -617,8 +616,9 @@ class GnuCompiler(GnuLikeCompiler): if threads == 0: if self._has_lto_auto_support: return ['-flto=auto'] - # This matches clang's behavior of using the number of cpus - return [f'-flto={multiprocessing.cpu_count()}'] + # This matches clang's behavior of using the number of cpus, but + # obeying meson's MESON_NUM_PROCESSES convention. + return [f'-flto={mesonlib.determine_worker_count()}'] elif threads > 0: return [f'-flto={threads}'] return super().get_lto_compile_args(threads=threads) |
