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()


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()
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to