Skip to content

Commit deb3b7b

Browse files
authored
Merge 1efe75b into 47695ac
2 parents 47695ac + 1efe75b commit deb3b7b

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ repos:
4848
hooks:
4949
- id: scons-source
5050
name: build c/c++ files
51-
entry: cmd.exe /c "scons source -j 0"
51+
entry: cmd.exe /c "scons source --all-cores"
5252
language: system
5353
pass_filenames: false
5454
types_or: [c, c++]
5555
- id: checkPot
5656
name: translation string check
57-
entry: cmd.exe /c "scons checkPot -j 0"
57+
entry: cmd.exe /c "scons checkPot --all-cores"
5858
language: system
5959
pass_filenames: false
6060
types: [python]

projectDocs/dev/buildingNVDA.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ scons source user_docs
1818

1919
While simply testing or committing changes, it may be faster usually just doing `scons source` as user documentation will change each time the revision number changes.
2020

21+
You can speed up scons calls by appending the `--all-cores` parameter to the call, however note that output will be scrambled:
22+
23+
```cmd
24+
scons source --all-cores
25+
```
26+
2127
## Running the Source Code
2228
It is possible to run NVDA directly from source without having to build the full binary package and launcher.
2329
To launch NVDA from source, using `cmd.exe`, execute `runnvda.bat` in the root of the repository.

sconstruct

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,28 @@ env = Environment(
159159
# speed up subsequent runs by checking timestamps of targets and dependencies, and only using md5 if timestamps differ.
160160
env.Decider("MD5-timestamp")
161161

162+
AddOption(
163+
"--all-cores",
164+
action="store_true",
165+
dest="all_cores",
166+
default=False,
167+
help="always use the maximum number of available processor cores",
168+
)
162169
# Warn to run the build on multiple threads so it runs faster
163-
numJobs = env.GetOption("num_jobs")
164170
numCores = multiprocessing.cpu_count()
165-
if numJobs == 0:
166-
numJobs = numCores
167-
env.SetOption("num_jobs", numJobs)
168-
if numJobs < numCores:
169-
print(
170-
f"Warning: Building with {numJobs} concurrent job{'s' if numJobs != 1 else ''} "
171+
if (allCores := GetOption("all_cores")):
172+
SetOption("num_jobs", numCores)
173+
if (numJobs := GetOption("num_jobs")) < numCores:
174+
msg = "Warning: "
175+
if allCores:
176+
msg += "Providing both the '--all-cores' and '-j'/'--num-jobs' parameters is not supported. "
177+
msg += (
178+
f"Building with {numJobs} concurrent job{'s' if numJobs != 1 else ''} "
171179
f"while {numCores} CPU threads are available. "
172180
f"Running SCONS with the parameter '-j{numCores}' may lead to a faster build. "
173-
"Running SCONS with parameter '-j0' will automatically pick all available cores. "
181+
"Running SCONS with parameter '--all-cores' will automatically pick all available cores."
174182
)
183+
print(msg)
175184
else:
176185
print(f"Building with {numJobs} concurrent jobs")
177186

user_docs/en/changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Please refer to [the developer guide](https://www.nvaccess.org/files/nvda/docume
4545
* Dictionary metadata can be added to an optional `symbolDictionaries` section in the add-on manifest.
4646
* Please consult the [Custom speech symbol dictionaries section in the developer guide](https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#AddonSymbolDictionaries) for more details.
4747
* It is now possible to redirect objects retrieved from on-screen coordinates, by using the `NVDAObject.objectFromPointRedirect` method. (#16788, @Emil-18)
48-
* Running SCons with the parameter `-j0` will automatically pick the maximum number of available CPU cores. (#16868, @LeonarddeR)
48+
* Running SCons with the parameter `--all-cores` will automatically pick the maximum number of available CPU cores. (#16868, @LeonarddeR)
4949

5050
#### Deprecations
5151

0 commit comments

Comments
 (0)