build(Windows): make bundling nvim-qt optional (#21866)

Closes https://github.com/neovim/neovim/issues/14552.
This commit is contained in:
Enan Ajmain
2023-02-08 15:08:18 +06:00
committed by GitHub
parent 1ca4a8b1dd
commit 645daaf5e9
3 changed files with 80 additions and 63 deletions

View File

@@ -310,12 +310,18 @@ install_helper(
# Go down the tree. # Go down the tree.
# #
if(EXISTS "${DEPS_PREFIX}/share/nvim-qt")
option(USE_BUNDLED_NVIMQT "Bundle neovim-qt" ON)
else()
option(USE_BUNDLED_NVIMQT "Bundle neovim-qt" OFF)
endif()
add_subdirectory(src/nvim) add_subdirectory(src/nvim)
add_subdirectory(cmake.config) add_subdirectory(cmake.config)
add_subdirectory(test/functional/fixtures) # compile test programs add_subdirectory(test/functional/fixtures) # compile test programs
add_subdirectory(runtime) add_subdirectory(runtime)
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS) get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
if(WIN32) if(WIN32 AND USE_BUNDLED_NVIMQT)
install_helper( install_helper(
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim-qt/runtime/plugin) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim-qt/runtime/plugin)

View File

@@ -76,6 +76,10 @@ else()
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." OFF) option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." OFF)
endif() endif()
if(WIN32)
option(USE_BUNDLED_NVIMQT "Bundle neovim-qt" ON)
endif()
option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF) option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF)
find_package(Git) find_package(Git)
@@ -261,9 +265,11 @@ if(WIN32)
GetBinaryDep(TARGET wintools GetBinaryDep(TARGET wintools
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${DEPS_INSTALL_DIR}/bin) INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${DEPS_INSTALL_DIR}/bin)
if(USE_BUNDLED_NVIMQT)
GetBinaryDep(TARGET wingui GetBinaryDep(TARGET wingui
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory bin ${DEPS_INSTALL_DIR}/bin INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory bin ${DEPS_INSTALL_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory share ${DEPS_INSTALL_DIR}/share) COMMAND ${CMAKE_COMMAND} -E copy_directory share ${DEPS_INSTALL_DIR}/share)
endif()
GetBinaryDep(TARGET win32yank_X86_64 GetBinaryDep(TARGET win32yank_X86_64
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_INSTALL_DIR}/bin) INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_INSTALL_DIR}/bin)

View File

@@ -712,20 +712,8 @@ if(WIN32)
-P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake) -P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake)
add_dependencies(nvim_runtime_deps nvim_dll_deps) add_dependencies(nvim_runtime_deps nvim_dll_deps)
# A CMake script is used for copying the files to avoid the if(USE_BUNDLED_NVIMQT)
# "command line is too long" error that occurs when Ninja tries running set(NVIMQT_DEPS
# a command that exceeds the length limit (8191 characters) on Windows.
# See https://developercommunity.visualstudio.com/content/problem/212207/file-open-cmake-the-command-line-is-too-long.html
set(EXTERNAL_BLOBS_SCRIPT
"file(MAKE_DIRECTORY \"${PROJECT_BINARY_DIR}/windows_runtime_deps/platforms\")")
foreach(DEP_FILE IN ITEMS
curl-ca-bundle.crt
curl.exe
diff.exe
tee.exe
win32yank.exe
xxd.exe
# Dependencies for neovim-qt # Dependencies for neovim-qt
bearer/qgenericbearer.dll bearer/qgenericbearer.dll
iconengines/qsvgicon.dll iconengines/qsvgicon.dll
@@ -774,7 +762,24 @@ if(WIN32)
Qt5Network.dll Qt5Network.dll
Qt5Svg.dll Qt5Svg.dll
Qt5Widgets.dll Qt5Widgets.dll
)
endif()
# A CMake script is used for copying the files to avoid the
# "command line is too long" error that occurs when Ninja tries running
# a command that exceeds the length limit (8191 characters) on Windows.
# See https://developercommunity.visualstudio.com/content/problem/212207/file-open-cmake-the-command-line-is-too-long.html
set(EXTERNAL_BLOBS_SCRIPT
"file(MAKE_DIRECTORY \"${PROJECT_BINARY_DIR}/windows_runtime_deps/platforms\")")
foreach(DEP_FILE IN ITEMS
curl-ca-bundle.crt
curl.exe
diff.exe
tee.exe
win32yank.exe
xxd.exe
${NVIMQT_DEPS}
) )
get_filename_component(DEP_FILE_DIR ${DEP_FILE} DIRECTORY) get_filename_component(DEP_FILE_DIR ${DEP_FILE} DIRECTORY)
set(EXTERNAL_BLOBS_SCRIPT "${EXTERNAL_BLOBS_SCRIPT}\n" set(EXTERNAL_BLOBS_SCRIPT "${EXTERNAL_BLOBS_SCRIPT}\n"