@@ -60,8 +60,10 @@ endfunction()
6060function (finish_swig_python swig_target lldb_python_bindings_dir lldb_python_target_dir)
6161 # Add a Post-Build Event to copy over Python files and create the symlink to
6262 # liblldb.so for the Python API(hardlink on Windows).
63+ # Note that Swig-generated code is located one level deeper in the `native`
64+ # module, in order to avoid cyclic importing.
6365 add_custom_target (${swig_target} ALL VERBATIM
64- COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir}
66+ COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir} /native/
6567 DEPENDS ${lldb_python_bindings_dir} /lldb.py
6668 COMMENT "Python script sym-linking LLDB Python API" )
6769
@@ -75,6 +77,8 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
7577 "${LLDB_SOURCE_DIR} /source/Interpreter/embedded_interpreter.py"
7678 "${lldb_python_target_dir} " )
7779
80+ create_python_package(${swig_target} ${lldb_python_target_dir} "native" FILES )
81+
7882 # Distribute the examples as python packages.
7983 create_python_package(
8084 ${swig_target}
@@ -142,7 +146,7 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
142146 endif ()
143147 set (LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb${LLDB_PYTHON_EXT_SUFFIX} " )
144148 create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST}
145- ${lldb_python_target_dir} ${LIBLLDB_SYMLINK_OUTPUT_FILE} )
149+ ${lldb_python_target_dir} /native/ ${LIBLLDB_SYMLINK_OUTPUT_FILE} )
146150
147151
148152 if (NOT WIN32 )
0 commit comments