Skip to content

Commit

Permalink
build(Windows): make bundling nvim-qt optional (neovim#21866)
Browse files Browse the repository at this point in the history
Closes neovim#14552.
  • Loading branch information
3N4N authored Feb 8, 2023
1 parent 1ca4a8b commit 645daaf
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 64 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,18 @@ install_helper(
# 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(cmake.config)
add_subdirectory(test/functional/fixtures) # compile test programs
add_subdirectory(runtime)
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
if(WIN32)
if(WIN32 AND USE_BUNDLED_NVIMQT)
install_helper(
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim-qt/runtime/plugin)
Expand Down
10 changes: 8 additions & 2 deletions cmake.deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ else()
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." OFF)
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)

find_package(Git)
Expand Down Expand Up @@ -261,9 +265,11 @@ if(WIN32)
GetBinaryDep(TARGET wintools
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${DEPS_INSTALL_DIR}/bin)

GetBinaryDep(TARGET wingui
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory bin ${DEPS_INSTALL_DIR}/bin
if(USE_BUNDLED_NVIMQT)
GetBinaryDep(TARGET wingui
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory bin ${DEPS_INSTALL_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy_directory share ${DEPS_INSTALL_DIR}/share)
endif()

GetBinaryDep(TARGET win32yank_X86_64
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_INSTALL_DIR}/bin)
Expand Down
127 changes: 66 additions & 61 deletions src/nvim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -712,74 +712,79 @@ if(WIN32)
-P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake)
add_dependencies(nvim_runtime_deps nvim_dll_deps)

if(USE_BUNDLED_NVIMQT)
set(NVIMQT_DEPS
# Dependencies for neovim-qt
bearer/qgenericbearer.dll
iconengines/qsvgicon.dll
imageformats/qgif.dll
imageformats/qicns.dll
imageformats/qico.dll
imageformats/qjpeg.dll
imageformats/qsvg.dll
imageformats/qtga.dll
imageformats/qtiff.dll
imageformats/qwbmp.dll
imageformats/qwebp.dll
platforms/qwindows.dll
styles/qwindowsvistastyle.dll
translations/qt_ar.qm
translations/qt_bg.qm
translations/qt_ca.qm
translations/qt_cs.qm
translations/qt_da.qm
translations/qt_de.qm
translations/qt_en.qm
translations/qt_es.qm
translations/qt_fi.qm
translations/qt_fr.qm
translations/qt_gd.qm
translations/qt_he.qm
translations/qt_hu.qm
translations/qt_it.qm
translations/qt_ja.qm
translations/qt_ko.qm
translations/qt_lv.qm
translations/qt_pl.qm
translations/qt_ru.qm
translations/qt_sk.qm
translations/qt_uk.qm
D3Dcompiler_47.dll
libEGL.dll
libgcc_s_seh-1.dll
libGLESv2.dll
libstdc++-6.dll
libwinpthread-1.dll
nvim-qt.exe
opengl32sw.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Network.dll
Qt5Svg.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

# Dependencies for neovim-qt
bearer/qgenericbearer.dll
iconengines/qsvgicon.dll
imageformats/qgif.dll
imageformats/qicns.dll
imageformats/qico.dll
imageformats/qjpeg.dll
imageformats/qsvg.dll
imageformats/qtga.dll
imageformats/qtiff.dll
imageformats/qwbmp.dll
imageformats/qwebp.dll
platforms/qwindows.dll
styles/qwindowsvistastyle.dll
translations/qt_ar.qm
translations/qt_bg.qm
translations/qt_ca.qm
translations/qt_cs.qm
translations/qt_da.qm
translations/qt_de.qm
translations/qt_en.qm
translations/qt_es.qm
translations/qt_fi.qm
translations/qt_fr.qm
translations/qt_gd.qm
translations/qt_he.qm
translations/qt_hu.qm
translations/qt_it.qm
translations/qt_ja.qm
translations/qt_ko.qm
translations/qt_lv.qm
translations/qt_pl.qm
translations/qt_ru.qm
translations/qt_sk.qm
translations/qt_uk.qm
D3Dcompiler_47.dll
libEGL.dll
libgcc_s_seh-1.dll
libGLESv2.dll
libstdc++-6.dll
libwinpthread-1.dll
nvim-qt.exe
opengl32sw.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Network.dll
Qt5Svg.dll
Qt5Widgets.dll

)
get_filename_component(DEP_FILE_DIR ${DEP_FILE} DIRECTORY)
set(EXTERNAL_BLOBS_SCRIPT "${EXTERNAL_BLOBS_SCRIPT}\n"
"file(COPY \"${DEPS_PREFIX}/bin/${DEP_FILE}\"
DESTINATION \"${PROJECT_BINARY_DIR}/windows_runtime_deps/${DEP_FILE_DIR}\")")
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)
set(EXTERNAL_BLOBS_SCRIPT "${EXTERNAL_BLOBS_SCRIPT}\n"
"file(COPY \"${DEPS_PREFIX}/bin/${DEP_FILE}\"
DESTINATION \"${PROJECT_BINARY_DIR}/windows_runtime_deps/${DEP_FILE_DIR}\")")
endforeach()
file(WRITE ${PROJECT_BINARY_DIR}/external_blobs.cmake ${EXTERNAL_BLOBS_SCRIPT})
add_custom_target(external_blobs
Expand Down

0 comments on commit 645daaf

Please sign in to comment.