Skip to content

Commit

Permalink
docs: update for in-module or in-root sphinx docs
Browse files Browse the repository at this point in the history
  • Loading branch information
abdes committed Apr 17, 2023
1 parent 53e34e2 commit d2c0fe4
Showing 1 changed file with 37 additions and 45 deletions.
82 changes: 37 additions & 45 deletions doc/project-development/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,48 +206,40 @@ Adding documentation to a module
Documentation comes in two forms: `doxygen` API documentation and `sphinx`
documentation. The former is embedded in the source code files, while the latter
is written in its own separate files placed in a ```doc``` subdirectory under
the module root.

1. The contents of the `doc` directory can be started by copying some of the
files from another existing module. In particular, the ```conf.py.in``` file,
can be copied from an existing module and used without modification.

The module's `CMakeLists.txt` should then be modified to add the targets for
`doxygen` and `sphinx` documentation build as appropriate.

.. code-block:: CMake
# --------------------------------------------
# API Documentation
# --------------------------------------------
asap_with_doxygen(
MODULE_NAME
${MODULE_TARGET_NAME}
VERSION
${META_MODULE_VERSION}
TITLE
"\"MyApp Module\""
BRIEF
"\"Provides some stuff for MyApp.\""
INPUT_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include")
asap_with_sphinx(${MODULE_TARGET_NAME})
2. Add target dependencies from the master sphinx documentation target to the
module's sphinx documentation target. This step is only required if you have
added a module sphinx documentation target.

.. code-block:: CMake
add_dependencies(master_sphinx
copy_doc_index
# Hardcode `asap` in the module name as we do not want this prefix to
# change with the forked project name.
asap_common_sphinx
asap_logging_sphinx
# Add more submodule documentation targets after this, using variables
# in the target names consistently with the module's CMakeLists.txt.
myapp
)
the module root or in a sub-directory under the root ```doc``` directory.

The module's `CMakeLists.txt` should be modified to add the targets for
`doxygen` as appropriate. .. code-block:: CMake

.. code-block:: CMake
asap_with_doxygen(
MODULE_NAME
${MODULE_TARGET_NAME}
VERSION
${META_MODULE_VERSION}
TITLE
"\"MyApp Module\""
BRIEF
"\"Provides some stuff for MyApp.\""
INPUT_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include")
For sphinx documentation, the recommended approach is to have all documentation
reside within the root ```doc``` directory in order to be able to have one
single configuration file and most importantly in order to make most IDEs happy
and generate previews.

The contents of the `doc` directory can be started by copying some of the files
from another existing module. In particular, the ```conf.py.in``` file, can be
copied from an existing module and used without modification.

If the module documentation is preferred to be inside the module itself, then a
separate sphinx project is required. The module's `CMakeLists.txt` should then
be modified to add the targets for `doxygen` and `sphinx` documentation build as
appropriate. The module's `CMakeLists.txt` should then be modified to add the targets for
`sphinx` as appropriate.

.. code-block:: CMake
asap_with_sphinx(${MODULE_TARGET_NAME})

0 comments on commit d2c0fe4

Please sign in to comment.