Skip to content

Commit

Permalink
Setup C++ docs using doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitan94 committed Jun 13, 2020
1 parent 6fc741e commit 9a86fa6
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ $ python test.py
If everything is working okay, you should see "All tests passed".

## Building docs
### Python
### Python (Sphinx)

```sh
$ pip install sphinx sphinx_rtd_theme numpy numpydoc
Expand All @@ -166,6 +166,17 @@ You can then proceed to host the docs locally, for example on https://0.0.0.0:800
```sh
$ python -m http.server --directory documentation/python/_build/html
```
### C++ (Doxygen)

```sh
$ cmake -B build/docs -S documentation
$ cmake --build build/docs
$ cmake --build build/docs --target cppdocs
```
You can then proceed to host the docs locally, for example on https://0.0.0.0:8000/
```sh
$ python -m http.server --directory build/docs/doxygen/html
```

## Contributing

Expand Down
31 changes: 30 additions & 1 deletion documentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,23 @@ get_filename_component(DAYLIGHT_ROOT ../ ABSOLUTE)

include("${DAYLIGHT_ROOT}/cmake/CPM.cmake")

CPMAddPackage(
NAME libdaylight
SOURCE_DIR "${DAYLIGHT_ROOT}"
)

CPMAddPackage(
NAME daylight
SOURCE_DIR "${DAYLIGHT_ROOT}/pybind"
)

# ---- Setup targets ----
CPMAddPackage(
NAME StableCoder-cmake-scripts
GITHUB_REPOSITORY StableCoder/cmake-scripts
GIT_TAG 3d2d5a9fb26f0ce24e3e4eaeeff686ec2ecfb3fb
)

# ---- Setup targets for python docs ----

set(PYTHONPATH "${DAYLIGHT_ROOT}" "${CMAKE_BINARY_DIR}/_deps/daylight-build")

Expand All @@ -36,3 +47,21 @@ add_custom_target(
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/python"
)
add_dependencies(pydoctest daylight)

# ---- Doxygen ----

set(BUILD_DOCUMENTATION ON CACHE INTERNAL "")
include(${StableCoder-cmake-scripts_SOURCE_DIR}/doxygen.cmake)

# set Doxyfile variables
set(DOXYGEN_PROJECT_NAME daylight)
set(DOXYGEN_PROJECT_VERSION ${daylight_VERSION})
set(DOXYGEN_PROJECT_ROOT "${DAYLIGHT_ROOT}")

# see https://github.com/StableCoder/cmake-scripts#doxygen-doxygencmake for additional options
build_docs(
TARGET_NAME cppdocs
DOXYFILE_PATH ${CMAKE_CURRENT_LIST_DIR}/cpp/Doxyfile
OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen
PROCESS_DOXYFILE ON
)
25 changes: 25 additions & 0 deletions documentation/cpp/Doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Configuration for Doxygen for use with CMake
# Only options that deviate from the default are included
# To create a new Doxyfile containing all available options, call `doxygen -g`

# Get Project name and version from CMake
PROJECT_NAME = @DOXYGEN_PROJECT_NAME@
PROJECT_NUMBER = @DOXYGEN_PROJECT_VERSION@

# Add sources
INPUT = @DOXYGEN_PROJECT_ROOT@/README.md @DOXYGEN_PROJECT_ROOT@/include @DOXYGEN_PROJECT_ROOT@/source
EXTRACT_ALL = YES
RECURSIVE = YES

# We don't want local paths in the documentation
FULL_PATH_NAMES = NO

# Use the README as a main page
USE_MDFILE_AS_MAINPAGE = @DOXYGEN_PROJECT_ROOT@/README.md

# Create nicer looking HTML
HTML_DYNAMIC_SECTIONS = YES
GENERATE_TREEVIEW = YES

# We don't need LaTeX generation
GENERATE_LATEX = NO

0 comments on commit 9a86fa6

Please sign in to comment.