Skip to content

Commit fe7fe6d

Browse files
authored
build-docs: Add option to disable doxygen/sphinx docs (#66928)
Doxygen documentation takes very long to build, when making releases we want to get the normal documentation up earlier so that we don't have to wait for doxygen documentation. This PR just adds the flag to disable doxygen builds, I will then later make a PR that changes the actions to first build the normal docs and another job to build the doxygen docs.
1 parent d60376b commit fe7fe6d

File tree

1 file changed

+43
-22
lines changed

1 file changed

+43
-22
lines changed

llvm/utils/release/build-docs.sh

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# * pip install sphinx-markdown-tables
2121
#===------------------------------------------------------------------------===#
2222

23-
set -ex
23+
set -e
2424

2525
builddir=docs-build
2626
srcdir=$(readlink -f $(dirname "$(readlink -f "$0")")/../..)
@@ -34,6 +34,8 @@ usage() {
3434
echo " documentation from that source."
3535
echo " -srcdir <dir> Path to llvm source directory with CMakeLists.txt"
3636
echo " (optional) default: $srcdir"
37+
echo " -no-doxygen Don't build Doxygen docs"
38+
echo " -no-sphinx Don't build Spinx docs"
3739
}
3840

3941
package_doxygen() {
@@ -57,6 +59,12 @@ while [ $# -gt 0 ]; do
5759
shift
5860
custom_srcdir=$1
5961
;;
62+
-no-doxygen )
63+
no_doxygen="yes"
64+
;;
65+
-no-sphinx )
66+
no_sphinx="yes"
67+
;;
6068
* )
6169
echo "unknown option: $1"
6270
usage
@@ -89,28 +97,35 @@ if [ -n "$release" ]; then
8997
srcdir="./llvm-project/llvm"
9098
fi
9199

100+
if [ "$no_doxygen" == "yes" ] && [ "$no_sphinx" == "yes" ]; then
101+
echo "You can't specify both -no-doxygen and -no-sphinx, we have nothing to build then!"
102+
exit 1
103+
fi
104+
105+
if [ "$no_sphinx" != "yes" ]; then
106+
echo "Sphinx: enabled"
107+
sphinx_targets="docs-clang-html docs-clang-tools-html docs-flang-html docs-lld-html docs-llvm-html docs-polly-html"
108+
sphinx_flag=" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF"
109+
else
110+
echo "Sphinx: disabled"
111+
fi
112+
113+
if [ "$no_doxygen" != "yes" ]; then
114+
echo "Doxygen: enabled"
115+
doxygen_targets="$docs_target doxygen-clang doxygen-clang-tools doxygen-flang doxygen-llvm doxygen-mlir doxygen-polly"
116+
doxygen_flag=" -DLLVM_ENABLE_DOXYGEN=ON -DLLVM_DOXYGEN_SVG=ON"
117+
else
118+
echo "Doxygen: disabled"
119+
fi
120+
92121
cmake -G Ninja $srcdir -B $builddir \
93122
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;polly;flang" \
94123
-DCMAKE_BUILD_TYPE=Release \
95-
-DLLVM_ENABLE_DOXYGEN=ON \
96-
-DLLVM_ENABLE_SPHINX=ON \
97124
-DLLVM_BUILD_DOCS=ON \
98-
-DLLVM_DOXYGEN_SVG=ON \
99-
-DSPHINX_WARNINGS_AS_ERRORS=OFF
125+
$sphinx_flag \
126+
$doxygen_flag
100127

101-
ninja -C $builddir \
102-
docs-clang-html \
103-
docs-clang-tools-html \
104-
docs-flang-html \
105-
docs-lld-html \
106-
docs-llvm-html \
107-
docs-polly-html \
108-
doxygen-clang \
109-
doxygen-clang-tools \
110-
doxygen-flang \
111-
doxygen-llvm \
112-
doxygen-mlir \
113-
doxygen-polly
128+
ninja -C $builddir $sphinx_targets $doxygen_targets
114129

115130
cmake -G Ninja $srcdir/../runtimes -B $builddir/runtimes-doc \
116131
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
@@ -120,10 +135,16 @@ cmake -G Ninja $srcdir/../runtimes -B $builddir/runtimes-doc \
120135
ninja -C $builddir/runtimes-doc \
121136
docs-libcxx-html \
122137

123-
package_doxygen llvm .
124-
package_doxygen clang tools/clang
125-
package_doxygen clang-tools-extra tools/clang/tools/extra
126-
package_doxygen flang tools/flang
138+
if [ "$no_doxygen" != "yes" ]; then
139+
package_doxygen llvm .
140+
package_doxygen clang tools/clang
141+
package_doxygen clang-tools-extra tools/clang/tools/extra
142+
package_doxygen flang tools/flang
143+
fi
144+
145+
if [ "$no_sphinx" == "yes" ]; then
146+
exit 0
147+
fi
127148

128149
html_dir=$builddir/html-export/
129150

0 commit comments

Comments
 (0)