Skip to content

Commit

Permalink
Windows: Install runtime dependencies with Neovim binary
Browse files Browse the repository at this point in the history
Look for runtime dependencies diff.exe and win32yank.exe (and
recursively for DLL dependencies) and install them with nvim.exe. If a
dependency is missing a warning will be issued.
  • Loading branch information
equalsraf committed Jan 20, 2017
1 parent 1cb5230 commit a27fcf3
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions src/nvim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,18 +292,40 @@ target_link_libraries(nvim ${NVIM_EXEC_LINK_LIBRARIES})
install_helper(TARGETS nvim)

if(WIN32)
# Copy DLLs to bin/ and install them along with nvim
add_custom_target(nvim_dll_deps ALL DEPENDS nvim
# Copy DLLs and third-party tools to bin/ and install them along with nvim
add_custom_target(nvim_runtime_deps ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps/
${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
install(DIRECTORY ${PROJECT_BINARY_DIR}/windows_runtime_deps/
DESTINATION ${CMAKE_INSTALL_BINDIR})

foreach(BIN win32yank.exe)
unset(BIN_PATH CACHE)
find_program(BIN_PATH ${BIN})
if(NOT BIN_PATH)
message(FATAL_ERROR "Unable to find external dependency ${BIN}")
endif()

add_custom_target(external_${BIN}
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps
COMMAND ${CMAKE_COMMAND}
"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
-DBINARY="${BIN_PATH}"
-DDST=${PROJECT_BINARY_DIR}/windows_runtime_deps
-P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake
COMMAND ${CMAKE_COMMAND} -E copy ${BIN_PATH} ${PROJECT_BINARY_DIR}/windows_runtime_deps/
COMMENT "${BIN_PATH}")
add_dependencies(nvim_runtime_deps "external_${BIN}")
endforeach()

add_custom_target(nvim_dll_deps DEPENDS nvim
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps
COMMAND ${CMAKE_COMMAND}
"-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
-DBINARY="${PROJECT_BINARY_DIR}/bin/nvim${CMAKE_EXECUTABLE_SUFFIX}"
-DDST=${PROJECT_BINARY_DIR}/windows_runtime_deps
-P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps/
${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
install(DIRECTORY ${PROJECT_BINARY_DIR}/windows_runtime_deps/
DESTINATION ${CMAKE_INSTALL_BINDIR})
-P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake)
add_dependencies(nvim_runtime_deps nvim_dll_deps)
endif()

if(CLANG_ASAN_UBSAN)
Expand Down

0 comments on commit a27fcf3

Please sign in to comment.