From 2f9aa579279ba7ba2daa262ef271f6ee27456bdc Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 8 Sep 2015 05:00:22 +0000 Subject: [PATCH] [cmake] Remove LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION. Summary: 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. Reviewers: zturner, clayborg, labath Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12667 llvm-svn: 246979 --- lldb/CMakeLists.txt | 2 +- lldb/cmake/modules/LLDBConfig.cmake | 2 - lldb/scripts/CMakeLists.txt | 59 +++++++++-------------------- 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index f29922652c8a..51f2e3c1d2aa 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -15,7 +15,7 @@ add_subdirectory(tools) 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 diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 7498c4cf2299..aee01e616166 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -26,8 +26,6 @@ set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL 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.") diff --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt index b4494d6ddd45..a393517824f7 100644 --- a/lldb/scripts/CMakeLists.txt +++ b/lldb/scripts/CMakeLists.txt @@ -9,49 +9,26 @@ set(SWIG_HEADERS ${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)