-
Notifications
You must be signed in to change notification settings - Fork 0
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 doxygen and sphinx (read-the-docs style) docs using cmake -D{project}_BUILD_DOCUMENTATION #14
base: main
Are you sure you want to change the base?
Changes from 8 commits
91d6c12
fcce572
18d90c7
037ab99
03d69ea
2dfdc41
efa8bf2
1d4f850
d85a22c
2d91528
c567304
d0d77c2
eadd8fc
8e09d98
c6f8dd7
c05b9b4
42c341a
4fa9d1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Doxygen Consistency Check | ||
on: [push, pull_request] | ||
jobs: | ||
doxygen-completeness-check: | ||
name: Doxygen completeness check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run doxygen for C++ programs. | ||
uses: mattnotmitt/[email protected] | ||
with: | ||
working-directory: '.' | ||
doxyfile-path: 'doxygen.cfg' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#Look for an executable called sphinx-build | ||
find_program(SPHINX_EXECUTABLE | ||
NAMES sphinx-build | ||
DOC "Path to sphinx-build executable") | ||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
#Handle standard arguments to find_package like REQUIRED and QUIET | ||
find_package_handle_standard_args(Sphinx | ||
"Failed to find sphinx-build executable" | ||
SPHINX_EXECUTABLE) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
find_package(Doxygen REQUIRED) | ||
|
||
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) | ||
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) | ||
|
||
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}) | ||
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen) | ||
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/html/index.html) | ||
file(GLOB_RECURSE project_public_headers ${DOXYGEN_INPUT_DIR}/*.h) | ||
|
||
# Replace variables inside @@ with the current values | ||
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) | ||
|
||
file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) # Doxygen won't create this for us | ||
|
||
add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE} | ||
DEPENDS ${project_public_headers} | ||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT} | ||
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN} | ||
COMMENT "Generating docs") | ||
|
||
add_custom_target(Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This target name needs to be project-specific (otherwise it will conflict with submodules that also create a doxygen target). |
||
|
||
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/sphinx-source) | ||
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/sphinx) | ||
set(SPHINX_PROGRAM "sphinx-build") | ||
|
||
# The poetry (dependency) installation is performed below as part of the target's command sequence. | ||
# The order of operations is important: 1. Install sphinx/breathe as part of the project's dependencies | ||
# 2. Find or assert the path to sphinx, 3. Run sphinx/breathe | ||
# Note that "poetry run" during CMake's build phase does not activate an environment installed | ||
# during CMake's configuration phase! | ||
|
||
add_custom_target(Sphinx ALL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs project-specific target name (see previous comment). |
||
COMMAND poetry install | ||
COMMAND poetry run ${SPHINX_PROGRAM} -b html | ||
-Dbreathe_projects.${PROJECT_NAME}=${DOXYGEN_OUTPUT_DIR}/xml | ||
${SPHINX_SOURCE} ${SPHINX_BUILD} | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
COMMENT "Generating documentation with Sphinx") |
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.
Is this file ever used? It doesn't look like it.
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.
No, it isn't. I'll remove it if you're content with the "hard-coded" sphinx exe name.
Originally, I would have liked to install the sphinx dependency with poetry during the configuration phase, then call FindSphinx.cmake to grab the executable's name, then use that in the target command. Alas, such a workflow doesn't run.