mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
d5c89b1896
By default Neovim searched a Luajit instalation and linked against the luajit library. In practice Neovim only requires luajit to run the unit tests. All other targets only require lua and the correct lua modules. This commit: 1. Remove the strict dependency on Luajit 2. Makes the unittest target depend on the lua 'ffi' module. If the module is not available the target is not enabled and a message is displayed.
39 lines
1.1 KiB
CMake
39 lines
1.1 KiB
CMake
#
|
|
# Functions to help checking for a Lua interpreter
|
|
#
|
|
|
|
# Check if a module is available in Lua
|
|
function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR)
|
|
execute_process(COMMAND ${LUA_PRG_PATH} -e "require('${MODULE}')"
|
|
RESULT_VARIABLE module_missing
|
|
ERROR_QUIET)
|
|
if(module_missing)
|
|
set(${RESULT_VAR} False PARENT_SCOPE)
|
|
else()
|
|
set(${RESULT_VAR} True PARENT_SCOPE)
|
|
endif()
|
|
endfunction()
|
|
|
|
# Check Lua interpreter for dependencies
|
|
function(check_lua_deps LUA_PRG_PATH MODULES RESULT_VAR)
|
|
# Check if the lua interpreter at the given path
|
|
# satisfies all Neovim dependencies
|
|
message(STATUS "Checking Lua interpreter ${LUA_PRG_PATH}")
|
|
if(NOT EXISTS ${LUA_PRG_PATH})
|
|
message(STATUS
|
|
"[${LUA_PRG_PATH}] file not found")
|
|
endif()
|
|
|
|
foreach(module ${MODULES})
|
|
check_lua_module(${LUA_PRG_PATH} ${module} has_module)
|
|
if(NOT has_module)
|
|
message(STATUS
|
|
"[${LUA_PRG_PATH}] The '${module}' lua package is required for building Neovim")
|
|
set(${RESULT_VAR} False PARENT_SCOPE)
|
|
return()
|
|
endif()
|
|
endforeach()
|
|
|
|
set(${RESULT_VAR} True PARENT_SCOPE)
|
|
endfunction()
|