[Lldb-commits] [lldb] 6de63b3 - [lldb/lua] Force Lua version to be 5.3
Author: Siger Yang Date: 2021-10-12T21:34:15+08:00 New Revision: 6de63b3ba5e2dbb5994d329623fbf933e319ea7a URL: https://github.com/llvm/llvm-project/commit/6de63b3ba5e2dbb5994d329623fbf933e319ea7a DIFF: https://github.com/llvm/llvm-project/commit/6de63b3ba5e2dbb5994d329623fbf933e319ea7a.diff LOG: [lldb/lua] Force Lua version to be 5.3 Due to CMake cache, find_package in FindLuaAndSwig.cmake will be ignored. This commit adds EXACT and REQUIRED flags to it and removes find_package in Lua ScriptInterpreter. Signed-off-by: Siger Yang Reviewed By: tammela, JDevlieghere Differential Revision: https://reviews.llvm.org/D108515 Added: Modified: lldb/cmake/modules/FindLuaAndSwig.cmake lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt Removed: diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake index f6251bbd1042c..982616169a05e 100644 --- a/lldb/cmake/modules/FindLuaAndSwig.cmake +++ b/lldb/cmake/modules/FindLuaAndSwig.cmake @@ -9,7 +9,7 @@ if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE) else() find_package(SWIG 3.0) if (SWIG_FOUND) -find_package(Lua 5.3) +find_package(Lua 5.3 EXACT) if(LUA_FOUND AND SWIG_FOUND) mark_as_advanced( LUA_LIBRARIES diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt index f5c62ee3a54f3..498bd97839510 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt @@ -1,5 +1,3 @@ -find_package(Lua REQUIRED) - add_lldb_library(lldbPluginScriptInterpreterLua PLUGIN Lua.cpp ScriptInterpreterLua.cpp ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 67f94e5 - [lldb/lua] Supplement Lua bindings for lldb module
Author: Siger Yang Date: 2021-10-12T22:10:21+08:00 New Revision: 67f94e5a9745665dd62550c75cb16569fbb0059d URL: https://github.com/llvm/llvm-project/commit/67f94e5a9745665dd62550c75cb16569fbb0059d DIFF: https://github.com/llvm/llvm-project/commit/67f94e5a9745665dd62550c75cb16569fbb0059d.diff LOG: [lldb/lua] Supplement Lua bindings for lldb module Add necessary typemaps for Lua bindings, together with some other files. Signed-off-by: Siger Yang Reviewed By: tammela Differential Revision: https://reviews.llvm.org/D108090 Added: lldb/test/API/lua_api/Makefile lldb/test/API/lua_api/TestBreakpointAPI.lua lldb/test/API/lua_api/TestComprehensive.lua lldb/test/API/lua_api/TestFileHandle.lua lldb/test/API/lua_api/TestLuaAPI.py lldb/test/API/lua_api/TestProcessAPI.lua lldb/test/API/lua_api/lua_lldb_test.lua lldb/test/API/lua_api/main.c Modified: lldb/CMakeLists.txt lldb/bindings/lua/CMakeLists.txt lldb/bindings/lua/lua-typemaps.swig lldb/bindings/lua/lua-wrapper.swig lldb/bindings/lua/lua.swig lldb/source/API/liblldb-private.exports lldb/source/API/liblldb.exports lldb/test/API/lit.site.cfg.py.in lldb/test/API/lldbtest.py Removed: diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 594c769141b43..028dadbb8c73c 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -51,6 +51,13 @@ if (LLDB_ENABLE_PYTHON) CACHE STRING "Path where Python modules are installed, relative to install prefix") endif () +if (LLDB_ENABLE_LUA) + find_program(Lua_EXECUTABLE lua5.3) + set(LLDB_LUA_DEFAULT_RELATIVE_PATH "lib/lua/5.3") + set(LLDB_LUA_RELATIVE_PATH ${LLDB_LUA_DEFAULT_RELATIVE_PATH} +CACHE STRING "Path where Lua modules are installed, relative to install prefix") +endif () + if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA) add_subdirectory(bindings) endif () @@ -94,6 +101,16 @@ if (LLDB_ENABLE_PYTHON) finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}") endif() +if (LLDB_ENABLE_LUA) + if(LLDB_BUILD_FRAMEWORK) +set(lldb_lua_target_dir "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Lua") + else() +set(lldb_lua_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_LUA_RELATIVE_PATH}") + endif() + get_target_property(lldb_lua_bindings_dir swig_wrapper_lua BINARY_DIR) + finish_swig_lua("lldb-lua" "${lldb_lua_bindings_dir}" "${lldb_lua_target_dir}") +endif() + option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS}) if(LLDB_INCLUDE_TESTS) add_subdirectory(test) diff --git a/lldb/bindings/lua/CMakeLists.txt b/lldb/bindings/lua/CMakeLists.txt index 7148f13704560..1a739a9805ec8 100644 --- a/lldb/bindings/lua/CMakeLists.txt +++ b/lldb/bindings/lua/CMakeLists.txt @@ -17,3 +17,55 @@ add_custom_command( add_custom_target(swig_wrapper_lua ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp ) + +function(create_lua_package swig_target working_dir pkg_dir) + cmake_parse_arguments(ARG "NOINIT" "" "FILES" ${ARGN}) + add_custom_command(TARGET ${swig_target} POST_BUILD VERBATIM +COMMAND ${CMAKE_COMMAND} -E make_directory ${pkg_dir} +WORKING_DIRECTORY ${working_dir}) +endfunction() + +function(finish_swig_lua swig_target lldb_lua_bindings_dir lldb_lua_target_dir) + add_custom_target(${swig_target} ALL VERBATIM +COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_lua_target_dir} +DEPENDS swig_wrapper_lua +COMMENT "LLDB Lua API") + if(LLDB_BUILD_FRAMEWORK) +set(LIBLLDB_SYMLINK_DEST "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/LLDB") + else() +set(LIBLLDB_SYMLINK_DEST "${LLVM_SHLIB_OUTPUT_INTDIR}/liblldb${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + if(WIN32) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb_d.pyd") +else() + set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb.pyd") +endif() + else() +set(LIBLLDB_SYMLINK_OUTPUT_FILE "lldb.so") + endif() + create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST} + ${lldb_lua_target_dir} ${LIBLLDB_SYMLINK_OUTPUT_FILE}) + set(lldb_lua_library_target "${swig_target}-library") + add_custom_target(${lldb_lua_library_target}) + add_dependencies(${lldb_lua_library_target} ${swig_target}) + + # Ensure we do the Lua post-build step when building lldb. + add_dependencies(lldb ${swig_target}) + + if(LLDB_BUILD_FRAMEWORK) +set(LLDB_LUA_INSTALL_PATH ${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Resources/Python) + else() +set(LLDB_LUA_INSTALL_PATH ${LLDB_LUA_RELATIVE_PATH}) + endif() + install(DIRECTORY ${lldb_lua_target_dir}/ + DESTINATION ${LLDB_LUA_INSTALL_PATH} + COMPONENT ${lldb_lua_library_target}) + + set(lldb_lua_library_install_target "install-${lldb_lua_library_target}") + if (NOT LLVM_ENABLE_IDE) +add_llvm_install
[Lldb-commits] [lldb] 7bb42dc - [lldb/lua] Force Lua version to be 5.3
Author: Siger Yang Date: 2021-09-03T15:22:57+08:00 New Revision: 7bb42dc6b114f57200abfebaaa01160914be6bba URL: https://github.com/llvm/llvm-project/commit/7bb42dc6b114f57200abfebaaa01160914be6bba DIFF: https://github.com/llvm/llvm-project/commit/7bb42dc6b114f57200abfebaaa01160914be6bba.diff LOG: [lldb/lua] Force Lua version to be 5.3 Due to CMake cache, find_package in FindLuaAndSwig.cmake will be ignored. This commit adds EXACT and REQUIRED flags to it and removes find_package in Lua ScriptInterpreter. Signed-off-by: Siger Yang Reviewed By: tammela, JDevlieghere Differential Revision: https://reviews.llvm.org/D108515 Added: Modified: lldb/cmake/modules/FindLuaAndSwig.cmake lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt Removed: diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake index f6251bbd1042c..847394100c5a0 100644 --- a/lldb/cmake/modules/FindLuaAndSwig.cmake +++ b/lldb/cmake/modules/FindLuaAndSwig.cmake @@ -9,7 +9,7 @@ if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE) else() find_package(SWIG 3.0) if (SWIG_FOUND) -find_package(Lua 5.3) +find_package(Lua 5.3 EXACT REQUIRED) if(LUA_FOUND AND SWIG_FOUND) mark_as_advanced( LUA_LIBRARIES diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt index f5c62ee3a54f3..498bd97839510 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt @@ -1,5 +1,3 @@ -find_package(Lua REQUIRED) - add_lldb_library(lldbPluginScriptInterpreterLua PLUGIN Lua.cpp ScriptInterpreterLua.cpp ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 49229bb - Revert "[lldb/lua] Force Lua version to be 5.3"
Author: Siger Yang Date: 2021-09-03T17:31:25+08:00 New Revision: 49229bb92b4ba345a414732f4e2248b44c4fcb1d URL: https://github.com/llvm/llvm-project/commit/49229bb92b4ba345a414732f4e2248b44c4fcb1d DIFF: https://github.com/llvm/llvm-project/commit/49229bb92b4ba345a414732f4e2248b44c4fcb1d.diff LOG: Revert "[lldb/lua] Force Lua version to be 5.3" This commit causes buildbot failures if SWIG is available but Lua is not present. This reverts commit 7bb42dc6b114f57200abfebaaa01160914be6bba. Added: Modified: lldb/cmake/modules/FindLuaAndSwig.cmake lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt Removed: diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake index 847394100c5a0..f6251bbd1042c 100644 --- a/lldb/cmake/modules/FindLuaAndSwig.cmake +++ b/lldb/cmake/modules/FindLuaAndSwig.cmake @@ -9,7 +9,7 @@ if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND SWIG_EXECUTABLE) else() find_package(SWIG 3.0) if (SWIG_FOUND) -find_package(Lua 5.3 EXACT REQUIRED) +find_package(Lua 5.3) if(LUA_FOUND AND SWIG_FOUND) mark_as_advanced( LUA_LIBRARIES diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt index 498bd97839510..f5c62ee3a54f3 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/CMakeLists.txt @@ -1,3 +1,5 @@ +find_package(Lua REQUIRED) + add_lldb_library(lldbPluginScriptInterpreterLua PLUGIN Lua.cpp ScriptInterpreterLua.cpp ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits