Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # SPDX-License-Identifier: BSD-3-Clause |
| 3 | # SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 4 | # |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | add_custom_target(docs) |
| 9 | |
| 10 | find_package(Python3) |
| 11 | find_package(Sphinx) |
Arunachalam Ganapathy | f1a13aa | 2022-11-11 15:07:12 +0000 | [diff] [blame] | 12 | find_package(Git) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 13 | |
| 14 | set(SPHINXCFG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/user_guide) |
| 15 | |
Arunachalam Ganapathy | 484843f | 2022-11-30 14:39:45 +0000 | [diff] [blame] | 16 | if (SPHINX_FOUND AND GIT_FOUND) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 17 | |
Arunachalam Ganapathy | f1a13aa | 2022-11-11 15:07:12 +0000 | [diff] [blame] | 18 | file(GLOB_RECURSE SPHINXCFG_DOC_FILES ${CMAKE_CURRENT_SOURCE_DIR} *.rst conf.py) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 19 | |
| 20 | add_custom_command(OUTPUT "${SPHINXCFG_OUTPUT_PATH}/html/index.html" |
| 21 | OUTPUT "${SPHINXCFG_OUTPUT_PATH}/html/" |
Arunachalam Ganapathy | f1a13aa | 2022-11-11 15:07:12 +0000 | [diff] [blame] | 22 | COMMAND "${SPHINX_EXECUTABLE}" -W -b html "${CMAKE_CURRENT_SOURCE_DIR}" "${SPHINXCFG_OUTPUT_PATH}/html" |
| 23 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/docs" |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 24 | DEPENDS ${SPHINXCFG_DOC_FILES} |
| 25 | ) |
| 26 | add_custom_target(rmm_docs_userguide_html |
| 27 | DEPENDS "${SPHINXCFG_OUTPUT_PATH}/html/index.html" |
| 28 | DEPENDS "${SPHINXCFG_OUTPUT_PATH}/html/" |
| 29 | ) |
| 30 | add_dependencies(docs rmm_docs_userguide_html) |
| 31 | endif() |