Skip to content

docs: add Doxygen/Breathe infrastructure for C++ API reference - #413

Merged
wojdyr merged 5 commits into
project-gemmi:masterfrom
CV-GPhL:api-docs/infra
Apr 23, 2026
Merged

wojdyr merged 5 commits into
project-gemmi:masterfrom
CV-GPhL:api-docs/infra

Conversation

@CV-GPhL

@CV-GPhL CV-GPhL commented Apr 22, 2026

Copy link
Copy Markdown
Member

Summary

Adds the build infrastructure needed to generate a C++ API reference from
Doxygen comments in `include/gemmi/*.hpp` and render it within the existing
Sphinx/readthedocs documentation site.

This is PR 1 of a planned series of 10 PRs. PRs 2–10 add full Doxygen
comments to all public headers and depend on this PR being merged first —
they will expand `docs/api.rst` and have no meaning without the build pipeline
established here.

What this PR does

  • Adds `docs/Doxyfile`: Doxygen configuration producing XML consumed by Breathe.
    Internal/data-only headers (`ace_*.hpp`, `acedrg_tables.hpp`, `mc_tables.hpp`,
    `eig3.hpp`, `cc_adj.hpp`, `ccp4ener.hpp`) are excluded.
  • Extends `docs/conf.py`: runs Doxygen as a subprocess before the Sphinx build,
    adds the `breathe` Sphinx extension and its configuration.
  • Adds `docs/api.rst`: a stub C++ API reference page included in the existing toctree.
    This stub will grow with each subsequent PR in this series.
  • Updates `docs/index.rst`: replaces the external link to `project-gemmi.github.io/cxx-api/`
    with an internal link to the new `api.rst` page.
  • Updates `docs/requirements.txt` and `.readthedocs.yaml` to install `breathe` and `doxygen`.

Planned PR series (all depend on this PR)

PR Content
1 (this PR) Build infrastructure
2 Core structures: `model.hpp`, `unitcell.hpp`, `symmetry.hpp`, `metadata.hpp`, `elem.hpp`, `seqid.hpp`, `resinfo.hpp`, `small.hpp`
3 CIF: `cif.hpp`, `cifdoc.hpp`, `read_cif.hpp`, `to_cif.hpp`, `to_json.hpp`, `json.hpp`, `numb.hpp`, `ddl.hpp`
4 Structure I/O: `mmcif.hpp`, `mmread.hpp`, `pdb.hpp`, `to_mmcif.hpp`, `to_pdb.hpp`, `mmdb.hpp`, `crd.hpp`, …
5 Reflection data: `mtz.hpp`, `refln.hpp`, `cif2mtz.hpp`, `mtz2cif.hpp`, `xds_ascii.hpp`, `binner.hpp`, …
6 Maps/grids: `grid.hpp`, `ccp4.hpp`, `dencalc.hpp`, `fourier.hpp`, `solmask.hpp`, …
7 Calculations: `calculate.hpp`, `neighbor.hpp`, `sfcalc.hpp`, `align.hpp`, `select.hpp`, …
8 Chemistry/monomer: `chemcomp.hpp`, `monlib.hpp`, `topo.hpp`, `riding_h.hpp`, …
9 Scattering/math: `formfact.hpp`, `it92.hpp`, `fprime.hpp`, `math.hpp`, `cellred.hpp`, …
10 I/O utilities: `dirwalk.hpp`, `fileutil.hpp`, `gz.hpp`, `util.hpp`, `span.hpp`, …

Relationship to PR #402

This PR is the first in a series building on Paul Emsley's PR #402 (pemsley). As requested
by @wojdyr in the discussion there, the Doxygen configuration lives under `docs/` alongside
the existing Sphinx configuration rather than under `include/gemmi/`. The `doxy-sphinx/`
directory from PR #402 is not included here.

Build verification

```
cd docs && make html # runs Doxygen then Sphinx; api.html ~600KB
```

Verified locally: doxygen 1.9.8, breathe 4.36.0, Sphinx 9.1.0, ubuntu-24.04.

Test plan

  • Confirm readthedocs build passes with `apt_packages: [doxygen]`
  • Confirm `docs/api.html` renders without Breathe errors
  • Confirm `docs/_doxygen/` is not committed (gitignored)

Wires up Doxygen XML generation + Breathe Sphinx extension so that
C++ API documentation from header comments renders in the existing
Sphinx/readthedocs site at docs/api.rst.

- docs/Doxyfile: Doxygen config (XML-only output, internal headers excluded)
- docs/conf.py: runs Doxygen as subprocess, adds breathe extension
- docs/api.rst: stub C++ API reference page (expanded by subsequent PRs)
- docs/index.rst: replace external cxx-api link with internal api.rst
- docs/requirements.txt: add breathe >= 4.35
- .readthedocs.yaml: add apt_packages: [doxygen]
- .gitignore: exclude docs/_doxygen/ (generated)

Builds on prior work in project-gemmi#402 (Paul Emsley / pemsley).
Co-authored-by: C. Vonrhein / CV-GPhL
@wojdyr

wojdyr commented Apr 23, 2026

Copy link
Copy Markdown
Member
image

@wojdyr

wojdyr commented Apr 23, 2026

Copy link
Copy Markdown
Member

somehow i'm notable to merge it

@wojdyr

wojdyr commented Apr 23, 2026

Copy link
Copy Markdown
Member

i'mtrying tomerge sll these PRs, but I'm not able

@wojdyr

wojdyr commented Apr 23, 2026

Copy link
Copy Markdown
Member

@keitaroyam can you try?

@wojdyr
wojdyr merged commit 0dba38b into project-gemmi:master Apr 23, 2026
8 of 10 checks passed
@keitaroyam

Copy link
Copy Markdown
Collaborator

What's happening? Why so many PRs?

@wojdyr

wojdyr commented Apr 24, 2026

Copy link
Copy Markdown
Member

Clemens

What's happening? Why so many PRs?

Clemens adds Doxygen comments

@CV-GPhL

CV-GPhL commented Apr 30, 2026

Copy link
Copy Markdown
Member Author

Sorry about that barrage of PRs ... I thought it made more sense to split them into (reasonably) logical blocks since it is/was quite a lot.

keitaroyam pushed a commit that referenced this pull request May 29, 2026
Restores the initialization of GridMeta::spacegroup = nullptr that was
inadvertently removed in PR #418. This fixes undefined behavior when the
space group pointer is accessed before being explicitly set.

Part of comprehensive fix for initialization removals introduced in
Doxygen documentation PR series (#413-#422).
@CV-GPhL
CV-GPhL deleted the api-docs/infra branch July 28, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants