Eliminating static calls to rewriter from strings (#7302)
[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
20 add_subdirectory(api)
21
22 set(SPHINX_INPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
23 set(SPHINX_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx)
24
25 configure_file(conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
26
27 add_custom_target(
28 docs ALL
29 DEPENDS docs-cpp docs-java docs-python gen-options
30 COMMAND
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}
35 ${SPHINX_OUTPUT_DIR}
36 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
37 COMMENT "Generating Sphinx Api docs"
38 )
39
40 add_custom_command(
41 TARGET docs
42 POST_BUILD
43 COMMAND
44 ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Preview docs in browser: file://localhost${SPHINX_OUTPUT_DIR}/index.html"
45 )
46
47 set(SPHINX_GH_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/sphinx-gh)
48 add_custom_target(
49 docs-gh ALL
50 DEPENDS docs
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'
64 's/_static/static/'
65 COMMAND find ${SPHINX_GH_OUTPUT_DIR} -name '*orig' -delete
66 # done
67 COMMENT "Generating GitHub Api docs"
68 )