mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
cmake: Allow building without Luajit
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.
This commit is contained in:
parent
509089d053
commit
d5c89b1896
@ -300,9 +300,6 @@ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
|
||||
find_package(Msgpack 1.0.0 REQUIRED)
|
||||
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
|
||||
|
||||
find_package(LuaJit REQUIRED)
|
||||
include_directories(SYSTEM ${LUAJIT_INCLUDE_DIRS})
|
||||
|
||||
find_package(Unibilium REQUIRED)
|
||||
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
|
||||
|
||||
@ -477,18 +474,24 @@ if(BUSTED_PRG)
|
||||
add_custom_target(benchmark-prereqs
|
||||
DEPENDS ${BENCHMARK_PREREQS})
|
||||
|
||||
add_custom_target(unittest
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DBUSTED_PRG=${BUSTED_PRG}
|
||||
-DLUA_PRG=${LUA_PRG}
|
||||
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=unit
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${UNITTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
|
||||
if(LUA_HAS_FFI)
|
||||
add_custom_target(unittest
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DBUSTED_PRG=${BUSTED_PRG}
|
||||
-DLUA_PRG=${LUA_PRG}
|
||||
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=unit
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${UNITTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
else()
|
||||
message(WARNING "The Luajit ffi is not available in ${LUA_PRG}"
|
||||
", disabling unit tests")
|
||||
endif()
|
||||
|
||||
add_custom_target(functionaltest
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
|
@ -8,8 +8,6 @@ function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR)
|
||||
RESULT_VARIABLE module_missing
|
||||
ERROR_QUIET)
|
||||
if(module_missing)
|
||||
message(STATUS
|
||||
"[${LUA_PRG_PATH}] The '${MODULE}' lua package is required for building Neovim")
|
||||
set(${RESULT_VAR} False PARENT_SCOPE)
|
||||
else()
|
||||
set(${RESULT_VAR} True PARENT_SCOPE)
|
||||
@ -29,6 +27,8 @@ function(check_lua_deps LUA_PRG_PATH MODULES RESULT_VAR)
|
||||
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()
|
||||
|
@ -231,7 +231,6 @@ endif()
|
||||
list(APPEND NVIM_LINK_LIBRARIES
|
||||
${LIBUV_LIBRARIES}
|
||||
${MSGPACK_LIBRARIES}
|
||||
${LUAJIT_LIBRARIES}
|
||||
${LIBVTERM_LIBRARIES}
|
||||
${LIBTERMKEY_LIBRARIES}
|
||||
${UNIBILIUM_LIBRARIES}
|
||||
|
Loading…
Reference in New Issue
Block a user