Skip to content

Skip building Doxygen when no documentation inputs have changed #6245

Draft
brtnfld wants to merge 9 commits intoHDFGroup:developfrom
brtnfld:dox3
Draft

Skip building Doxygen when no documentation inputs have changed #6245
brtnfld wants to merge 9 commits intoHDFGroup:developfrom
brtnfld:dox3

Conversation

@brtnfld
Copy link
Collaborator

@brtnfld brtnfld commented Feb 26, 2026

Important

Optimize Doxygen build process by skipping rebuilds when input files are unchanged, using timestamp checks in CMake configuration.

  • Behavior:
    • Skip Doxygen build if input files unchanged using timestamp check in CMakeLists.txt, hl/src/CMakeLists.txt, and src/CMakeLists.txt.
    • Introduces stamp files (hdf5lib_doc.stamp, hdf5hllib_doc.stamp) to track changes.
  • Documentation:
    • add_custom_command and add_custom_target used to manage Doxygen builds.
    • Shared Doxygen content inputs defined in top-level CMakeLists.txt for reuse.
  • Misc:
    • Reorder add_subdirectory(src) in CMakeLists.txt for visibility of Doxygen variables.

This description was created by Ellipsis for 640cd81. You can customize this summary. It will automatically update as commits are pushed.

Replace unconditional add_custom_target(... ALL COMMAND ...) with the
stamp-file pattern (add_custom_command + DEPENDS) so that CMake can
perform timestamp-based up-to-date checks.  Doxygen is now only
re-invoked when a tracked input file is newer than the stamp.
Add CONFIGURE_DEPENDS to file(GLOB_RECURSE) so that CMake automatically
re-configures when files matching the patterns are added or removed.
Quote all glob expressions to prevent issues with paths containing
semicolons (CMake list separators).
Documentation targets (hdf5lib_doc, hdf5hllib_doc) no longer participate
in the default build.  Docs are built on demand via the umbrella target:

    cmake --build . --target doxygen

HDF5_BUILD_DOC already gates whether the doc infrastructure is configured,
so ALL was adding implicit cost to every build for users who simply wanted
docs available.
When HDF5_BUILD_DOC=ON, docs should build automatically on the first
build and again whenever inputs change (handled by the stamp file).
The umbrella "doxygen" target remains available for building docs
independently of compilation.
The dependency lists now mirror the full set of FILE_PATTERNS and INPUT
entries from Doxyfile.in.  Previously missing inputs:

  - Fortran sources (fortran/src/*.F90, hl/fortran/src/*.F90)
  - C++ headers and sources (c++/src/*.h, c++/src/*.cpp)
  - Java sources (H5*.java, HDF*.java, exception classes)
  - Tool headers (h5copy.h, h5dump.h, h5diff_main.h, etc.)
  - HL tool header (h5watch.h)
  - Doxygen menu .md files (examples/menus/*.md)
Move the documentation block (find_package(Doxygen) and related setup)
before add_subdirectory(src) so that DOXYGEN_FOUND is set when
src/CMakeLists.txt processes.  Previously, hdf5lib_doc was never created
because add_subdirectory(src) ran before find_package(Doxygen).

Also extract the shared doxygen content/configuration file patterns
(*.dox, *.html, *.css, *.xml, *.js, menus/*.md) into a single
HDF5_DOXYGEN_CONTENT_INPUTS list in the top-level CMakeLists.txt,
eliminating the duplication between src/ and hl/src/.
Replace filesystem globs with the explicit header/source variables that
HDF5 already maintains where possible:

  - src/: Use H5_PUBLIC_HEADERS and H5_GENERATED_HEADERS instead of
    globbing H5*public.h, H5*module.h, H5*develop.h, H5FD*.h, etc.
  - hl/src/: Use HL_HEADERS instead of globbing H5*public.h, H5*module.h.

Bindings in sibling subdirectory scopes (C++, Fortran, Java) still use
narrow, directory-scoped globs because their source lists are not
visible here — but without CONFIGURE_DEPENDS, so they do not penalize
null-build performance.

Drop CONFIGURE_DEPENDS from the top-level HDF5_DOXYGEN_CONTENT_INPUTS
glob as well: doxygen content/configuration files (*.dox, *.html, *.css)
change rarely in structure, and edits to existing files still trigger
the stamp-file rebuild correctly.
Replace 14 explicit tool header paths with a single-level wildcard
"${HDF5_TOOLS_SRC_DIR}/*/*.h" in the narrow directory glob.  This
is cheap (one directory level, not recursive) and self-maintaining.

Also restructure the dependency gathering into three clearly numbered
steps: explicit core headers, narrow globs for encapsulated scopes,
and the shared doxygen content merge.
@github-project-automation github-project-automation bot moved this to To be triaged in HDF5 - TRIAGE & TRACK Feb 26, 2026
@brtnfld brtnfld marked this pull request as draft February 26, 2026 22:20
@brtnfld brtnfld added the Component - Documentation Doxygen, markdown, etc. label Feb 26, 2026
@brtnfld brtnfld moved this from To be triaged to In progress in HDF5 - TRIAGE & TRACK Feb 26, 2026
@brtnfld brtnfld added this to the HDF5 2.2.0 milestone Feb 26, 2026
Each language/tool subdirectory now appends its explicit source list to
HDF5_DOXYGEN_LIB_INPUTS or HDF5_DOXYGEN_HL_INPUTS via
set_property(GLOBAL APPEND PROPERTY ...).  The hdf5lib_doc and
hdf5hllib_doc targets are defined at the end of the top-level
CMakeLists.txt, after all add_subdirectory() calls, where
get_property() sees the fully-populated lists.

Contributors:
  src/            H5_PUBLIC_HEADERS, H5_GENERATED_HEADERS, H5build_settings.c
  c++/src/        CPP_SOURCES, CPP_HDRS
  fortran/src/    f90_F_BASE_SOURCES
  tools/src/      explicit list of all tool *.h files
  hl/src/         HL_HEADERS, h5watch.h
  hl/fortran/src/ HDF5_HL_F90_F_BASE_SOURCES

Java files are enumerated explicitly in the top-level end block via
DOXYGEN_JAVA_DIR, matching the correct tree (JNI vs pure-Java).

HDF5_DOXYGEN_CONTENT_INPUTS now uses CONFIGURE_DEPENDS so Ninja/Make
automatically re-runs CMake when a .dox/.html/.css/.xml/.js/.md file
is added or removed from the doxygen/ directory.

This eliminates the need for file(GLOB) on source code entirely: adding
a new language source to its explicit compile list automatically becomes
a Doxygen dependency with no manual CMake re-run required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Documentation Doxygen, markdown, etc.

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant