fix(build): make vendored libmpack and libmpack-lua build properly

This commit is contained in:
Björn Linse 2021-09-04 17:05:22 +02:00
parent 4ef3c2c2c1
commit 2a08aeff1a
3 changed files with 16 additions and 16 deletions

View File

@ -15,8 +15,6 @@
* compilation.
*/
#define LUA_LIB
/* for snprintf */
#define _XOPEN_SOURCE 500
#include <limits.h>
#include <stdlib.h>
#include <string.h>
@ -26,12 +24,11 @@
#include <lua.h>
#include <luaconf.h>
#ifdef MPACK_USE_SYSTEM
# include <mpack.h>
#else
# define MPACK_API static
# include "mpack-src/src/mpack.c"
#endif
#include "nvim/macros.h"
#include "lmpack.h"
#include "rpc.h"
#define UNPACKER_META_NAME "mpack.Unpacker"
#define PACKER_META_NAME "mpack.Packer"
@ -713,7 +710,7 @@ static void lmpack_unparse_enter(mpack_parser_t *parser, mpack_node_t *node)
node->tok = mpack_pack_nil();
break;
}
/* Fallthrough */
FALLTHROUGH;
default:
{
/* #define FMT */

3
src/mpack/lmpack.h Normal file
View File

@ -0,0 +1,3 @@
#include <lua.h>
int luaopen_mpack(lua_State *L);

View File

@ -87,8 +87,8 @@ file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src)
file(GLOB NVIM_SOURCES *.c)
file(GLOB NVIM_HEADERS *.h)
file(GLOB XDIFF_SOURCES ../xdiff/*.c)
file(GLOB XDIFF_HEADERS ../xdiff/*.h)
file(GLOB EXTERNAL_SOURCES ../xdiff/*.c ../mpack/*.c)
file(GLOB EXTERNAL_HEADERS ../xdiff/*.h ../mpack/*.h)
foreach(subdir
os
@ -171,8 +171,8 @@ foreach(sfile ${CONV_SOURCES})
message(FATAL_ERROR "${sfile} doesn't exist (it was added to CONV_SOURCES)")
endif()
endforeach()
# xdiff: inlined external project, we don't maintain it. #9306
list(APPEND CONV_SOURCES ${XDIFF_SOURCES})
# xdiff, mpack: inlined external project, we don't maintain it. #9306
list(APPEND CONV_SOURCES ${EXTERNAL_SOURCES})
if(NOT MSVC)
set_source_files_properties(
@ -471,7 +471,7 @@ endif()
add_executable(nvim ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS}
${NVIM_GENERATED_SOURCES} ${NVIM_SOURCES} ${NVIM_HEADERS}
${XDIFF_SOURCES} ${XDIFF_HEADERS})
${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS})
target_link_libraries(nvim ${NVIM_EXEC_LINK_LIBRARIES})
install_helper(TARGETS nvim)
@ -602,7 +602,7 @@ add_library(
EXCLUDE_FROM_ALL
${NVIM_SOURCES} ${NVIM_GENERATED_SOURCES}
${NVIM_HEADERS} ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS}
${XDIFF_SOURCES} ${XDIFF_HEADERS}
${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS}
)
set_property(TARGET libnvim APPEND PROPERTY
INCLUDE_DIRECTORIES ${LUA_PREFERRED_INCLUDE_DIRS})
@ -632,7 +632,7 @@ else()
EXCLUDE_FROM_ALL
${NVIM_SOURCES} ${NVIM_GENERATED_SOURCES}
${NVIM_HEADERS} ${NVIM_GENERATED_FOR_SOURCES} ${NVIM_GENERATED_FOR_HEADERS}
${XDIFF_SOURCES} ${XDIFF_HEADERS}
${EXTERNAL_SOURCES} ${EXTERNAL_HEADERS}
${UNIT_TEST_FIXTURES}
)
target_link_libraries(nvim-test ${NVIM_TEST_LINK_LIBRARIES})