Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(docs): use doxygen_add_docs() #726

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tachi107
Copy link
Contributor

@Tachi107 Tachi107 commented Sep 25, 2022

I had originally done this in #662, but never re-submitted it. 06aa271 reminded me that I should also include Doxygen documentation in the Debian package, so I took a bit of time to re-prepare this patch.

Using CMake's doxygen_add_docs() isn't only more concise and idiomatic, it also solves actual issues of Doxygen-generated documentation. Without this patch, the generated docs include an absolute path of the build directory; apart from being ugly, it also creates issues with reproducibility, as it is required to rebuild the package in the same exact directory to get a bit-by-bit identical copy of the package.

CMake is able to work around this Doxygen quirk, and the generated HTML only includes relative paths.

The documentation gets now output to build/html/ instead of build/docs/html/.

As another minor change, I've also associated the installed docs to the Documentation component, so that users can choose to install only them with cmake --install builddir --component Documentation.

Here's a full diff of the generated output before and after applying this patch:

diff html_no_patch_dot/cubeb_8h.html html_dot/cubeb_8h.html
8c8
< <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h File Reference</title>
---
> <title>cubeb: include/cubeb/cubeb.h File Reference</title>
87,92c87,92
< <div class="center"><img src="cubeb_8h__incl.png" border="0" usemap="#a_2tmp_2tmp_8ils_at_y7fk0_2up_2cubeb_2include_2cubeb_2cubeb_8h" alt=""/></div>
< <map name="a_2tmp_2tmp_8ils_at_y7fk0_2up_2cubeb_2include_2cubeb_2cubeb_8h" id="a_2tmp_2tmp_8ils_at_y7fk0_2up_2cubeb_2include_2cubeb_2cubeb_8h">
< <area shape="rect" title="The libcubeb C API." alt="" coords="99,5,277,61"/>
< <area shape="rect" title=" " alt="" coords="5,109,128,136"/>
< <area shape="rect" title=" " alt="" coords="153,109,223,136"/>
< <area shape="rect" title=" " alt="" coords="247,109,318,136"/>
---
> <div class="center"><img src="cubeb_8h__incl.png" border="0" usemap="#ainclude_2cubeb_2cubeb_8h" alt=""/></div>
> <map name="ainclude_2cubeb_2cubeb_8h" id="ainclude_2cubeb_2cubeb_8h">
> <area shape="rect" title="The libcubeb C API." alt="" coords="105,5,271,32"/>
> <area shape="rect" title=" " alt="" coords="5,80,128,107"/>
> <area shape="rect" title=" " alt="" coords="153,80,223,107"/>
> <area shape="rect" title=" " alt="" coords="247,80,318,107"/>
diff html_no_patch_dot/cubeb_8h__incl.map html_dot/cubeb_8h__incl.map
1,5c1,5
< <map id="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h" name="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h">
< <area shape="rect" id="node1" title="The libcubeb C API." alt="" coords="99,5,277,61"/>
< <area shape="rect" id="node2" title=" " alt="" coords="5,109,128,136"/>
< <area shape="rect" id="node3" title=" " alt="" coords="153,109,223,136"/>
< <area shape="rect" id="node4" title=" " alt="" coords="247,109,318,136"/>
---
> <map id="include/cubeb/cubeb.h" name="include/cubeb/cubeb.h">
> <area shape="rect" id="node1" title="The libcubeb C API." alt="" coords="105,5,271,32"/>
> <area shape="rect" id="node2" title=" " alt="" coords="5,80,128,107"/>
> <area shape="rect" id="node3" title=" " alt="" coords="153,80,223,107"/>
> <area shape="rect" id="node4" title=" " alt="" coords="247,80,318,107"/>
diff html_no_patch_dot/cubeb_8h__incl.md5 html_dot/cubeb_8h__incl.md5
1c1
< 80f3c1becd2984dea59dbcc5f43d8bc7
\ No newline at end of file
---
> bd73bf4d2f8603949fb7021f1b7e2758
\ No newline at end of file
Binary files html_no_patch_dot/cubeb_8h__incl.png and html_dot/cubeb_8h__incl.png differ
diff html_no_patch_dot/cubeb_8h_source.html html_dot/cubeb_8h_source.html
8c8
< <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h Source File</title>
---
> <title>cubeb: include/cubeb/cubeb.h Source File</title>
diff html_no_patch_dot/dir_4a77ea686d101b1caa0240510cb36860.html html_dot/dir_4a77ea686d101b1caa0240510cb36860.html
8c8
< <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb Directory Reference</title>
---
> <title>cubeb: include/cubeb Directory Reference</title>
75c75
< <div class="center"><img src="dir_4a77ea686d101b1caa0240510cb36860_dep.png" border="0" usemap="#adir__4a77ea686d101b1caa0240510cb36860__dep" alt="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb"/></div>
---
> <div class="center"><img src="dir_4a77ea686d101b1caa0240510cb36860_dep.png" border="0" usemap="#adir__4a77ea686d101b1caa0240510cb36860__dep" alt="include/cubeb"/></div>
diff html_no_patch_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.map html_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.map
1c1
< <map id="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb" name="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb">
---
> <map id="include/cubeb" name="include/cubeb">
diff html_no_patch_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.md5 html_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.md5
1c1
< d2b3a541ded19d569e3456d07b13bfca
\ No newline at end of file
---
> ba94d8d8e5033c1685cddf5e6ffcb5a1
\ No newline at end of file
diff html_no_patch_dot/dir_d44c64559bbebec7f509842c48db8b23.html html_dot/dir_d44c64559bbebec7f509842c48db8b23.html
8c8
< <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include Directory Reference</title>
---
> <title>cubeb: include Directory Reference</title>
Common subdirectories: html_no_patch_dot/search and html_dot/search
diff html_no_patch_dot/structcubeb__device.html html_dot/structcubeb__device.html
90c90
< <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
---
> <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
diff html_no_patch_dot/structcubeb__device__collection.html html_dot/structcubeb__device__collection.html
100c100
< <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
---
> <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
diff html_no_patch_dot/structcubeb__device__info.html html_dot/structcubeb__device__info.html
147c147
< <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
---
> <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
diff html_no_patch_dot/structcubeb__stream__params.html html_dot/structcubeb__stream__params.html
167c167
< <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
---
> <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>

I had originally done this in mozilla#662, but never re-submitted it.
06aa271 reminded me that I should also
include Doxygen documentation in the Debian package, so I took a bit of
time to re-prepare this patch.

Using CMake's doxygen_add_docs() isn't only more concise and idiomatic,
it also solves actual issues of Doxygen-generated documentation. Without
this patch, the generated docs include an absolute path of the build
directory; apart from being ugly, it also creates issues with
reproducibility, as it is required to rebuild the package in the same
exact directory to get a bit-by-bit identical copy of the package.

CMake is able to work around this Doxygen quirk, and the generated HTML
only includes relative paths.

The documentation gets now output to build/html/ instead of
build/docs/html/.

As another minor change, I've also associated the installed docs to the
Documentation component, so that users can choose to install only them
with `cmake --install builddir --component Documentation`.

Here's a full diff of the generated output before and after applying
this patch:

    diff html_no_patch_dot/cubeb_8h.html html_dot/cubeb_8h.html
    8c8
    < <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h File Reference</title>
    ---
    > <title>cubeb: include/cubeb/cubeb.h File Reference</title>
    87,92c87,92
    < <div class="center"><img src="cubeb_8h__incl.png" border="0" usemap="#a_2tmp_2tmp_8ils_at_y7fk0_2up_2cubeb_2include_2cubeb_2cubeb_8h" alt=""/></div>
    < <map name="a_2tmp_2tmp_8ils_at_y7fk0_2up_2cubeb_2include_2cubeb_2cubeb_8h" id="a_2tmp_2tmp_8ils_at_y7fk0_2up_2cubeb_2include_2cubeb_2cubeb_8h">
    < <area shape="rect" title="The libcubeb C API." alt="" coords="99,5,277,61"/>
    < <area shape="rect" title=" " alt="" coords="5,109,128,136"/>
    < <area shape="rect" title=" " alt="" coords="153,109,223,136"/>
    < <area shape="rect" title=" " alt="" coords="247,109,318,136"/>
    ---
    > <div class="center"><img src="cubeb_8h__incl.png" border="0" usemap="#ainclude_2cubeb_2cubeb_8h" alt=""/></div>
    > <map name="ainclude_2cubeb_2cubeb_8h" id="ainclude_2cubeb_2cubeb_8h">
    > <area shape="rect" title="The libcubeb C API." alt="" coords="105,5,271,32"/>
    > <area shape="rect" title=" " alt="" coords="5,80,128,107"/>
    > <area shape="rect" title=" " alt="" coords="153,80,223,107"/>
    > <area shape="rect" title=" " alt="" coords="247,80,318,107"/>
    diff html_no_patch_dot/cubeb_8h__incl.map html_dot/cubeb_8h__incl.map
    1,5c1,5
    < <map id="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h" name="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h">
    < <area shape="rect" id="node1" title="The libcubeb C API." alt="" coords="99,5,277,61"/>
    < <area shape="rect" id="node2" title=" " alt="" coords="5,109,128,136"/>
    < <area shape="rect" id="node3" title=" " alt="" coords="153,109,223,136"/>
    < <area shape="rect" id="node4" title=" " alt="" coords="247,109,318,136"/>
    ---
    > <map id="include/cubeb/cubeb.h" name="include/cubeb/cubeb.h">
    > <area shape="rect" id="node1" title="The libcubeb C API." alt="" coords="105,5,271,32"/>
    > <area shape="rect" id="node2" title=" " alt="" coords="5,80,128,107"/>
    > <area shape="rect" id="node3" title=" " alt="" coords="153,80,223,107"/>
    > <area shape="rect" id="node4" title=" " alt="" coords="247,80,318,107"/>
    diff html_no_patch_dot/cubeb_8h__incl.md5 html_dot/cubeb_8h__incl.md5
    1c1
    < 80f3c1becd2984dea59dbcc5f43d8bc7
    \ No newline at end of file
    ---
    > bd73bf4d2f8603949fb7021f1b7e2758
    \ No newline at end of file
    Binary files html_no_patch_dot/cubeb_8h__incl.png and html_dot/cubeb_8h__incl.png differ
    diff html_no_patch_dot/cubeb_8h_source.html html_dot/cubeb_8h_source.html
    8c8
    < <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/cubeb.h Source File</title>
    ---
    > <title>cubeb: include/cubeb/cubeb.h Source File</title>
    diff html_no_patch_dot/dir_4a77ea686d101b1caa0240510cb36860.html html_dot/dir_4a77ea686d101b1caa0240510cb36860.html
    8c8
    < <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb Directory Reference</title>
    ---
    > <title>cubeb: include/cubeb Directory Reference</title>
    75c75
    < <div class="center"><img src="dir_4a77ea686d101b1caa0240510cb36860_dep.png" border="0" usemap="#adir__4a77ea686d101b1caa0240510cb36860__dep" alt="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb"/></div>
    ---
    > <div class="center"><img src="dir_4a77ea686d101b1caa0240510cb36860_dep.png" border="0" usemap="#adir__4a77ea686d101b1caa0240510cb36860__dep" alt="include/cubeb"/></div>
    diff html_no_patch_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.map html_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.map
    1c1
    < <map id="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb" name="/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb">
    ---
    > <map id="include/cubeb" name="include/cubeb">
    diff html_no_patch_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.md5 html_dot/dir_4a77ea686d101b1caa0240510cb36860_dep.md5
    1c1
    < d2b3a541ded19d569e3456d07b13bfca
    \ No newline at end of file
    ---
    > ba94d8d8e5033c1685cddf5e6ffcb5a1
    \ No newline at end of file
    diff html_no_patch_dot/dir_d44c64559bbebec7f509842c48db8b23.html html_dot/dir_d44c64559bbebec7f509842c48db8b23.html
    8c8
    < <title>cubeb: /tmp/tmp.ilsAtY7fk0/up/cubeb/include Directory Reference</title>
    ---
    > <title>cubeb: include Directory Reference</title>
    Common subdirectories: html_no_patch_dot/search and html_dot/search
    diff html_no_patch_dot/structcubeb__device.html html_dot/structcubeb__device.html
    90c90
    < <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
    ---
    > <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
    diff html_no_patch_dot/structcubeb__device__collection.html html_dot/structcubeb__device__collection.html
    100c100
    < <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
    ---
    > <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
    diff html_no_patch_dot/structcubeb__device__info.html html_dot/structcubeb__device__info.html
    147c147
    < <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
    ---
    > <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
    diff html_no_patch_dot/structcubeb__stream__params.html html_dot/structcubeb__stream__params.html
    167c167
    < <li>/tmp/tmp.ilsAtY7fk0/up/cubeb/include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
    ---
    > <li>include/cubeb/<a class="el" href="cubeb_8h_source.html">cubeb.h</a></li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant