-
-
Notifications
You must be signed in to change notification settings - Fork 440
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: add doc target #384
Conversation
Hi and thanks for the PR! There's a few problems that I see with letting CMake generate this:
|
That's true, and I find it quite annoying too. I'd personally make Doxygen quieter instead of adding a new build option, as I don't see why you wouldn't want to generate documentation if Doxygen is found on the host, and also because if you really want to you can already tell CMake to treat Doxygen as not found with
When looking at I could write a little CMake script to tell CMake to import the options from the Doxyfile; does this sound reasonable to you? Edit: done, the options are now read from the Doxyfile; here's the updated commit message: Using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
# Read Doxygen options from the Doxyfile and set them as CMake variables | ||
# to accomodate doxygen_add_docs() | ||
file(READ "Doxyfile" DOXYFILE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this temporary variable DOXYFILE
is upper-cased whereas later locals are lower-cased -- is there a reason for this?
This patch adds a doc target generating Doxygen documentation similarly to <zyantific/zycore-c#51>, but with some extra bits: if doxygen-awesome.css is found on the host system, CMake will automatically use it to generate themed documentation. Using `doxygen_add_docs()` requires setting the various Doxygen options in CMakeLists.txt, so to avoid duplicating things in different places I wrote a bit of CMake code that parses the Doxyfile and sets the various options as CMake variables prefixed by DOXYGEN_. The "parser" is really basic, and does not handle values that span over multiple lines.
This patch tweaks the Makefile a bit to make it use the new doc target. A new `configure` target was added, that simply runs `cmake -B build_dir`, so that `make doc` doesn't require building the full project. I've also made a few minor changes like using `cmake --build` and `cmake --install` instead of plain `make`, as they lead to more concise commands and also make switching build backend easier (e.g. you simply need to add `-G Ninja` to the `configure` target, without having to replace all the `make` calls to `ninja` ones). Another fix was changing `&> /dev/null` to `> /dev/null`, as they broke the if statement on my system, and also because POSIX mandates that `command -v` should print to stdout on success, and shouldn't print anything on error (i.e. no stderr is involved).
Il giorno dom 2 ott 2022 alle 11:21:38 -07:00:00, Joel Höner
***@***.***> ha scritto:
There appears to be an issue with the README.md being picked up,
though. The index.html page is blank for me when documentation is
built on your branch.
Thanks for noticing this, I somehow forgot to check that the parser
actually worked 😅️
The issue was caused by the fact that option_name contained trailing
whitespace, and is now fixed. As for the reason why option, option_name
and option_value are lowercase that's because they are only used as
temporary variables inside the loop, and are not result variables
(unlike DOC_PATHS, for examples). This seems to be a CMake convention
I've seen a few times in Find Modules.
…--
OpenPGP key: 66DE F152 8299 0C21 99EF A801 A8A1 28A8 AB1C EE49
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! :)
Thanks to you for being so collaborative :D
|
Here are the two commit messages:
This patch adds a doc target generating Doxygen documentation similarly to build: add doc target zycore-c#51, but with some extra bits: if doxygen-awesome.css is found on the host system, CMake will automatically use it to generate themed documentation.
Using
doxygen_add_docs()
requires setting the various Doxygen options in CMakeLists.txt, so there's currently a bit of duplication as the same options are also contained in Doxyfile and Doxyfile-themed. I couldn't remove the two standalone files as they are still required by the doc.yml CI/CD pipeline, aszydoc
runs Doxygen itself; as a solution,zydoc
could add support for a--doxygen-generated <path>
flag that tells it to use already generated Doxygen documentation instead of generating its own.This patch tweaks the Makefile a bit to make it use the new doc target.
A new
configure
target was added, that simply runscmake -B build_dir
, so thatmake doc
doesn't require building the full project.I've also made a few minor changes like using
cmake --build
andcmake --install
instead of plainmake
, as they lead to more concise commands and also make switching build backend easier (e.g. you simply need to add-G Ninja
to theconfigure
target, without having to replace all themake
calls toninja
ones).Another fix was changing
&> /dev/null
to> /dev/null
, as they broke the if statement on my system, and also because POSIX mandates thatcommand -v
should print to stdout on success, and shouldn't print anything on error (i.e. no stderr is involved).