aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-12-13 13:29:14 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-12-13 13:29:14 -0500
commit0ba6cb2f5cfe49ee1ee66c6246a77947af74ae5e (patch)
treea089061fe1212960b868408b9699e5b02f792880 /src
parent677a3f42c0f0821ddeed34728c8708fa4d0742cc (diff)
parent975f4ec3505b8bc2321ab2cb554aff40f2db614b (diff)
downloadrneovim-0ba6cb2f5cfe49ee1ee66c6246a77947af74ae5e.tar.gz
rneovim-0ba6cb2f5cfe49ee1ee66c6246a77947af74ae5e.tar.bz2
rneovim-0ba6cb2f5cfe49ee1ee66c6246a77947af74ae5e.zip
Merge pull request #1586 from oakes/master
libnvim: Allow building as a static library
Diffstat (limited to 'src')
-rw-r--r--src/nvim/CMakeLists.txt8
-rw-r--r--src/nvim/main.c4
2 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 8c05c6a2b2..8c0979026a 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -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})
diff --git a/src/nvim/main.c b/src/nvim/main.c
index c806431872..8c6df6a212 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -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