@@ -15,39 +15,60 @@ if(DOXYGEN_FOUND)
15
15
)
16
16
endif ()
17
17
18
- if (LLVM_ENABLE_SPHINX )
19
- include (AddSphinxTarget )
20
- endif ()
18
+ if (LLDB_ENABLE_PYTHON )
19
+ find_program (EPYDOC_EXECUTABLE NAMES epydoc epydoc.py )
20
+ if (EPYDOC_EXECUTABLE )
21
+ message (STATUS "Found epydoc - ${EPYDOC_EXECUTABLE} " )
22
+
23
+ find_program (DOT_EXECUTABLE dot )
24
+ if (DOT_EXECUTABLE )
25
+ set (EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE} )
26
+ message (STATUS "Found dot - ${DOT_EXECUTABLE} " )
27
+ endif ()
21
28
22
- if ( LLDB_ENABLE_PYTHON AND SPHINX_FOUND )
23
- if ( ${SPHINX_OUTPUT_HTML} )
24
- # Pretend that the SWIG generated API is a Python package .
29
+ # Pretend to make a python package so that we can generate the reference.
30
+ # Because we don't build liblldb, epydoc will complain that the import of
31
+ # _lldb.so failed, but that doesn't prevent it from generating the docs .
25
32
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /lldb )
26
33
get_target_property (lldb_bindings_dir swig_wrapper_python BINARY_DIR )
27
34
add_custom_target (lldb-python-doc-package
28
35
COMMAND "${CMAKE_COMMAND} " -E copy "${lldb_bindings_dir} /lldb.py" "${CMAKE_CURRENT_BINARY_DIR} /lldb/__init__.py"
29
- COMMENT "Copying lldb.py to pretend its a Python package." )
36
+ COMMENT "Copying lldb.py to pretend package." )
30
37
add_dependencies (lldb-python-doc-package swig_wrapper_python )
31
38
32
- # FIXME: Don't treat Sphinx warnings as errors. The files generated by
33
- # automodapi are full of warnings (partly caused by SWIG, our documentation
34
- # and probably also automodapi itself), so those warnings need to be fixed
35
- # first before we can turn this on.
36
- set ( SPHINX_WARNINGS_AS_ERRORS Off )
37
-
38
- # The sphinx config needs to know where the generated LLDB Python module is.
39
- # There is no way to pass a variable into our sphinx config, so just pass
40
- # the path to the module via the LLDB_SWIG_MODULE environment variable.
41
- add_sphinx_target ( html lldb ENV_VARS "LLDB_SWIG_MODULE= ${CMAKE_CURRENT_BINARY_DIR} " )
42
- # Sphinx does not reliably update the custom CSS files, so force
43
- # a clean rebuild of the documentation every time.
44
- add_custom_target ( clean-lldb-html COMMAND " ${CMAKE_COMMAND} " -E
45
- remove_directory ${CMAKE_CURRENT_BINARY_DIR} /html )
46
- add_dependencies ( docs-lldb-html swig_wrapper_python
47
- lldb-python-doc-package clean-lldb-html )
39
+ set ( DOC_DIR " ${CMAKE_CURRENT_SOURCE_DIR} /doc" )
40
+ file ( MAKE_DIRECTORY " ${DOC_DIR} " )
41
+ add_custom_target ( lldb-python-doc
42
+ ${EPYDOC_EXECUTABLE}
43
+ --html
44
+ lldb
45
+ -o ${CMAKE_CURRENT_BINARY_DIR} /python_reference
46
+ --name "LLDB python API"
47
+ --url "http://lldb.llvm.org"
48
+ ${EPYDOC_OPTIONS}
49
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
50
+ COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
51
+ )
52
+ add_dependencies ( lldb-python-doc swig_wrapper_python lldb-python-doc-package )
53
+ else ()
54
+ message ( STATUS "Could NOT find epydoc" )
48
55
endif ()
56
+ endif ()
57
+
58
+ if (LLVM_ENABLE_SPHINX )
59
+ include (AddSphinxTarget )
60
+ if (SPHINX_FOUND )
61
+ if (${SPHINX_OUTPUT_HTML} )
62
+ add_sphinx_target (html lldb )
63
+ # Sphinx does not reliably update the custom CSS files, so force
64
+ # a clean rebuild of the documentation every time.
65
+ add_custom_target (clean-lldb-html COMMAND "${CMAKE_COMMAND} " -E
66
+ remove_directory ${CMAKE_CURRENT_BINARY_DIR} /html )
67
+ add_dependencies (docs-lldb-html clean-lldb-html )
68
+ endif ()
49
69
50
- if (${SPHINX_OUTPUT_MAN} )
51
- add_sphinx_target (man lldb )
70
+ if (${SPHINX_OUTPUT_MAN} )
71
+ add_sphinx_target (man lldb )
72
+ endif ()
52
73
endif ()
53
74
endif ()
0 commit comments