[Bf-blender-cvs] [2f1a0f6f0ea] master: PyDoc: Multithread sphinx-build

Aaron Carlisle noreply at git.blender.org
Wed Oct 7 16:27:27 CEST 2020


Commit: 2f1a0f6f0eabe090d3ea95c4f508ef72454369a2
Author: Aaron Carlisle
Date:   Wed Oct 7 10:25:06 2020 -0400
Branches: master
https://developer.blender.org/rB2f1a0f6f0eabe090d3ea95c4f508ef72454369a2

PyDoc: Multithread sphinx-build

Compile times went from over 5min to under 2 on my laptop.

===================================================================

M	GNUmakefile
M	doc/python_api/sphinx_doc_gen.sh

===================================================================

diff --git a/GNUmakefile b/GNUmakefile
index e4b5f3b99dc..660493b5945 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -517,7 +517,7 @@ doc_py: .FORCE
 	ASAN_OPTIONS=halt_on_error=0 \
 	$(BLENDER_BIN) --background -noaudio --factory-startup \
 		--python doc/python_api/sphinx_doc_gen.py
-	sphinx-build -b html doc/python_api/sphinx-in doc/python_api/sphinx-out
+	sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
 	@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
 
 doc_doxy: .FORCE
diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh
index be11a10d053..0dcb8ce04a8 100755
--- a/doc/python_api/sphinx_doc_gen.sh
+++ b/doc/python_api/sphinx_doc_gen.sh
@@ -27,6 +27,22 @@ else
 fi
 
 
+# -----------------------------------------------------------------------------
+# Get the number of cores for threaded build
+ifndef NPROCS
+	NPROCS:=1
+	ifeq ($(OS), Linux)
+		NPROCS:=$(shell nproc)
+	endif
+	ifeq ($(OS), NetBSD)
+		NPROCS:=$(shell getconf NPROCESSORS_ONLN)
+	endif
+	ifneq (,$(filter $(OS),Darwin FreeBSD))
+		NPROCS:=$(shell sysctl -n hw.ncpu)
+	endif
+endif
+
+
 # ----------------------------------------------------------------------------
 # Blender Version & Info
 
@@ -76,7 +92,7 @@ fi
 # Generate HTML (sphinx)
 
 if $DO_OUT_HTML ; then
-  sphinx-build -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
+  sphinx-build -b html -j $(NPROCS) $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
 
   # XXX, saves space on upload and zip, should move HTML outside
   # and zip up there, for now this is OK
@@ -103,7 +119,7 @@ fi
 # Generate PDF (sphinx/laytex)
 
 if $DO_OUT_PDF ; then
-  sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
+  sphinx-build -n -b latex -j $(NPROCS) $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
   make -C $SPHINX_WORKDIR/sphinx-out
   mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \
      $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf



More information about the Bf-blender-cvs mailing list