[Lldb-commits] [PATCH] D12667: [cmake] Remove LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION.

Bruce Mitchener via lldb-commits lldb-commits at lists.llvm.org
Sun Sep 6 08:06:19 PDT 2015


brucem created this revision.
brucem added reviewers: zturner, clayborg, labath.
brucem added a subscriber: lldb-commits.

This should be a mandatory build process going forward, if Python
is enabled. The longer term desire is to remove the old shell
scripts entirely.

http://reviews.llvm.org/D12667

Files:
  CMakeLists.txt
  cmake/modules/LLDBConfig.cmake
  scripts/CMakeLists.txt

Index: scripts/CMakeLists.txt
===================================================================
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -9,49 +9,26 @@
   ${LLDB_SOURCE_DIR}/include/lldb/lldb-versioning.h
 )
 
-if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION )
-  find_package(SWIG REQUIRED)
-  add_custom_command(
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
-    DEPENDS ${SWIG_SOURCES}
-    DEPENDS ${SWIG_INTERFACES}
-    DEPENDS ${SWIG_HEADERS}
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/buildSwigWrapperClasses.py
-    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/buildSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}" "--swigExecutable=${SWIG_EXECUTABLE}" -m
-    COMMENT "Python script building LLDB Python wrapper")  
-  set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
+find_package(SWIG REQUIRED)
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
+  DEPENDS ${SWIG_SOURCES}
+  DEPENDS ${SWIG_INTERFACES}
+  DEPENDS ${SWIG_HEADERS}
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/buildSwigWrapperClasses.py
+  COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/buildSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}" "--swigExecutable=${SWIG_EXECUTABLE}" -m
+  COMMENT "Python script building LLDB Python wrapper")
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
 
-  add_custom_target(swig_wrapper ALL
-    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
-    )
+add_custom_target(swig_wrapper ALL
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
+  )
 
-  # Install the LLDB python module on all operating systems (except Windows)
-  if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-    install(DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
-    DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-  endif()
-else ()
-  add_custom_command(
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
-    DEPENDS ${SWIG_SOURCES}
-      DEPENDS ${SWIG_INTERFACES}
-    # swig was directly invoked on Windows (where the Python API is not being generated) but on other platforms, we need to run the *swig-wrapper-classes.sh shell-scripts.
-    #COMMAND swig -c++ -shadow -python -I${LLDB_SOURCE_DIR}/include -I./. -outdir ${LLDB_SOURCE_DIR}/scripts/Python  -o ${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp ${LLDB_SOURCE_DIR}/scripts/lldb.swig
-    COMMAND env PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/build-swig-wrapper-classes.sh ${LLDB_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} -m
-    COMMAND env PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/finish-swig-wrapper-classes.sh ${LLDB_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} -m
-    COMMENT "Building lldb python wrapper")
-  set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
-
-  add_custom_target(swig_wrapper ALL
-    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
-    )
-
-  # Install the LLDB python module on all operating systems (except Windows)
-  if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-    install(DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
-    DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-  endif()
-endif ()
+# Install the LLDB python module on all operating systems (except Windows)
+if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+  install(DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
+  DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+endif()
 
 # build Python modules
 add_subdirectory(Python/modules)
Index: cmake/modules/LLDBConfig.cmake
===================================================================
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -26,8 +26,6 @@
 set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
   "Disables the Curses integration.")
 
-set(LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION 1 CACHE BOOL
-  "Enables using new Python scripts for SWIG API generation .")
 set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
   "Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -15,7 +15,7 @@
 add_subdirectory(unittests)
 add_subdirectory(lit)
 
-if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT LLDB_DISABLE_PYTHON )
+if (NOT LLDB_DISABLE_PYTHON)
 	# Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
     add_custom_target( finish_swig ALL
         COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12667.34122.patch
Type: text/x-patch
Size: 5419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150906/b832e553/attachment.bin>


More information about the lldb-commits mailing list