aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim')
-rwxr-xr-xsrc/nvim/CMakeLists.txt12
-rw-r--r--src/nvim/lua/stdlib.c11
2 files changed, 20 insertions, 3 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 329e831b2e..8884273649 100755
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -367,6 +367,12 @@ glob_wrapper(NVIM_HEADERS *.h)
glob_wrapper(EXTERNAL_SOURCES ../xdiff/*.c ../mpack/*.c ../cjson/*.c ../klib/*.c)
glob_wrapper(EXTERNAL_HEADERS ../xdiff/*.h ../mpack/*.h ../cjson/*.h ../klib/*.h)
+if(PREFER_LUA)
+ # luajit not used, use a vendored copy of the bit module
+ list(APPEND EXTERNAL_SOURCES ${PROJECT_SOURCE_DIR}/src/bit.c)
+ target_compile_definitions(main_lib INTERFACE NVIM_VENDOR_BIT)
+endif()
+
foreach(subdir
os
api
@@ -425,7 +431,7 @@ if(MSVC)
${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -wd4090 -wd4244 -wd4267")
else()
set_source_files_properties(
- ${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion -Wno-strict-prototypes")
+ ${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion -Wno-strict-prototypes -Wno-misleading-indentation")
endif()
# Log level (MIN_LOG_LEVEL in log.h)
@@ -684,8 +690,8 @@ if(UNIX)
endif()
endif()
-if(NOT LUAJIT_FOUND)
- message(STATUS "luajit not found, skipping unit tests")
+if(PREFER_LUA)
+ message(STATUS "luajit not used, skipping unit tests")
else()
glob_wrapper(UNIT_TEST_FIXTURES ${PROJECT_SOURCE_DIR}/test/unit/fixtures/*.c)
target_sources(nvim PRIVATE $<$<CONFIG:Debug>:${UNIT_TEST_FIXTURES}>)
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index 5aeff4de98..d9682ff63d 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -11,6 +11,10 @@
#include <string.h>
#include <sys/types.h>
+#ifdef NVIM_VENDOR_BIT
+# include "bit.h"
+#endif
+
#include "auto/config.h"
#include "cjson/lua_cjson.h"
#include "mpack/lmpack.h"
@@ -596,6 +600,13 @@ void nlua_state_add_stdlib(lua_State *const lstate, bool is_thread)
// vim.json
lua_cjson_new(lstate);
lua_setfield(lstate, -2, "json");
+
+#ifdef NVIM_VENDOR_BIT
+ // if building with puc lua, use internal fallback for require'bit'
+ int top = lua_gettop(lstate);
+ luaopen_bit(lstate);
+ lua_settop(lstate, top);
+#endif
}
/// like luaL_error, but allow cleanup