Windows: Add support to compile python api docs from make file

This adds support to compile the html python api docs from the command line by running `make doc_py` matching support between windows and unix.

This patch also makes it so the compiler is not needed if you set the `blender_bin` variable, this affects icon generation as well.

In the future, I want to move away from generating the build output in the build directory but that can come in a later change.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D12144
This commit is contained in:
Aaron Carlisle 2021-08-06 13:54:49 -04:00
parent 3fab16fe8e
commit d245782b80
6 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,34 @@
set SOURCEDIR=%BLENDER_DIR%/doc/python_api/sphinx-in
set BUILDDIR=%BLENDER_DIR%/doc/python_api/sphinx-out
if "%BF_LANG%" == "" set BF_LANG=en
set SPHINXOPTS=-j auto -D language=%BF_LANG%
call "%~dp0\find_sphinx.cmd"
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo unable to locate sphinx-build, run "set sphinx_BIN=full_path_to_sphinx-build.exe"
exit /b 1
:detect_sphinx_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%BLENDER_BIN% ^
--background -noaudio --factory-startup ^
--python %BLENDER_DIR%/doc/python_api/sphinx_doc_gen.py
"%SPHINX_BIN%" -b html %SPHINXOPTS% %O% %SOURCEDIR% %BUILDDIR%
:EOF

View File

@ -0,0 +1,23 @@
REM First see if there is an environment variable set
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
REM Then see if inkscape is available in the path
for %%X in (sphinx-build.exe) do (set SPHINX_BIN=%%~$PATH:X)
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINX_BIN environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
REM If still not found clear the variable
set SPHINX_BIN=
:detect_sphinx_done

View File

@ -113,6 +113,9 @@ if NOT "%1" == "" (
) else if "%1" == "icons_geom" (
set ICONS_GEOM=1
goto EOF
) else if "%1" == "doc_py" (
set DOC_PY=1
goto EOF
) else (
echo Command "%1" unknown, aborting!
goto ERR

View File

@ -32,4 +32,5 @@ set FORMAT=
set TEST=
set BUILD_WITH_SCCACHE=
set ICONS=
set ICONS_GEOM=
set ICONS_GEOM=
set DOC_PY=

View File

@ -31,6 +31,10 @@ echo - 2019 ^(build with visual studio 2019^)
echo - 2019pre ^(build with visual studio 2019 pre-release^)
echo - 2019b ^(build with visual studio 2019 Build Tools^)
echo.
echo Documentation Targets ^(Not associated with building^)
echo - doc_py ^(Generate sphinx python api docs^)
echo.
echo Experimental options
echo - with_opengl_tests ^(enable both the render and draw opengl test suites^)

View File

@ -13,6 +13,14 @@ if errorlevel 1 goto EOF
call "%BLENDER_DIR%\build_files\windows\parse_arguments.cmd" %*
if errorlevel 1 goto EOF
REM if it is one of the convenience targets and BLENDER_BIN is set
REM skip compiler detection
if "%ICONS%%ICONS_GEOM%%DOC_PY%" == "1" (
if EXIST "%BLENDER_BIN%" (
goto convenience_targets
)
)
call "%BLENDER_DIR%\build_files\windows\find_dependencies.cmd"
if errorlevel 1 goto EOF
@ -58,6 +66,8 @@ if "%BUILD_UPDATE%" == "1" (
call "%BLENDER_DIR%\build_files\windows\set_build_dir.cmd"
:convenience_targets
if "%ICONS%" == "1" (
call "%BLENDER_DIR%\build_files\windows\icons.cmd"
goto EOF
@ -68,6 +78,11 @@ if "%ICONS_GEOM%" == "1" (
goto EOF
)
if "%DOC_PY%" == "1" (
call "%BLENDER_DIR%\build_files\windows\doc_py.cmd"
goto EOF
)
echo Building blender with VS%BUILD_VS_YEAR% for %BUILD_ARCH% in %BUILD_DIR%
call "%BLENDER_DIR%\build_files\windows\check_libraries.cmd"