File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -252,8 +252,7 @@ def _check_coverage_tool_installation(coverage_type: GcovReportFormat, build_dir
252252 "-j" ,
253253 "--jobs" ,
254254 metavar = "N_JOBS" ,
255- help = "Number of parallel tasks to launch" ,
256- type = int ,
255+ help = "Number of parallel tasks to launch. Can be set to `auto` to use all cores." ,
257256)
258257@click .option ("--clean" , is_flag = True , help = "Clean build directory before build" )
259258@click .option (
@@ -364,9 +363,24 @@ def build(
364363
365364 # Any other conditions that warrant a reconfigure?
366365
366+ if jobs is not None :
367+ if jobs == "auto" :
368+ jobs = str (os .cpu_count () or 1 )
369+ else :
370+ try :
371+ jobs = str (int (jobs ))
372+ except ValueError as err :
373+ raise click .BadParameter (
374+ f"Expected an integer or 'auto', got '{ jobs } '" , param_hint = "'-j'"
375+ ) from err
376+
367377 compile_flags = ["-v" ] if verbose else []
368378 if jobs :
369- compile_flags += ["-j" , str (jobs )]
379+ if not quiet :
380+ click .secho (
381+ f"Building with { jobs } parallel jobs" , bold = True , fg = "bright_blue"
382+ )
383+ compile_flags += ["-j" , jobs ]
370384
371385 p = _run (
372386 _meson_cli ()
You can’t perform that action at this time.
0 commit comments