Skip to content

Commit 4858c85

Browse files
committed
[lldb] Support both Lua 5.3 and Lua 5.4
Lua 5.3 and Lua 5.4 are similar enough that we can easily support both in LLDB. This patch adds support for building LLDB with both and updates the documentation accordingly.
1 parent c93eb43 commit 4858c85

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

lldb/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ if (LLDB_ENABLE_PYTHON)
8787
endif ()
8888

8989
if (LLDB_ENABLE_LUA)
90-
find_program(Lua_EXECUTABLE lua5.3)
91-
set(LLDB_LUA_DEFAULT_RELATIVE_PATH "lib/lua/5.3")
90+
set(LLDB_LUA_DEFAULT_RELATIVE_PATH "lib/lua/${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
9291
set(LLDB_LUA_RELATIVE_PATH ${LLDB_LUA_DEFAULT_RELATIVE_PATH}
9392
CACHE STRING "Path where Lua modules are installed, relative to install prefix")
9493
endif ()

lldb/cmake/modules/FindLuaAndSwig.cmake

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,21 @@ if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND LLDB_ENABLE_SWIG)
88
set(LUAANDSWIG_FOUND TRUE)
99
else()
1010
if (LLDB_ENABLE_SWIG)
11-
find_package(Lua 5.3 EXACT)
11+
find_package(Lua 5.3)
1212
if(LUA_FOUND)
13+
# Find the Lua executable. Only required to run a subset of the Lua
14+
# tests.
15+
find_program(LUA_EXECUTABLE
16+
NAMES
17+
"lua"
18+
"lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}"
19+
)
1320
mark_as_advanced(
1421
LUA_LIBRARIES
15-
LUA_INCLUDE_DIR)
22+
LUA_INCLUDE_DIR
23+
LUA_VERSION_MINOR
24+
LUA_VERSION_MAJOR
25+
LUA_EXECUTABLE)
1626
endif()
1727
else()
1828
message(STATUS "SWIG 4 or later is required for Lua support in LLDB but could not be found")
@@ -26,5 +36,7 @@ else()
2636
REQUIRED_VARS
2737
LUA_LIBRARIES
2838
LUA_INCLUDE_DIR
39+
LUA_VERSION_MINOR
40+
LUA_VERSION_MAJOR
2941
LLDB_ENABLE_SWIG)
3042
endif()

lldb/docs/resources/build.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ CMake configuration error.
6464
+-------------------+------------------------------------------------------+--------------------------+
6565
| Python | Python scripting | ``LLDB_ENABLE_PYTHON`` |
6666
+-------------------+------------------------------------------------------+--------------------------+
67-
| Lua | Lua scripting | ``LLDB_ENABLE_LUA`` |
67+
| Lua | Lua scripting. Lua 5.3 and 5.4 are supported. | ``LLDB_ENABLE_LUA`` |
6868
+-------------------+------------------------------------------------------+--------------------------+
6969

7070
Depending on your platform and package manager, one might run any of the

lldb/test/API/lit.site.cfg.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
2020
config.target_triple = "@LLVM_TARGET_TRIPLE@"
2121
config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
2222
config.python_executable = "@Python3_EXECUTABLE@"
23-
config.lua_executable = "@Lua_EXECUTABLE@"
23+
config.lua_executable = "@LUA_EXECUTABLE@"
2424
config.lua_test_entry = "TestLuaAPI.py"
2525
config.dotest_common_args_str = lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
2626
config.dotest_user_args_str = lit_config.substitute("@LLDB_TEST_USER_ARGS@")

0 commit comments

Comments
 (0)