aboutsummaryrefslogtreecommitdiff
path: root/doc/api/python/CMakeLists.txt
blob: 7652c1c0c77a6385b1e8a86b152b3d6706961569 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
if(ENABLE_PYTHON_DOCS)
  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
                 "${CMAKE_CURRENT_BINARY_DIR}/conf.py"
                 @ONLY)

  set(PYTHON_EXAMPLES
      "${CMAKE_CURRENT_SOURCE_DIR}/example_about.py"
      "${CMAKE_CURRENT_SOURCE_DIR}/example_command_line.py"
      "${CMAKE_CURRENT_SOURCE_DIR}/example_version_spec.py")

  set(RST_DOCS
      "${CMAKE_CURRENT_SOURCE_DIR}/example_about.rst"
      "${CMAKE_CURRENT_SOURCE_DIR}/example_command_line.rst"
      "${CMAKE_CURRENT_SOURCE_DIR}/example_version_spec.rst"
      "${CMAKE_CURRENT_SOURCE_DIR}/index.rst"
      "${CMAKE_CURRENT_SOURCE_DIR}/paludis.rst")

  add_custom_command(COMMAND
                       env PYTHONPATH="${CMAKE_BINARY_DIR}/python"
                       "${PYTHON_EXECUTABLE}" "${SPHINX_EXECUTABLE}"
                         -c "${CMAKE_CURRENT_BINARY_DIR}"
                         -b html
                         -d "${CMAKE_CURRENT_BINARY_DIR}/doctrees"
                         "${CMAKE_CURRENT_SOURCE_DIR}"
                         "${CMAKE_CURRENT_BINARY_DIR}/python"
                     OUTPUT
                       "${CMAKE_CURRENT_BINARY_DIR}/python"
                     DEPENDS
                       "${CMAKE_CURRENT_BINARY_DIR}/conf.py"
                       paludis
                       ${PYTHON_EXAMPLES}
                       ${RST_DOCS})
  add_custom_target(python-api-docs
                    ALL
                    DEPENDS
                      "${CMAKE_CURRENT_BINARY_DIR}/python")

  install(DIRECTORY
            "${CMAKE_CURRENT_BINARY_DIR}/python"
          DESTINATION
            "${CMAKE_INSTALL_FULL_HTMLDIR}/api")
endif()