[Lldb-commits] [PATCH] D61216: [Docs] Make it possible to generate the python reference without building all of LLDB

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 29 09:27:41 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359465: [Docs] Generate the python reference without building all of LLDB (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61216?vs=196926&id=197130#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61216/new/

https://reviews.llvm.org/D61216

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/docs/CMakeLists.txt


Index: lldb/trunk/CMakeLists.txt
===================================================================
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -30,12 +30,12 @@
   add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
 endif()
 
-add_subdirectory(docs)
 if (NOT LLDB_DISABLE_PYTHON)
   add_subdirectory(scripts)
 endif ()
 add_subdirectory(source)
 add_subdirectory(tools)
+add_subdirectory(docs)
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
 option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
Index: lldb/trunk/docs/CMakeLists.txt
===================================================================
--- lldb/trunk/docs/CMakeLists.txt
+++ lldb/trunk/docs/CMakeLists.txt
@@ -13,31 +13,46 @@
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     COMMENT "Generating LLDB C++ API reference with Doxygen" VERBATIM
   )
-endif(DOXYGEN_FOUND)
+endif()
 
-find_package(PythonInterp REQUIRED)
 find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py)
 if(EPYDOC_EXECUTABLE)
+  message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}")
+
   find_program(DOT_EXECUTABLE dot)
-    if(DOT_EXECUTABLE)
-      set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE})
-    endif()
-    set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
-    file(MAKE_DIRECTORY "${DOC_DIR}")
-    #set(ENV{PYTHONPATH} ${CMAKE_CURRENT_BINARY_DIR}/../../../lib/python2.7/site-packages)
-    add_custom_target(lldb-python-doc
-      ${EPYDOC_EXECUTABLE}
-      --html
-      lldb
-      -o ${CMAKE_CURRENT_BINARY_DIR}/python_reference
-      --name "LLDB python API"
-      --url "http://lldb.llvm.org"
-      ${EPYDOC_OPTIONS}
-      DEPENDS swig_wrapper liblldb
-      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../../../lib${LLVM_LIBDIR_SUFFIX}/python2.7/site-packages
-      COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
-    )
-endif(EPYDOC_EXECUTABLE)
+  if(DOT_EXECUTABLE)
+    set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE})
+    message(STATUS "Found dot - ${DOT_EXECUTABLE}")
+  endif()
+
+  # Pretend to make a python package so that we can generate the reference.
+  # Because we don't build liblldb, epydoc will complain that the import of
+  # _lldb.so failed, but that doesn't prevent it from generating the docs.
+  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb)
+  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
+  add_custom_target(lldb-python-doc-package
+    COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_scripts_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
+    DEPENDS swig_wrapper
+    COMMENT "Copying lldb.py to pretend package.")
+
+  set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
+  file(MAKE_DIRECTORY "${DOC_DIR}")
+  add_custom_target(lldb-python-doc
+    ${EPYDOC_EXECUTABLE}
+    --html
+    lldb
+    -o ${CMAKE_CURRENT_BINARY_DIR}/python_reference
+    --name "LLDB python API"
+    --url "http://lldb.llvm.org"
+    ${EPYDOC_OPTIONS}
+    DEPENDS swig_wrapper
+    DEPENDS lldb-python-doc-package
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
+  )
+else()
+  message(STATUS "Could NOT find epydoc")
+endif()
 
 if (LLVM_ENABLE_SPHINX)
   include(AddSphinxTarget)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61216.197130.patch
Type: text/x-patch
Size: 3452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190429/2c2ea79b/attachment-0001.bin>


More information about the lldb-commits mailing list