[Lldb-commits] [PATCH] D69931: Add cmake variables to specify a python framework to ship with lldb

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 6 22:52:27 PST 2019


aadsm created this revision.
aadsm added reviewers: hhb, sgraenitz, xiaobai, smeenai.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.

I want to be able to specify which python framework to use for lldb in macos. With python2.7 we could just rely on the MacOS one but python3.7 is not shipped with the OS.
An alternative is to use the one shipped with Xcode but that could be path dependent or maybe the user doesn't have Xcode installed at all.
A definite solution is to just ship a python framework with lldb. To make this possible I added two new variables:

`PYTHON_FRAMEWORK_DIR`: with the path of the Python.framework to ship and link against
`PYTHON_FRAMEWORK_INSTALL_RPATH`: If the install_path of the python binary uses an @rpath then we need to be able to set this accordingly.

Here's an example:

  -DPYTHON_FRAMEWORK_DIR="/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework"
  -DPYTHON_FRAMEWORK_INSTALL_RPATH="@loader_path/../../../"

What do you think?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69931

Files:
  lldb/cmake/modules/LLDBFramework.cmake


Index: lldb/cmake/modules/LLDBFramework.cmake
===================================================================
--- lldb/cmake/modules/LLDBFramework.cmake
+++ lldb/cmake/modules/LLDBFramework.cmake
@@ -120,3 +120,14 @@
     COMMENT "LLDB.framework: copy clang vendor-specific headers"
   )
 endif()
+
+# Import Python framework if specified
+if(PYTHON_FRAMEWORK_DIR)
+  install(DIRECTORY ${PYTHON_FRAMEWORK_DIR}
+    DESTINATION ${LLDB_FRAMEWORK_INSTALL_DIR}
+    COMPONENT liblldb)
+  if(PYTHON_FRAMEWORK_INSTALL_RPATH)
+    set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH
+      ${PYTHON_FRAMEWORK_INSTALL_RPATH})
+  endif()
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69931.228180.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191107/19a49a08/attachment.bin>


More information about the lldb-commits mailing list