1include(FindDoxygen) 2 3if(DOXYGEN_FOUND) 4 set(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}/..) 5 set(DOT dot) 6 set(PACKAGE_VERSION mainline) 7 set(abs_top_builddir ..) 8 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in 9 ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY) 10 11 add_custom_target(lldb-cpp-doc 12 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg 13 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 14 COMMENT "Generating LLDB C++ API reference with Doxygen" VERBATIM 15 ) 16endif() 17 18if (LLVM_ENABLE_SPHINX) 19 include(AddSphinxTarget) 20endif() 21 22if (LLDB_ENABLE_PYTHON AND SPHINX_FOUND) 23 if (${SPHINX_OUTPUT_HTML}) 24 # Pretend that the SWIG generated API is a Python package. 25 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb) 26 get_target_property(lldb_bindings_dir swig_wrapper_python BINARY_DIR) 27 add_custom_target(lldb-python-doc-package 28 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.") 30 add_dependencies(lldb-python-doc-package swig_wrapper_python) 31 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) 48 endif() 49 50 if (${SPHINX_OUTPUT_MAN}) 51 add_sphinx_target(man lldb) 52 endif() 53endif() 54