[Openmp-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [mlir] [openmp] [polly] [Documentation] Always use SVG for dot-generated doxygen images. (PR #136843)

via Openmp-commits openmp-commits at lists.llvm.org
Wed Apr 23 03:22:53 PDT 2025


https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/136843

Despite our attempt (build-docs.sh)
to build the documentation with SVG,
it still uses PNG https://llvm.org/doxygen/classllvm_1_1StringRef.html,

and that renders terribly on any high dpi display.

SVG leads to smasller installation and works fine
on all browser (that has been true for _a while_ https://caniuse.com/svg), so this patch just unconditionally build all dot graphs as SVG in all subprojects and remove the option.

>From 6871e9bbd9da9cc25ee2bd064f70831be9480427 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Wed, 23 Apr 2025 12:13:23 +0200
Subject: [PATCH] [Documentation] Always use SVG for dot-generated doxygen
 images.

Despite our attempt (build-docs.sh)
to build the documentation with SVG,
it still uses PNG https://llvm.org/doxygen/classllvm_1_1StringRef.html,

and that renders terribly on any high dpi display.

SVG leads to smasller installation and works fine
on all browser (that has been true for _a while_ https://caniuse.com/svg),
so this patch just unconditionally build all dot graphs as SVG
in all subprojects and remove the option.
---
 bolt/docs/CMakeLists.txt              | 9 ---------
 bolt/docs/doxygen.cfg.in              | 2 +-
 clang-tools-extra/docs/CMakeLists.txt | 9 ---------
 clang-tools-extra/docs/doxygen.cfg.in | 2 +-
 clang/docs/CMakeLists.txt             | 9 ---------
 clang/docs/doxygen.cfg.in             | 2 +-
 flang/docs/CMakeLists.txt             | 9 ---------
 flang/docs/doxygen.cfg.in             | 2 +-
 lldb/docs/doxygen.cfg.in              | 2 +-
 llvm/docs/CMake.rst                   | 3 ---
 llvm/docs/CMakeLists.txt              | 9 ---------
 llvm/docs/doxygen.cfg.in              | 2 +-
 llvm/utils/release/build-docs.sh      | 2 +-
 mlir/docs/CMakeLists.txt              | 9 ---------
 mlir/docs/doxygen.cfg.in              | 2 +-
 openmp/docs/CMakeLists.txt            | 9 ---------
 openmp/docs/doxygen.cfg.in            | 2 +-
 openmp/runtime/doc/doxygen/config     | 2 +-
 polly/docs/CMakeLists.txt             | 9 ---------
 polly/docs/doxygen.cfg.in             | 2 +-
 20 files changed, 11 insertions(+), 86 deletions(-)

diff --git a/bolt/docs/CMakeLists.txt b/bolt/docs/CMakeLists.txt
index 12ae852566785..897a0ae043259 100644
--- a/bolt/docs/CMakeLists.txt
+++ b/bolt/docs/CMakeLists.txt
@@ -48,14 +48,6 @@ if (LLVM_ENABLE_DOXYGEN)
     set(bolt_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG
-    "Use svg instead of png files for doxygen graphs." OFF)
-  if (LLVM_DOXYGEN_SVG)
-    set(DOT_IMAGE_FORMAT "svg")
-  else()
-    set(DOT_IMAGE_FORMAT "png")
-  endif()
-
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -73,7 +65,6 @@ if (LLVM_ENABLE_DOXYGEN)
   set(bolt_doxygen_qhelpgenerator_path)
   set(bolt_doxygen_qhp_cust_filter_name)
   set(bolt_doxygen_qhp_cust_filter_attrs)
-  set(DOT_IMAGE_FORMAT)
 
   add_custom_target(doxygen-bolt
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/bolt/docs/doxygen.cfg.in b/bolt/docs/doxygen.cfg.in
index 01571e79555ce..538285f47d924 100644
--- a/bolt/docs/doxygen.cfg.in
+++ b/bolt/docs/doxygen.cfg.in
@@ -2210,7 +2210,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/clang-tools-extra/docs/CMakeLists.txt b/clang-tools-extra/docs/CMakeLists.txt
index 272db266b5054..1eb9dc294f225 100644
--- a/clang-tools-extra/docs/CMakeLists.txt
+++ b/clang-tools-extra/docs/CMakeLists.txt
@@ -46,14 +46,6 @@ if (DOXYGEN_FOUND)
       set(clang_tools_doxygen_qhp_cust_filter_attrs "")
     endif()
 
-    option(LLVM_DOXYGEN_SVG
-      "Use svg instead of png files for doxygen graphs." OFF)
-    if (LLVM_DOXYGEN_SVG)
-      set(DOT_IMAGE_FORMAT "svg")
-    else()
-      set(DOT_IMAGE_FORMAT "png")
-    endif()
-
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
       ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -71,7 +63,6 @@ if (DOXYGEN_FOUND)
     set(clang_tools_doxygen_qhelpgenerator_path)
     set(clang_tools_doxygen_qhp_cust_filter_name)
     set(clang_tools_doxygen_qhp_cust_filter_attrs)
-    set(DOT_IMAGE_FORMAT)
 
     add_custom_target(doxygen-clang-tools
       COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/clang-tools-extra/docs/doxygen.cfg.in b/clang-tools-extra/docs/doxygen.cfg.in
index df33a63906389..d33094f099acf 100644
--- a/clang-tools-extra/docs/doxygen.cfg.in
+++ b/clang-tools-extra/docs/doxygen.cfg.in
@@ -2205,7 +2205,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/clang/docs/CMakeLists.txt b/clang/docs/CMakeLists.txt
index 4fecc007f5995..ca625efc6ccef 100644
--- a/clang/docs/CMakeLists.txt
+++ b/clang/docs/CMakeLists.txt
@@ -47,14 +47,6 @@ if (LLVM_ENABLE_DOXYGEN)
     set(clang_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG
-    "Use svg instead of png files for doxygen graphs." OFF)
-  if (LLVM_DOXYGEN_SVG)
-    set(DOT_IMAGE_FORMAT "svg")
-  else()
-    set(DOT_IMAGE_FORMAT "png")
-  endif()
-
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -72,7 +64,6 @@ if (LLVM_ENABLE_DOXYGEN)
   set(clang_doxygen_qhelpgenerator_path)
   set(clang_doxygen_qhp_cust_filter_name)
   set(clang_doxygen_qhp_cust_filter_attrs)
-  set(DOT_IMAGE_FORMAT)
 
   add_custom_target(doxygen-clang
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/clang/docs/doxygen.cfg.in b/clang/docs/doxygen.cfg.in
index 251afb179b205..09764efc2261e 100644
--- a/clang/docs/doxygen.cfg.in
+++ b/clang/docs/doxygen.cfg.in
@@ -2193,7 +2193,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/flang/docs/CMakeLists.txt b/flang/docs/CMakeLists.txt
index 774fa4c745696..92feb059d4caa 100644
--- a/flang/docs/CMakeLists.txt
+++ b/flang/docs/CMakeLists.txt
@@ -48,14 +48,6 @@ if (LLVM_ENABLE_DOXYGEN)
     set(flang_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG
-    "Use svg instead of png files for doxygen graphs." OFF)
-  if (LLVM_DOXYGEN_SVG)
-    set(DOT_IMAGE_FORMAT "svg")
-  else()
-    set(DOT_IMAGE_FORMAT "png")
-  endif()
-
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -73,7 +65,6 @@ if (LLVM_ENABLE_DOXYGEN)
   set(flang_doxygen_qhelpgenerator_path)
   set(flang_doxygen_qhp_cust_filter_name)
   set(flang_doxygen_qhp_cust_filter_attrs)
-  set(DOT_IMAGE_FORMAT)
 
   add_custom_target(doxygen-flang
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/flang/docs/doxygen.cfg.in b/flang/docs/doxygen.cfg.in
index 2782ded84aa00..cbbe87d92dc90 100644
--- a/flang/docs/doxygen.cfg.in
+++ b/flang/docs/doxygen.cfg.in
@@ -2208,7 +2208,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/lldb/docs/doxygen.cfg.in b/lldb/docs/doxygen.cfg.in
index be8a21a535bdd..2bb7abbde47ab 100644
--- a/lldb/docs/doxygen.cfg.in
+++ b/lldb/docs/doxygen.cfg.in
@@ -1571,7 +1571,7 @@ DIRECTORY_GRAPH        = YES
 # generated by dot. Possible values are png, jpg, or gif
 # If left blank png will be used.
 
-DOT_IMAGE_FORMAT       = png
+DOT_IMAGE_FORMAT       = svg
 
 # The tag DOT_PATH can be used to specify the path where the dot tool can be
 # found. If left blank, it is assumed the dot tool can be found in the path.
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 8d01b4d8b3dc7..c5744ea0f2ecf 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -469,9 +469,6 @@ enabled sub-projects. Nearly all of these variable names begin with
   combination with ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``; otherwise
   it has no effect.
 
-**LLVM_DOXYGEN_SVG**:BOOL
-  Uses .svg files instead of .png files for graphs in the Doxygen output.
-  Defaults to OFF.
 
 .. _llvm_enable_assertions:
 
diff --git a/llvm/docs/CMakeLists.txt b/llvm/docs/CMakeLists.txt
index bc87eb727d322..b4522e3649d9e 100644
--- a/llvm/docs/CMakeLists.txt
+++ b/llvm/docs/CMakeLists.txt
@@ -56,14 +56,6 @@ if (LLVM_ENABLE_DOXYGEN)
     set(llvm_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG
-    "Use svg instead of png files for doxygen graphs." OFF)
-  if (LLVM_DOXYGEN_SVG)
-    set(DOT_IMAGE_FORMAT "svg")
-  else()
-    set(DOT_IMAGE_FORMAT "png")
-  endif()
-
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -81,7 +73,6 @@ if (LLVM_ENABLE_DOXYGEN)
   set(llvm_doxygen_qhelpgenerator_path)
   set(llvm_doxygen_qhp_cust_filter_name)
   set(llvm_doxygen_qhp_cust_filter_attrs)
-  set(DOT_IMAGE_FORMAT)
 
   add_custom_target(doxygen-llvm
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/llvm/docs/doxygen.cfg.in b/llvm/docs/doxygen.cfg.in
index 4f2f02f400bb0..82b281ad103ba 100644
--- a/llvm/docs/doxygen.cfg.in
+++ b/llvm/docs/doxygen.cfg.in
@@ -2194,7 +2194,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/llvm/utils/release/build-docs.sh b/llvm/utils/release/build-docs.sh
index fb2173d39daf8..bc32f209419e4 100755
--- a/llvm/utils/release/build-docs.sh
+++ b/llvm/utils/release/build-docs.sh
@@ -113,7 +113,7 @@ 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"
+  doxygen_flag=" -DLLVM_ENABLE_DOXYGEN=ON"
 else
    echo "Doxygen: disabled"
 fi
diff --git a/mlir/docs/CMakeLists.txt b/mlir/docs/CMakeLists.txt
index 43192569847cf..b32b9427adb5e 100644
--- a/mlir/docs/CMakeLists.txt
+++ b/mlir/docs/CMakeLists.txt
@@ -47,14 +47,6 @@ if (LLVM_ENABLE_DOXYGEN)
     set(mlir_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG
-    "Use svg instead of png files for doxygen graphs." OFF)
-  if (LLVM_DOXYGEN_SVG)
-    set(DOT_IMAGE_FORMAT "svg")
-  else()
-    set(DOT_IMAGE_FORMAT "png")
-  endif()
-
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -72,7 +64,6 @@ if (LLVM_ENABLE_DOXYGEN)
   set(mlir_doxygen_qhelpgenerator_path)
   set(mlir_doxygen_qhp_cust_filter_name)
   set(mlir_doxygen_qhp_cust_filter_attrs)
-  set(DOT_IMAGE_FORMAT)
 
   add_custom_target(doxygen-mlir
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/mlir/docs/doxygen.cfg.in b/mlir/docs/doxygen.cfg.in
index 6c437ea138c21..255041b6817a9 100644
--- a/mlir/docs/doxygen.cfg.in
+++ b/mlir/docs/doxygen.cfg.in
@@ -2194,7 +2194,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/openmp/docs/CMakeLists.txt b/openmp/docs/CMakeLists.txt
index 4cb9fb486ff34..2e60d5471fe61 100644
--- a/openmp/docs/CMakeLists.txt
+++ b/openmp/docs/CMakeLists.txt
@@ -47,14 +47,6 @@ if (LLVM_ENABLE_DOXYGEN)
     set(openmp_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG
-    "Use svg instead of png files for doxygen graphs." OFF)
-  if (LLVM_DOXYGEN_SVG)
-    set(DOT_IMAGE_FORMAT "svg")
-  else()
-    set(DOT_IMAGE_FORMAT "png")
-  endif()
-
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -72,7 +64,6 @@ if (LLVM_ENABLE_DOXYGEN)
   set(openmp_doxygen_qhelpgenerator_path)
   set(openmp_doxygen_qhp_cust_filter_name)
   set(openmp_doxygen_qhp_cust_filter_attrs)
-  set(DOT_IMAGE_FORMAT)
 
   add_custom_target(doxygen-openmp
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/openmp/docs/doxygen.cfg.in b/openmp/docs/doxygen.cfg.in
index 6292a453f749e..07964e90c8eaf 100644
--- a/openmp/docs/doxygen.cfg.in
+++ b/openmp/docs/doxygen.cfg.in
@@ -2194,7 +2194,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/openmp/runtime/doc/doxygen/config b/openmp/runtime/doc/doxygen/config
index 04c966766ba6e..0d8a3ec322100 100644
--- a/openmp/runtime/doc/doxygen/config
+++ b/openmp/runtime/doc/doxygen/config
@@ -1746,7 +1746,7 @@ DIRECTORY_GRAPH        = YES
 # HTML_FILE_EXTENSION to xhtml in order to make the SVG files
 # visible in IE 9+ (other browsers do not have this requirement).
 
-DOT_IMAGE_FORMAT       = png
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.
diff --git a/polly/docs/CMakeLists.txt b/polly/docs/CMakeLists.txt
index 2bd16e53c542f..8b801339962ce 100644
--- a/polly/docs/CMakeLists.txt
+++ b/polly/docs/CMakeLists.txt
@@ -46,14 +46,6 @@ if (LLVM_ENABLE_DOXYGEN)
     set(polly_doxygen_qhp_cust_filter_attrs "")
   endif()
 
-  option(LLVM_DOXYGEN_SVG
-    "Use svg instead of png files for doxygen graphs." OFF)
-  if (LLVM_DOXYGEN_SVG)
-    set(DOT_IMAGE_FORMAT "svg")
-  else()
-    set(DOT_IMAGE_FORMAT "png")
-  endif()
-
   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
 
@@ -71,7 +63,6 @@ if (LLVM_ENABLE_DOXYGEN)
   set(polly_doxygen_qhelpgenerator_path)
   set(polly_doxygen_qhp_cust_filter_name)
   set(polly_doxygen_qhp_cust_filter_attrs)
-  set(DOT_IMAGE_FORMAT)
 
   add_custom_target(doxygen-polly
     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
diff --git a/polly/docs/doxygen.cfg.in b/polly/docs/doxygen.cfg.in
index a553fc8154fb1..5c4e8a6372820 100644
--- a/polly/docs/doxygen.cfg.in
+++ b/polly/docs/doxygen.cfg.in
@@ -2206,7 +2206,7 @@ DIRECTORY_GRAPH        = YES
 # The default value is: png.
 # This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_IMAGE_FORMAT       = @DOT_IMAGE_FORMAT@
+DOT_IMAGE_FORMAT       = svg
 
 # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
 # enable generation of interactive SVG images that allow zooming and panning.



More information about the Openmp-commits mailing list