[Lldb-commits] [PATCH] D14790: cmake: add -DLLDB_ALLOW_STATIC_BINDINGS=1, defaults off
Todd Fiala via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 18 14:58:16 PST 2015
tfiala created this revision.
tfiala added reviewers: labath, zturner, spyffe.
tfiala added a subscriber: lldb-commits.
This change does the following:
* Adds a cached LLDB_ALLOW_STATIC_BINDINGS variable, defaults to off/false
* If specified, flips on the --allow-static-binding flag to prepare_bindings.py
* Removes the REQUIRED marker in cmake-based swig discovery, but adds a fatal error for cmake if swig isn't found when LLDB_ALLOW_STATIC_BINDINGS is also not set. i.e. unless -DLLDB_ALLOW_STATIC_BINDINGS=1 is specified on the command line, not finding swig will fail the cmake step as before.
As noted in a prior thread, I will be happy to rip this out once we no longer require swig via other means. This can be considered temporary until that time.
http://reviews.llvm.org/D14790
Files:
cmake/modules/LLDBConfig.cmake
scripts/CMakeLists.txt
Index: scripts/CMakeLists.txt
===================================================================
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -9,16 +9,25 @@
${LLDB_SOURCE_DIR}/include/lldb/lldb-versioning.h
)
-find_package(SWIG REQUIRED)
+set(PREPARE_BINDINGS_ARGS "--src-root=${LLDB_SOURCE_DIR}" "--target-dir=${CMAKE_CURRENT_BINARY_DIR}" "--config-build-dir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}")
+
+find_package(SWIG)
+if( ${SWIG_FOUND} )
+ set(PREPARE_BINDINGS_ARGS ${PREPARE_BINDINGS_ARGS} "--swig-executable=${SWIG_EXECUTABLE}")
+elseif( ${LLDB_ALLOW_STATIC_BINDINGS} )
+ set(PREPARE_BINDINGS_ARGS ${PREPARE_BINDINGS_ARGS} --find-swig --allow-static-binding)
+else()
+ message( FATAL_ERROR "swig not found and static bindings not permitted - install swig or specify -DLLDB_ALLOW_STATIC_BINDINGS=1")
+endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
DEPENDS ${SWIG_SOURCES}
DEPENDS ${SWIG_INTERFACES}
DEPENDS ${SWIG_HEADERS}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/buildSwigPython.py
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/modify-python-lldb.py
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/prepare_bindings.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}" "--prefix=${CMAKE_BINARY_DIR}" "--swigExecutable=${SWIG_EXECUTABLE}"
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/prepare_bindings.py ${PREPARE_BINDINGS_ARGS}
COMMENT "Python script building LLDB Python wrapper")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp PROPERTIES GENERATED 1)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
Index: cmake/modules/LLDBConfig.cmake
===================================================================
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -23,6 +23,9 @@
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
"Disables the Python scripting integration.")
+set(LLDB_ALLOW_STATIC_BINDINGS FALSE CACHE BOOL
+ "Enable using static/baked language bindings if swig is not present.")
+message(LLDB_ALLOW_STATIC_BINDINGS: ${LLDB_ALLOW_STATIC_BINDINGS})
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
"Disables the Curses integration.")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14790.40564.patch
Type: text/x-patch
Size: 2431 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151118/a75147e9/attachment.bin>
More information about the lldb-commits
mailing list