Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-docs: Add option to disable doxygen/sphinx docs #66928

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 43 additions & 22 deletions llvm/utils/release/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# * pip install sphinx-markdown-tables
#===------------------------------------------------------------------------===#

set -ex
set -e

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

package_doxygen() {
Expand All @@ -57,6 +59,12 @@ while [ $# -gt 0 ]; do
shift
custom_srcdir=$1
;;
-no-doxygen )
no_doxygen="yes"
;;
-no-sphinx )
no_sphinx="yes"
;;
* )
echo "unknown option: $1"
usage
Expand Down Expand Up @@ -89,28 +97,35 @@ if [ -n "$release" ]; then
srcdir="./llvm-project/llvm"
fi

if [ "$no_doxygen" == "yes" ] && [ "$no_sphinx" == "yes" ]; then
echo "You can't specify both -no-doxygen and -no-sphinx, we have nothing to build then!"
exit 1
fi

if [ "$no_sphinx" != "yes" ]; then
echo "Sphinx: enabled"
sphinx_targets="docs-clang-html docs-clang-tools-html docs-flang-html docs-lld-html docs-llvm-html docs-polly-html"
sphinx_flag=" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF"
else
echo "Sphinx: disabled"
fi

if [ "$no_doxygen" != "yes" ]; then
echo "Doxygen: enabled"
doxygen_targets="$docs_target doxygen-clang doxygen-clang-tools doxygen-flang doxygen-llvm doxygen-mlir doxygen-polly"
doxygen_flag=" -DLLVM_ENABLE_DOXYGEN=ON -DLLVM_DOXYGEN_SVG=ON"
else
echo "Doxygen: disabled"
fi

cmake -G Ninja $srcdir -B $builddir \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;polly;flang" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_DOXYGEN=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_DOXYGEN_SVG=ON \
-DSPHINX_WARNINGS_AS_ERRORS=OFF
$sphinx_flag \
$doxygen_flag

ninja -C $builddir \
docs-clang-html \
docs-clang-tools-html \
docs-flang-html \
docs-lld-html \
docs-llvm-html \
docs-polly-html \
doxygen-clang \
doxygen-clang-tools \
doxygen-flang \
doxygen-llvm \
doxygen-mlir \
doxygen-polly
ninja -C $builddir $sphinx_targets $doxygen_targets

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

package_doxygen llvm .
package_doxygen clang tools/clang
package_doxygen clang-tools-extra tools/clang/tools/extra
package_doxygen flang tools/flang
if [ "$no_doxygen" != "yes" ]; then
package_doxygen llvm .
package_doxygen clang tools/clang
package_doxygen clang-tools-extra tools/clang/tools/extra
package_doxygen flang tools/flang
fi

if [ "$no_sphinx" == "yes" ]; then
exit 0
fi

html_dir=$builddir/html-export/

Expand Down