1 ###############################################################################
2 # Top contributors (to current version):
5 # This file is part of the cvc5 project.
7 # Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8 # in the top-level source directory and their institutional affiliations.
9 # All rights reserved. See the file COPYING in the top-level source
10 # directory for licensing information.
11 # #############################################################################
13 # The build system configuration.
15 find_package(Sphinx REQUIRED)
16 check_python_module(breathe)
17 check_python_module(sphinxcontrib.bibtex sphinxcontrib-bibtex)
18 check_python_module(sphinx_tabs.tabs sphinx-tabs)
22 set(SPHINX_INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
23 set(SPHINX_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
25 configure_file(conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
29 DEPENDS docs-cpp docs-java docs-python gen-options
31 ${SPHINX_EXECUTABLE} -b html -c ${CMAKE_CURRENT_BINARY_DIR}
32 # Tell Breathe where to find the Doxygen output
33 -Dbreathe_projects.cvc5=${CPP_DOXYGEN_XML_DIR}
34 -Dbreathe_projects.std=${CPP_DOXYGEN_XML_DIR} ${SPHINX_INPUT_DIR}
36 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
37 COMMENT "Generating Sphinx Api docs"
44 ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Preview docs in browser: file://localhost${SPHINX_OUTPUT_DIR}/index.html"
47 set(SPHINX_GH_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx-gh)
51 # remove existing sphinx-gh/ directory
52 COMMAND ${CMAKE_COMMAND} -E remove_directory ${SPHINX_GH_OUTPUT_DIR}
53 # copy sphinx/ to sphinx-gh/
54 COMMAND ${CMAKE_COMMAND} -E copy_directory ${SPHINX_OUTPUT_DIR}
55 ${SPHINX_GH_OUTPUT_DIR}
56 # remove leftovers from the build
57 COMMAND ${CMAKE_COMMAND} -E remove_directory ${SPHINX_GH_OUTPUT_DIR}/.doctrees
58 ${SPHINX_GH_OUTPUT_DIR}/_sources ${SPHINX_GH_OUTPUT_DIR}/_static/fonts
59 COMMAND ${CMAKE_COMMAND} -E remove ${SPHINX_GH_OUTPUT_DIR}/objects.inv
60 # rename _static/ to static/ (as jekyll ignores _*/ dirs)
61 COMMAND ${CMAKE_COMMAND} -E rename ${SPHINX_GH_OUTPUT_DIR}/_static
62 ${SPHINX_GH_OUTPUT_DIR}/static
63 COMMAND find ${SPHINX_GH_OUTPUT_DIR} -type f | xargs sed -i'orig'
65 COMMAND find ${SPHINX_GH_OUTPUT_DIR} -name '*orig' -delete
67 COMMENT "Generating GitHub Api docs"