@@ -59,8 +59,10 @@ endfunction()
5959function (finish_swig_python swig_target lldb_python_bindings_dir lldb_python_target_dir)
6060 # Add a Post-Build Event to copy over Python files and create the symlink to
6161 # liblldb.so for the Python API(hardlink on Windows).
62+ # Note that Swig-generated code is located one level deeper in the `native`
63+ # module, in order to avoid cyclic importing.
6264 add_custom_target (${swig_target} ALL VERBATIM
63- COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir}
65+ COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir} /native/
6466 DEPENDS ${lldb_python_bindings_dir} /lldb.py
6567 COMMENT "Python script sym-linking LLDB Python API" )
6668
@@ -74,6 +76,8 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
7476 "${LLDB_SOURCE_DIR} /source/Interpreter/embedded_interpreter.py"
7577 "${lldb_python_target_dir} " )
7678
79+ create_python_package(${swig_target} ${lldb_python_target_dir} "native" FILES )
80+
7781 # Distribute the examples as python packages.
7882 create_python_package(
7983 ${swig_target}
@@ -141,7 +145,7 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
141145 endif ()
142146 set (LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb${LLDB_PYTHON_EXT_SUFFIX} " )
143147 create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST}
144- ${lldb_python_target_dir} ${LIBLLDB_SYMLINK_OUTPUT_FILE} )
148+ ${lldb_python_target_dir} /native/ ${LIBLLDB_SYMLINK_OUTPUT_FILE} )
145149
146150
147151 if (NOT WIN32 )
0 commit comments