From 0b2f6a0cf4c50d86744b1d3d774103db39773b4c Mon Sep 17 00:00:00 2001 From: John Szakmeister Date: Mon, 3 Mar 2014 10:09:06 -0500 Subject: Revamp the build system. This achieves several goals: * Less reliance on scripts so we have better portability to Windows (though we still have a ways to go for proper Windows support). Luajit, luarocks, moonscript, and busted are all installed via CMake now. * Trying to make use of pkg-config to get the correct libraries. The latest libuv is still broken in this regard, but we'll at least be in a position to use it. * Allow the use of Ninja or make. The former runs faster in many environments, and automatically makes use of parallel builds. This also allows for system installed dependencies--though not through the Makefile just yet--and adds support for FreeBSD. This also make us build libuv and luajit as static libraries only, since we're only concerned about having static libraries for our bundled dependencies. --- src/CMakeLists.txt | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4cb988d14c..86be94238a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,15 +25,12 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang") endif() endif() -if(NOT DEFINED ENV{SKIP_EXEC}) - add_executable (nvim ${NEOVIM_SOURCES} ${OS_SOURCES}) -endif() -if(NOT DEFINED ENV{SKIP_UNITTEST}) - add_library (nvim-test MODULE ${NEOVIM_SOURCES} ${OS_SOURCES}) -endif() - # The libraries we link against for nvim -set(NVIM_LINK_LIBRARIES m ${LibUV_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +set(NVIM_LINK_LIBRARIES + m + ${LIBUV_LIBRARIES} + ${LUAJIT_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT}) # Add any libraries needed for a specific platform if(HAVE_CLOCK_GETTIME) @@ -45,34 +42,25 @@ if (LibIntl_FOUND) list(APPEND NVIM_LINK_LIBRARIES ${LibIntl_LIBRARY}) endif() -if(NOT DEFINED ENV{SKIP_EXEC}) - target_link_libraries (nvim ${NVIM_LINK_LIBRARIES}) -endif() -if(NOT DEFINED ENV{SKIP_UNITTEST}) - target_link_libraries (nvim-test ${NVIM_LINK_LIBRARIES}) -endif() - include(CheckLibraryExists) + check_library_exists(curses tgetent "" HAVE_LIBCURSES) if (HAVE_LIBCURSES) - if(NOT DEFINED ENV{SKIP_EXEC}) - target_link_libraries(nvim curses) - endif() - if(NOT DEFINED ENV{SKIP_UNITTEST}) - target_link_libraries(nvim-test curses) - endif() + list(APPEND NVIM_LINK_LIBRARIES curses) else() find_package(Curses REQUIRED) - if(NOT DEFINED ENV{SKIP_EXEC}) - target_link_libraries(nvim ${CURSES_LIBRARIES}) - endif() - if(DEFINED ENV{SKIP_UNITTEST}) - target_link_libraries(nvim-test ${CURSES_LIBRARIES}) - endif() + list(APPEND NVIM_LINK_LIBRARIES ${CURSES_LIBRARIES}) endif() -include_directories ("${PROJECT_SOURCE_DIR}/src/proto") - if(NOT DEFINED ENV{SKIP_EXEC}) + add_executable(nvim ${NEOVIM_SOURCES} ${OS_SOURCES}) + target_link_libraries(nvim ${NVIM_LINK_LIBRARIES}) install(TARGETS nvim RUNTIME DESTINATION bin) endif() + +if(NOT DEFINED ENV{SKIP_UNITTEST}) + add_library(nvim-test MODULE ${NEOVIM_SOURCES} ${OS_SOURCES}) + target_link_libraries (nvim-test ${NVIM_LINK_LIBRARIES}) +endif() + +include_directories ("${PROJECT_SOURCE_DIR}/src/proto") -- cgit