summaryrefslogtreecommitdiffstats
path: root/docs/CMakeLists.txt
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-03-11 13:29:57 +0100
committerMichal Cmarada <mcmarada@cisco.com>2019-03-15 10:07:11 +0100
commita9aacd4d48c3a5887267366c2ef643e953975792 (patch)
treec90c7c41eb77f8679cbcd85d66e7dde0067570ab /docs/CMakeLists.txt
parentf8e326876496ddcdaaa2525596c30aad820b69f4 (diff)
add documentation generator
Enables generating of HTML documentation. It depends on sphinx generator. During configuration if sphinx is detected it will generate "docs" target for make. To build the documentation use "make docs", which will build the HTML documentation in build-root/html. Change-Id: Ia627f7d26c954a2341e13a54006955d21d162802 Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'docs/CMakeLists.txt')
-rw-r--r--docs/CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
new file mode 100644
index 0000000..a03333e
--- /dev/null
+++ b/docs/CMakeLists.txt
@@ -0,0 +1,34 @@
+find_package(Sphinx REQUIRED)
+
+if(SPHINX_FOUND)
+ if(NOT DEFINED SPHINX_THEME)
+ set(SPHINX_THEME default)
+ endif()
+
+ if(NOT DEFINED SPHINX_THEME_DIR)
+ set(SPHINX_THEME_DIR)
+ endif()
+
+ # configured documentation tools and intermediate build results
+ set(BINARY_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")
+
+ # Sphinx cache with pickled ReST documents
+ set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
+
+ # HTML output directory
+ set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/../build-root/html")
+
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
+ "${BINARY_BUILD_DIR}/conf.py"
+ @ONLY)
+
+ add_custom_target(docs
+ ${SPHINX_EXECUTABLE}
+ -q -b html
+ -c "${BINARY_BUILD_DIR}"
+ -d "${SPHINX_CACHE_DIR}"
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${SPHINX_HTML_DIR}"
+ COMMENT "Building HTML documentation with Sphinx")
+endif()