mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
Allow building as a static -fPIC library
This commit is contained in:
parent
d5741e5124
commit
dd9e5a3d7a
@ -185,6 +185,8 @@ set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
# Find Lua interpreter
|
||||
include(LuaHelpers)
|
||||
|
5
Makefile
5
Makefile
@ -51,6 +51,9 @@ all: nvim
|
||||
nvim: build/.ran-cmake deps
|
||||
+$(BUILD_CMD) -C build
|
||||
|
||||
libnvim: build/.ran-cmake deps
|
||||
+$(BUILD_CMD) -C build libnvim
|
||||
|
||||
cmake:
|
||||
touch CMakeLists.txt
|
||||
$(MAKE) build/.ran-cmake
|
||||
@ -95,4 +98,4 @@ distclean: clean
|
||||
install: | nvim
|
||||
+$(BUILD_CMD) -C build install
|
||||
|
||||
.PHONY: test functionaltest unittest clean distclean nvim cmake deps install
|
||||
.PHONY: test functionaltest unittest clean distclean nvim libnvim cmake deps install
|
||||
|
@ -208,6 +208,14 @@ if(SANITIZE)
|
||||
set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=address -fsanitize=undefined ")
|
||||
endif()
|
||||
|
||||
add_library(libnvim STATIC EXCLUDE_FROM_ALL ${NEOVIM_GENERATED_SOURCES}
|
||||
${NEOVIM_SOURCES} ${NEOVIM_HEADERS})
|
||||
target_link_libraries(libnvim ${NVIM_LINK_LIBRARIES})
|
||||
set_target_properties(libnvim PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
OUTPUT_NAME nvim)
|
||||
set_property(TARGET libnvim APPEND_STRING PROPERTY COMPILE_FLAGS " -DMAKE_LIB ")
|
||||
|
||||
add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NEOVIM_GENERATED_SOURCES}
|
||||
${NEOVIM_SOURCES} ${NEOVIM_HEADERS})
|
||||
target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES})
|
||||
|
@ -194,7 +194,11 @@ void early_init(void)
|
||||
}
|
||||
|
||||
#ifndef NO_VIM_MAIN /* skip this for unittests */
|
||||
#ifdef MAKE_LIB
|
||||
int nvim_main(int argc, char **argv)
|
||||
#else
|
||||
int main(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
char_u *fname = NULL; /* file name from command line */
|
||||
mparm_T params; /* various parameters passed between
|
||||
|
Loading…
Reference in New Issue
Block a user