Browse Source

Document using `nproc` instead of hardcoded number of threads (#4476)

Co-authored-by: Hugo Locurcio <[email protected]>
Enhex 4 years ago
parent
commit
5cfdce49ab
1 changed files with 14 additions and 0 deletions
  1. 14 0
      development/compiling/compiling_for_linuxbsd.rst

+ 14 - 0
development/compiling/compiling_for_linuxbsd.rst

@@ -104,6 +104,20 @@ A good rule of thumb for the ``-j`` (*jobs*) flag, is to have at least as many
 threads compiling Godot as you have cores in your CPU, if not one or two more.
 threads compiling Godot as you have cores in your CPU, if not one or two more.
 Feel free to add the ``-j`` option to any SCons command you see below.
 Feel free to add the ``-j`` option to any SCons command you see below.
 
 
+You can automatically use all available CPU cores with command substitution.
+
+On Linux, you can use ``nproc``:
+
+::
+
+    scons -j$(nproc)
+
+On \*BSD, you can use ``sysctl -n hw.ncpu``:
+
+::
+
+    scons -j$(sysctl -n hw.ncpu)  
+
 .. note::
 .. note::
 
 
     Prior to Godot 4.0, the Linux/\*BSD target was called ``x11`` instead of
     Prior to Godot 4.0, the Linux/\*BSD target was called ``x11`` instead of