Skip to content

Instantly share code, notes, and snippets.

@dc-mak
Last active November 3, 2024 21:36
Show Gist options
  • Save dc-mak/d5c603120011364815299fa7d5631e13 to your computer and use it in GitHub Desktop.
Save dc-mak/d5c603120011364815299fa7d5631e13 to your computer and use it in GitHub Desktop.
Generate Nice LLVM/Clang Documentation
21:34 ➜ llvm-project git:(d28af7c65) ✗ pwd
/home/dhruv/llvm-project
21:34 ➜ llvm-project git:(d28af7c65) ✗ git --no-pager diff
diff --git a/clang/docs/doxygen.cfg.in b/clang/docs/doxygen.cfg.in
index 449552d99..9d1d70d3b 100644
--- a/clang/docs/doxygen.cfg.in
+++ b/clang/docs/doxygen.cfg.in
@@ -1070,7 +1070,7 @@ HTML_STYLESHEET =
# see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET = /usr/local/share/doxygen-awesome-css/doxygen-awesome.css /usr/local/share/doxygen-awesome-css/doxygen-awesome-sidebar-only.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1354,7 +1354,7 @@ DISABLE_INDEX = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
-GENERATE_TREEVIEW = NO
+GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
diff --git a/llvm/docs/doxygen.cfg.in b/llvm/docs/doxygen.cfg.in
index 7a6d531ad..283828a0d 100644
--- a/llvm/docs/doxygen.cfg.in
+++ b/llvm/docs/doxygen.cfg.in
@@ -1071,7 +1071,7 @@ HTML_STYLESHEET =
# see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET = /usr/local/share/doxygen-awesome-css/doxygen-awesome.css /usr/local/share/doxygen-awesome-css/doxygen-awesome-sidebar-only.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1355,7 +1355,7 @@ DISABLE_INDEX = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
-GENERATE_TREEVIEW = NO
+GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
21:34 ➜ llvm-project git:(d28af7c65) ✗ cat docs.sh
#!/usr/bin/env bash
set -euo pipefail
# export PS4="\$LINENO: "
# set -xv
mkdir -p build
cd build
addr=$(ip addr | grep eth0 | tail -n 1 | cut -d' ' -f6 | cut -d'/' -f1)
[ -e Makefile ] || cmake \
-DLLVM_ENABLE_PROJECTS='clang' \
-DLLVM_ENABLE_DOXYGEN=ON \
-DLLVM_DOXYGEN_EXTERNAL_SEARCH=ON \
-DLLVM_DOXYGEN_SEARCHENGINE_URL="http://${addr}:8000/cgi-bin/doxysearch.cgi" \
-DDOXYGEN_EXECUTABLE="/usr/local/bin/doxygen" \
../llvm
[ -d tools/clang/docs/doxygen ] || make doxygen-clang
cd tools/clang/docs/doxygen
mkdir -p cgi-bin
[ -e cgi-bin/doxysearch.cgi ] || cp /home/dhruv/doxygen-1.9.4/bin/doxysearch.cgi cgi-bin
[ -d doxysearch.db ] || /home/dhruv/doxygen-1.9.4/bin/doxyindexer searchdata.xml
# update URL incase it's changed
sed -i "s~172.*:~${addr}:~g" html/search/search.js
python3 -m http.server --cgi &
echo "http://${addr}:8000/html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment