Skip to content

Commit

Permalink
Doxygen: fix doc compilation with Doxygen 1.10 or later (#8665)
Browse files Browse the repository at this point in the history
- Introduce container images for Doxygen.
- Ensure compatibility with Doxygen 1.10 and later.
- Revert previous stylesheet changes to restore the correct stylesheet
path (reverts #8331).
  • Loading branch information
lrineau authored Jan 6, 2025
2 parents cb3e182 + 08a3f52 commit e9a2365
Show file tree
Hide file tree
Showing 20 changed files with 227 additions and 84 deletions.
55 changes: 55 additions & 0 deletions .devcontainer/doxygen-cgal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Use an official Fedora as a parent image for the build stage
FROM fedora:latest AS sources_deps

# Set environment variables to non-interactive
ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN dnf update -y && dnf install -y \
wget \
make \
gcc \
gcc-c++ \
patch \
cmake \
bison \
flex \
unzip \
python3 \
&& dnf clean all

# Copy the patch file to the build context
COPY cgal-NO_ADDITIONAL_DETAILS.patch .

FROM sources_deps AS build

# Build and install Doxygen from sources
ARG DOXYGEN_VERSION=1.9.6
ARG MAKEFLAGS=-j$(nproc)
RUN if [ -n "$DEBUG"];then set -x && make --version && ls -lZ /tmp && id; fi \
&& DOXYGEN_VERSION_UNDERSCORE=$(echo ${DOXYGEN_VERSION} | sed 's/\./_/g') \
&& wget https://github.com/doxygen/doxygen/archive/refs/tags/Release_${DOXYGEN_VERSION_UNDERSCORE}.zip \
&& unzip Release_${DOXYGEN_VERSION_UNDERSCORE}.zip \
&& cd doxygen-Release_${DOXYGEN_VERSION_UNDERSCORE} \
&& patch -p1 < ../cgal-NO_ADDITIONAL_DETAILS.patch \
&& mkdir build \
&& cd build \
&& cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. \
&& cmake --build . \
&& cmake --install . \
&& mkdir -p /usr/local/share/doc/doxygen && cp ../LICENSE /usr/local/share/doc/doxygen/LICENSE.TXT \
&& cd ../.. \
&& rm -rf doxygen-Release_${DOXYGEN_VERSION_UNDERSCORE} Release_${DOXYGEN_VERSION_UNDERSCORE}.zip

# Use a smaller base image for the final stage
FROM fedora:latest

# Install necessary runtime dependencies
RUN set -x \
&& dnf update -y && dnf install -y graphviz 'perl(Getopt::Std)' tex-bibtex cmake python3-lxml python3-pyquery \
&& dnf clean all

# Copy Doxygen from the build stage
COPY --from=build /usr/local/bin/doxygen /usr/local/bin
COPY --from=build /usr/local/share/doc/doxygen/LICENSE.TXT /usr/local/share/doc/doxygen/LICENSE.TXT
RUN doxygen --version
23 changes: 23 additions & 0 deletions .devcontainer/doxygen-cgal/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
SHELL := /bin/bash
DOXYGEN_VERSIONS := 1.12.0 1.11.0 1.10.0 1.9.8 1.9.7 1.9.6

.PHONY: all build-% push-% build push

all: build
@echo "Use `$(MAKE) push` to push the images to the registry."

build-%:
@echo "MAKEFLAGS: $(MAKEFLAGS)"
@echo "Building Doxygen version $*..."
if [ "$$(getenforce || true)" == "Enforcing" ]; then Z=:z; else Z=; fi; \
F="$(MAKEFLAGS)"; F=$${F##*fifo:}; F=$${F%% *}; \
if [ -p "$$F" ]; then echo "The GNU make FIFO file exists:"; ls -l $$F; VOLUME_ARGS="-v $$F:$$F$$Z"; echo -- $$VOLUME_ARGS; fi; \
podman build --build-arg DOXYGEN_VERSION=$* --build-arg "MAKEFLAGS=$(MAKEFLAGS)" $$VOLUME_ARGS -t cgal/doxygen:$* .

push-%: build-%
@echo "Pushing cgal/doxygen:$*..."
podman push cgal/doxygen:$*

build: $(foreach version,$(DOXYGEN_VERSIONS),build-$(version))

push: $(foreach version,$(DOXYGEN_VERSIONS),push-$(version))
44 changes: 44 additions & 0 deletions .devcontainer/doxygen-cgal/cgal-NO_ADDITIONAL_DETAILS.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/src/config.xml b/src/config.xml
index 13910958a6..31f1354e44 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -893,6 +893,18 @@ Go to the <a href="commands.html">next</a> section or return to the
\note This will also disable the warnings about undocumented members
that are normally produced when \ref cfg_warnings "WARNINGS" is
set to \c YES.
+]]>
+ </docs>
+ </option>
+ </group>
+ <group name='Build' docs='Build related configuration options'>
+ <option type='bool' id='NO_ADDITIONAL_DETAILS' defval='0'>
+ <docs>
+<![CDATA[
+ When the \c EXTRACT_ALL tag is set to \c YES and a member or class
+ as no documentation, no detailed section will be produced if
+ the \c NO_ADDITIONAL_DETAILS tag is set to \c YES.
+ This tag has no effect if the \c EXTRACT_ALL tag is set to \c NO.
]]>
</docs>
</option>
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 08d9bf24c5..ab04e994c5 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -2501,6 +2501,7 @@ bool MemberDefImpl::hasDetailedDescription() const
if (!m_hasDetailedDescriptionCached)
{
bool extractAll = Config_getBool(EXTRACT_ALL);
+ bool xAllNoDetailedSec = Config_getBool(NO_ADDITIONAL_DETAILS);
bool alwaysDetailedSec = Config_getBool(ALWAYS_DETAILED_SEC);
bool repeatBrief = Config_getBool(REPEAT_BRIEF);
bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC);
@@ -2512,7 +2513,7 @@ bool MemberDefImpl::hasDetailedDescription() const
// the member has detailed documentation because the user added some comments
bool docFilter =
// extract all is enabled
- extractAll ||
+ (extractAll && !xAllNoDetailedSec) ||
// has detailed docs
!documentation().isEmpty() ||
// has inbody docs
16 changes: 16 additions & 0 deletions .devcontainer/doxygen-cgal/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "CGAL Doxygen Dev Container, version 1.12.0, with CGAL patch",
"image": "docker.io/cgal/doxygen:1.12.0",
"features": {
"ghcr.io/devcontainers/features/git:1.3.2": {}
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cmake-tools",
"bbenoist.Doxygen",
"ms-vscode.cpptools"
]
}
},
}
29 changes: 29 additions & 0 deletions .devcontainer/doxygen-cgal/distrobox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[distrobox-doxygen-1.12.0]
image=cgal/doxygen:1.12.0
exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3"
exported_bins_path=$HOME/.local/bin-doxygen-1.12.0

[distrobox-doxygen-1.11.0]
image=cgal/doxygen:1.11.0
exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3"
exported_bins_path=$HOME/.local/bin-doxygen-1.11.0

[distrobox-doxygen-1.10.0]
image=cgal/doxygen:1.10.0
exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3"
exported_bins_path=$HOME/.local/bin-doxygen-1.10.0

[distrobox-doxygen-1.9.8]
image=cgal/doxygen:1.9.8
exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3"
exported_bins_path=$HOME/.local/bin-doxygen-1.9.8

[distrobox-doxygen-1.9.7]
image=cgal/doxygen:1.9.7
exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3"
exported_bins_path=$HOME/.local/bin-doxygen-1.9.7

[distrobox-doxygen-1.9.6]
image=cgal/doxygen:1.9.6
exported_bins="/usr/local/bin/doxygen /usr/bin/perl /usr/bin/cmake /usr/bin/python3"
exported_bins_path=$HOME/.local/bin-doxygen-1.9.6
48 changes: 42 additions & 6 deletions Documentation/doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ else()
set(CGAL_ROOT "${CMAKE_SOURCE_DIR}")
endif()

cmake_minimum_required(VERSION 3.18..3.29) # for list(SORT ... COMPARE NATURAL)

find_package(Doxygen REQUIRED)
find_package(Python3 REQUIRED COMPONENTS Interpreter)

Expand All @@ -32,7 +34,7 @@ if (NOT Python3_EXECUTABLE)
return()
endif()

message(STATUS ${Python3_EXECUTABLE})
message(VERBOSE "Using Python version ${Python3_VERSION}: ${Python3_EXECUTABLE}")

if(NOT DOXYGEN_FOUND)
message(WARNING "Cannot build the documentation without Doxygen!")
Expand Down Expand Up @@ -275,20 +277,54 @@ set(CGAL_DOC_DXY_DIR "${CMAKE_BINARY_DIR}/doc_dxy")
file(MAKE_DIRECTORY "${CGAL_DOC_DXY_DIR}")

#Setting the resource directory depending on the version of doxygen
set(CGAL_DOC_RESOURCE_DIR_DEFAULT "${CMAKE_CURRENT_LIST_DIR}/resources/1.10.0")
set(CGAL_DOC_RESOURCE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/resources")

# first look if resources for the specific doxygen version is available, fallback
# on the default otherwise

#select only the version number (not the commit hash)
string(REPLACE " " ";" DOXYGEN_VERSION ${DOXYGEN_VERSION})
list(GET DOXYGEN_VERSION 0 DOXYGEN_VERSION)
message(VERBOSE "Doxygen version ${DOXYGEN_VERSION}: ${DOXYGEN_EXECUTABLE}")

# The Doxygen version is search in that sorted list (to find the index for which the version is less or equal)
set(CGAL_DOXYGEN_RESOURCES_VERSIONS 1.8.13 1.9.6 1.10.0)
list(SORT CGAL_DOXYGEN_RESOURCES_VERSIONS COMPARE NATURAL)

# The GLOB is here to check that the list in CGAL_DOXYGEN_RESOURCES_VERSIONS is correct.
# CGAL_DOXYGEN_RESOURCES_DIRS is also used below.
file(GLOB CGAL_DOXYGEN_RESOURCES_DIRS
RELATIVE "${CGAL_DOC_RESOURCE_PREFIX_DIR}"
"${CGAL_DOC_RESOURCE_PREFIX_DIR}/*")
list(SORT CGAL_DOXYGEN_RESOURCES_DIRS COMPARE NATURAL)

if(NOT CGAL_DOXYGEN_RESOURCES_DIRS STREQUAL CGAL_DOXYGEN_RESOURCES_VERSIONS)
message(FATAL "The directories in ${CGAL_DOC_RESOURCE_PREFIX_DIR} do not match the
expected versions: [${CGAL_DOXYGEN_RESOURCES_VERSIONS}] vs [${CGAL_DOXYGEN_RESOURCES_DIRS}]")
endif()

if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/resources/${DOXYGEN_VERSION}")
set(CGAL_DOC_RESOURCE_DIR
"${CMAKE_CURRENT_LIST_DIR}/resources/${DOXYGEN_VERSION}")
function(CGAL_insert_in_sorted_list list_name value)
set(list ${${list_name}})
if(NOT value IN_LIST list)
list(APPEND list "${value}")
list(SORT list COMPARE NATURAL)
endif()
set(${list_name} ${list} PARENT_SCOPE)
endfunction()

if(DOXYGEN_VERSION IN_LIST CGAL_DOXYGEN_RESOURCES_VERSIONS)
list(FIND CGAL_DOXYGEN_RESOURCES_VERSIONS "${DOXYGEN_VERSION}" DOXYGEN_VERSION_INDEX)
else()
CGAL_insert_in_sorted_list(CGAL_DOXYGEN_RESOURCES_VERSIONS ${DOXYGEN_VERSION})
list(FIND CGAL_DOXYGEN_RESOURCES_VERSIONS ${DOXYGEN_VERSION} DOXYGEN_VERSION_INDEX)
math(EXPR DOXYGEN_VERSION_INDEX "${DOXYGEN_VERSION_INDEX} - 1")
endif()
list(GET CGAL_DOXYGEN_RESOURCES_DIRS "${DOXYGEN_VERSION_INDEX}" CGAL_DOC_RESOURCE_DIR)
set(CGAL_DOC_RESOURCE_DIR "${CGAL_DOC_RESOURCE_PREFIX_DIR}/${CGAL_DOC_RESOURCE_DIR}")
if(NOT EXISTS "${CGAL_DOC_RESOURCE_DIR}")
message(FATAL_ERROR "Doxygen resources for version ${DOXYGEN_VERSION} not found")
else()
set(CGAL_DOC_RESOURCE_DIR "${CGAL_DOC_RESOURCE_DIR_DEFAULT}")
message(VERBOSE "Using Doxygen resources from ${CGAL_DOC_RESOURCE_DIR}")
endif()

set(CGAL_DOC_BIBLIO_DIR "${CMAKE_CURRENT_LIST_DIR}/biblio")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ These options should suffice to create a `CMakeLists.txt` script
for most directories containing programs. However, in some special
cases, it might still be required to create the script manually, for
instance, if some source files/executables need a different linking than
other source files. The Section \subpage devman_create_and_use_a_cmakelist provides more details.
other source files. The Section \ref devman_create_and_use_a_cmakelist provides more details.

*/
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ The developer manual is primarily aimed at \cgal developers, but may also be int
- \subpage devman_info
- \subpage devman_create_cgal_CMakeLists
- \subpage deprecated
- \subpage Doxygen_for_CGAL
*/
1 change: 1 addition & 0 deletions Documentation/doc/Documentation/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ FILTER_PATTERNS = *.txt=${CMAKE_BINARY_DIR}/pkglist_filter

HTML_EXTRA_FILES += ${CGAL_DOC_RESOURCE_DIR}/hacks.js \
${CGAL_DOC_RESOURCE_DIR}/menu_version.js \
${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css \
${CMAKE_BINARY_DIR}/how_to_cite_cgal.bib \
${CMAKE_BINARY_DIR}/how_to_cite.html \
${CGAL_PACKAGE_DOC_DIR}/fig/g-196x196-doc.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Doxygen for CGAL #
\page Doxygen_for_CGAL Doxygen for CGAL

This is the documentation of doxygen hacks that are applied to make
the output of Doxygen more suitable to CGAL. It explains the general
Expand All @@ -14,17 +14,17 @@ hacks that create what you see.
### Package Overview ###

The package overview is build by having a special command that is
filtered by the python script pkglist_filter.py.
filtered by the python script `pkglist_filter.py`.

A command has to be of the form \package_listing{PKG_NAME}, where
PKG_NAME cannot contain a closing }.
A command has to be of the form `\package_listing{PKG_NAME}`, where
`PKG_NAME` cannot contain a closing `}`.

The command is replaced by the text between the two delimiters
PkgDescBegin and PkgDescEnd in the file ../PKG_NAME/doc/PKG_NAME/PackageDescription.txt
`cgalPkgDescriptionBegin` and `cgalPkgDescriptionEnd` in the file `../PKG_NAME/doc/PKG_NAME/PackageDescription.txt`

If PKG_NAME is of the form A/B the selected file is
../A/doc/B/PackageDescription.txt. This is to support packages like
TDS_2, which don't reside in their own packages in the SCM.
If `PKG_NAME` is of the form `A/B` the selected file is
`../A/doc/B/PackageDescription.txt`. This is to support packages like
`TDS_2`, which don't reside in their own packages in the SCM.

### Footnotes ###

Expand All @@ -50,13 +50,13 @@ LaTex.
This hack fiddles with the internal structures and functions of the
treeview to remove the unnecessary intermediate top-level module part.

It assigns the first element of the module array (found in module.js)
It assigns the first element of the module array (found in `module.js`)
to the Reference Manual entry. This makes the tree view link go to
that group directly instead of the intermediate link. It also removes
one level of nesting.

Unfortunately this changes the overall tree structure. To adjust for
that we hijack the gotoNode function of navtree.js and *augment* it
that we hijack the `gotoNode` function of `navtree.js` and *augment* it
with an additional check for the specific tree level we borked and
redirect it.

Expand Down
18 changes: 0 additions & 18 deletions Documentation/doc/resources/1.10.0/BaseDoxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -486,24 +486,6 @@ HTML_HEADER = ${CGAL_DOC_HEADER_PACKAGE}

HTML_FOOTER = ${CGAL_DOC_RESOURCE_DIR}/footer.html

# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
# created by doxygen. Using this option one can overrule certain style aspects.
# This is preferred over using HTML_STYLESHEET since it does not replace the
# standard style sheet and is therefore more robust against future updates.
# Doxygen will copy the style sheet files to the output directory.
# Note: The order of the extra style sheet files is of importance (e.g. the last
# style sheet in the list overrules the setting of the previous ones in the
# list).
# Note: Since the styling of scrollbars can currently not be overruled in
# Webkit/Chromium, the styling will be left out of the default doxygen.css if
# one or more extra stylesheets have been specified. So if scrollbar
# customization is desired it has to be added explicitly. For an example see the
# documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_EXTRA_STYLESHEET = ${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css

# Doxygen stores a couple of settings persistently in the browser (via e.g.
# cookies). By default these settings apply to all HTML pages generated by
# doxygen across all projects. The HTML_PROJECT_COOKIE tag can be used to store
Expand Down
1 change: 1 addition & 0 deletions Documentation/doc/resources/1.10.0/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
$mathjax
$darkmode
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
<link href="$relpath$../Manual/cgal_stylesheet.css" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions Documentation/doc/resources/1.10.0/header_package.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<script type="text/javascript" src="../Manual/search/search.js"></script>
<!-- Manually done below. -->
<link href="$relpath^../Manual/$stylesheet" rel="stylesheet" type="text/css" />
<link href="$relpath$../Manual/cgal_stylesheet.css" rel="stylesheet" type="text/css" />
$mathjax
$darkmode
<script src="$relpath^topics.js" type="text/javascript"></script>
Expand Down
18 changes: 0 additions & 18 deletions Documentation/doc/resources/1.8.13/BaseDoxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -477,24 +477,6 @@ HTML_HEADER = ${CGAL_DOC_HEADER_PACKAGE}

HTML_FOOTER = ${CGAL_DOC_RESOURCE_DIR}/footer.html

# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
# created by doxygen. Using this option one can overrule certain style aspects.
# This is preferred over using HTML_STYLESHEET since it does not replace the
# standard style sheet and is therefore more robust against future updates.
# Doxygen will copy the style sheet files to the output directory.
# Note: The order of the extra style sheet files is of importance (e.g. the last
# style sheet in the list overrules the setting of the previous ones in the
# list).
# Note: Since the styling of scrollbars can currently not be overruled in
# Webkit/Chromium, the styling will be left out of the default doxygen.css if
# one or more extra stylesheets have been specified. So if scrollbar
# customization is desired it has to be added explicitly. For an example see the
# documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_EXTRA_STYLESHEET = ${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css

# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to YES can help to show when doxygen was last run and thus if the
Expand Down
1 change: 0 additions & 1 deletion Documentation/doc/resources/1.8.13/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
<!-- This should probably be an extrastylesheet instead of hardcoded. -->
<link href="$relpath$../Manual/cgal_stylesheet.css" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
Expand Down
Loading

0 comments on commit e9a2365

Please sign in to comment.