Make witness form visited ref counted (#8081)
[cvc5.git] / docs / CMakeLists.txt
1 ###############################################################################
2 # Top contributors (to current version):
3 # Aina Niemetz
4 #
5 # This file is part of the cvc5 project.
6 #
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 # #############################################################################
12 #
13 # The build system configuration.
14 ##
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)
19 check_python_module(sphinxcontrib.programoutput sphinxcontrib.programoutput)
20
21 add_subdirectory(api)
22
23 set(SPHINX_INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
24 set(SPHINX_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
25
26 configure_file(conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
27
28 add_custom_target(
29 docs
30 DEPENDS docs-cpp docs-java docs-python gen-options cvc5-bin
31 COMMAND
32 ${SPHINX_EXECUTABLE} -v -b html -c ${CMAKE_CURRENT_BINARY_DIR}
33 # Tell Breathe where to find the Doxygen output
34 -Dbreathe_projects.cvc5=${CPP_DOXYGEN_XML_DIR}
35 -Dbreathe_projects.std=${CPP_DOXYGEN_XML_DIR} ${SPHINX_INPUT_DIR}
36 ${SPHINX_OUTPUT_DIR}
37 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
38 COMMENT "Generating Sphinx Api docs"
39 )
40
41 add_custom_command(
42 TARGET docs
43 POST_BUILD
44 COMMAND
45 ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Preview docs in browser: file://localhost${SPHINX_OUTPUT_DIR}/index.html"
46 )
47
48 set(SPHINX_GH_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx-gh)
49 add_custom_target(
50 docs-gh
51 DEPENDS docs
52 # remove existing sphinx-gh/ directory
53 COMMAND ${CMAKE_COMMAND} -E remove_directory ${SPHINX_GH_OUTPUT_DIR}
54 # copy sphinx/ to sphinx-gh/
55 COMMAND ${CMAKE_COMMAND} -E copy_directory ${SPHINX_OUTPUT_DIR}
56 ${SPHINX_GH_OUTPUT_DIR}
57 # remove leftovers from the build
58 COMMAND ${CMAKE_COMMAND} -E remove_directory ${SPHINX_GH_OUTPUT_DIR}/.doctrees
59 ${SPHINX_GH_OUTPUT_DIR}/_sources ${SPHINX_GH_OUTPUT_DIR}/_static/fonts
60 COMMAND ${CMAKE_COMMAND} -E remove ${SPHINX_GH_OUTPUT_DIR}/objects.inv
61 # rename _static/ to static/ (as jekyll ignores _*/ dirs)
62 COMMAND ${CMAKE_COMMAND} -E rename ${SPHINX_GH_OUTPUT_DIR}/_static
63 ${SPHINX_GH_OUTPUT_DIR}/static
64 COMMAND find ${SPHINX_GH_OUTPUT_DIR} -type f | xargs sed -i'orig'
65 's/_static/static/'
66 COMMAND find ${SPHINX_GH_OUTPUT_DIR} -name '*orig' -delete
67 # done
68 COMMENT "Generating GitHub Api docs"
69 )